2
0

SRP_VBASE_new.pod 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. =pod
  2. =head1 NAME
  3. SRP_VBASE_new,
  4. SRP_VBASE_free,
  5. SRP_VBASE_init,
  6. SRP_VBASE_add0_user,
  7. SRP_VBASE_get1_by_user,
  8. SRP_VBASE_get_by_user
  9. - Functions to create and manage a stack of SRP user verifier information
  10. =head1 SYNOPSIS
  11. #include <openssl/srp.h>
  12. The following functions have been deprecated since OpenSSL 3.0, and can be
  13. hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
  14. see L<openssl_user_macros(7)>:
  15. SRP_VBASE *SRP_VBASE_new(char *seed_key);
  16. void SRP_VBASE_free(SRP_VBASE *vb);
  17. int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
  18. int SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd);
  19. SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username);
  20. SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
  21. =head1 DESCRIPTION
  22. All of the functions described on this page are deprecated. There are no
  23. available replacement functions at this time.
  24. The SRP_VBASE_new() function allocates a structure to store server side SRP
  25. verifier information.
  26. If B<seed_key> is not NULL a copy is stored and used to generate dummy parameters
  27. for users that are not found by SRP_VBASE_get1_by_user(). This allows the server
  28. to hide the fact that it doesn't have a verifier for a particular username,
  29. as described in section 2.5.1.3 'Unknown SRP' of RFC 5054.
  30. The seed string should contain random NUL terminated binary data (therefore
  31. the random data should not contain NUL bytes!).
  32. The SRP_VBASE_free() function frees up the B<vb> structure.
  33. If B<vb> is NULL, nothing is done.
  34. The SRP_VBASE_init() function parses the information in a verifier file and
  35. populates the B<vb> structure.
  36. The verifier file is a text file containing multiple entries, whose format is:
  37. flag base64(verifier) base64(salt) username gNid userinfo(optional)
  38. where the flag can be 'V' (valid) or 'R' (revoked).
  39. Note that the base64 encoding used here is non-standard so it is recommended
  40. to use L<openssl-srp(1)> to generate this file.
  41. The SRP_VBASE_add0_user() function adds the B<user_pwd> verifier information
  42. to the B<vb> structure. See L<SRP_user_pwd_new(3)> to create and populate this
  43. record.
  44. The library takes ownership of B<user_pwd>, it should not be freed by the caller.
  45. The SRP_VBASE_get1_by_user() function returns the password info for the user
  46. whose username matches B<username>. It replaces the deprecated
  47. SRP_VBASE_get_by_user().
  48. If no matching user is found but a seed_key and default gN parameters have been
  49. set, dummy authentication information is generated from the seed_key, allowing
  50. the server to hide the fact that it doesn't have a verifier for a particular
  51. username. When using SRP as a TLS authentication mechanism, this will cause
  52. the handshake to proceed normally but the first client will be rejected with
  53. a "bad_record_mac" alert, as if the password was incorrect.
  54. If no matching user is found and the seed_key is not set, NULL is returned.
  55. Ownership of the returned pointer is released to the caller, it must be freed
  56. with SRP_user_pwd_free().
  57. =head1 RETURN VALUES
  58. SRP_VBASE_init() returns B<SRP_NO_ERROR> (0) on success and a positive value
  59. on failure.
  60. The error codes are B<SRP_ERR_OPEN_FILE> if the file could not be opened,
  61. B<SRP_ERR_VBASE_INCOMPLETE_FILE> if the file could not be parsed,
  62. B<SRP_ERR_MEMORY> on memory allocation failure and B<SRP_ERR_VBASE_BN_LIB>
  63. for invalid decoded parameter values.
  64. SRP_VBASE_add0_user() returns 1 on success and 0 on failure.
  65. =head1 SEE ALSO
  66. L<openssl-srp(1)>,
  67. L<SRP_create_verifier(3)>,
  68. L<SRP_user_pwd_new(3)>,
  69. L<SSL_CTX_set_srp_password(3)>
  70. =head1 HISTORY
  71. The SRP_VBASE_add0_user() function was added in OpenSSL 3.0.
  72. All other functions were added in OpenSSL 1.0.1.
  73. All of these functions were deprecated in OpenSSL 3.0.
  74. =head1 COPYRIGHT
  75. Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
  76. Licensed under the Apache License 2.0 (the "License"). You may not use
  77. this file except in compliance with the License. You can obtain a copy
  78. in the file LICENSE in the source distribution or at
  79. L<https://www.openssl.org/source/license.html>.
  80. =cut