SRP_create_verifier.pod 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. =pod
  2. =head1 NAME
  3. SRP_create_verifier_ex,
  4. SRP_create_verifier,
  5. SRP_create_verifier_BN_ex,
  6. SRP_create_verifier_BN,
  7. SRP_check_known_gN_param,
  8. SRP_get_default_gN
  9. - SRP authentication primitives
  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. int SRP_create_verifier_BN_ex(const char *user, const char *pass, BIGNUM **salt,
  16. BIGNUM **verifier, const BIGNUM *N,
  17. const BIGNUM *g, OSSL_LIB_CTX *libctx,
  18. const char *propq);
  19. char *SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
  20. BIGNUM **verifier, const BIGNUM *N, const BIGNUM *g);
  21. char *SRP_create_verifier_ex(const char *user, const char *pass, char **salt,
  22. char **verifier, const char *N, const char *g,
  23. OSSL_LIB_CTX *libctx, const char *propq);
  24. char *SRP_create_verifier(const char *user, const char *pass, char **salt,
  25. char **verifier, const char *N, const char *g);
  26. char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);
  27. SRP_gN *SRP_get_default_gN(const char *id);
  28. =head1 DESCRIPTION
  29. All of the functions described on this page are deprecated. There are no
  30. available replacement functions at this time.
  31. The SRP_create_verifier_BN_ex() function creates an SRP password verifier from
  32. the supplied parameters as defined in section 2.4 of RFC 5054 using the library
  33. context I<libctx> and property query string I<propq>. Any cryptographic
  34. algorithms that need to be fetched will use the I<libctx> and I<propq>. See
  35. L<crypto(7)/ALGORITHM FETCHING>.
  36. SRP_create_verifier_BN() is the same as SRP_create_verifier_BN_ex() except the
  37. default library context and property query string is used.
  38. On successful exit I<*verifier> will point to a newly allocated BIGNUM containing
  39. the verifier and (if a salt was not provided) I<*salt> will be populated with a
  40. newly allocated BIGNUM containing a random salt. If I<*salt> is not NULL then
  41. the provided salt is used instead.
  42. The caller is responsible for freeing the allocated I<*salt> and I<*verifier>
  43. BIGNUMS (use L<BN_free(3)>).
  44. The SRP_create_verifier() function is similar to SRP_create_verifier_BN() but
  45. all numeric parameters are in a non-standard base64 encoding originally designed
  46. for compatibility with libsrp. This is mainly present for historical compatibility
  47. and its use is discouraged.
  48. It is possible to pass NULL as I<N> and an SRP group id as I<g> instead to
  49. load the appropriate gN values (see SRP_get_default_gN()).
  50. If both I<N> and I<g> are NULL the 8192-bit SRP group parameters are used.
  51. The caller is responsible for freeing the allocated I<*salt> and I<*verifier>
  52. (use L<OPENSSL_free(3)>).
  53. The SRP_check_known_gN_param() function checks that I<g> and I<N> are valid
  54. SRP group parameters from RFC 5054 appendix A.
  55. The SRP_get_default_gN() function returns the gN parameters for the RFC 5054 I<id>
  56. SRP group size.
  57. The known ids are "1024", "1536", "2048", "3072", "4096", "6144" and "8192".
  58. =head1 RETURN VALUES
  59. SRP_create_verifier_BN_ex() and SRP_create_verifier_BN() return 1 on success and
  60. 0 on failure.
  61. SRP_create_verifier_ex() and SRP_create_verifier() return NULL on failure and a
  62. non-NULL value on success:
  63. "*" if I<N> is not NULL, the selected group id otherwise. This value should
  64. not be freed.
  65. SRP_check_known_gN_param() returns the text representation of the group id
  66. (i.e. the prime bit size) or NULL if the arguments are not valid SRP group parameters.
  67. This value should not be freed.
  68. SRP_get_default_gN() returns NULL if I<id> is not a valid group size,
  69. or the 8192-bit group parameters if I<id> is NULL.
  70. =head1 EXAMPLES
  71. Generate and store a 8192 bit password verifier (error handling
  72. omitted for clarity):
  73. #include <openssl/bn.h>
  74. #include <openssl/srp.h>
  75. const char *username = "username";
  76. const char *password = "password";
  77. SRP_VBASE *srpData = SRP_VBASE_new(NULL);
  78. SRP_gN *gN = SRP_get_default_gN("8192");
  79. BIGNUM *salt = NULL, *verifier = NULL;
  80. SRP_create_verifier_BN_ex(username, password, &salt, &verifier, gN->N, gN->g,
  81. NULL, NULL);
  82. SRP_user_pwd *pwd = SRP_user_pwd_new();
  83. SRP_user_pwd_set1_ids(pwd, username, NULL);
  84. SRP_user_pwd_set0_sv(pwd, salt, verifier);
  85. SRP_user_pwd_set_gN(pwd, gN->g, gN->N);
  86. SRP_VBASE_add0_user(srpData, pwd);
  87. =head1 SEE ALSO
  88. L<openssl-srp(1)>,
  89. L<SRP_VBASE_new(3)>,
  90. L<SRP_user_pwd_new(3)>
  91. =head1 HISTORY
  92. SRP_create_verifier_BN_ex() and SRP_create_verifier_ex() were introduced in
  93. OpenSSL 3.0. All other functions were added in OpenSSL 1.0.1.
  94. All of these functions were deprecated in OpenSSL 3.0.
  95. =head1 COPYRIGHT
  96. Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
  97. Licensed under the Apache License 2.0 (the "License"). You may not use
  98. this file except in compliance with the License. You can obtain a copy
  99. in the file LICENSE in the source distribution or at
  100. L<https://www.openssl.org/source/license.html>.
  101. =cut