diff options
author | Antoine Salon <asalon@vmware.com> | 2018-11-01 11:56:55 -0700 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-11-15 10:53:47 +0000 |
commit | 51f03f12270cdebf1dff140cc17925991520fb77 (patch) | |
tree | 867c8b4f77a31296d37ff10521f015ebcad9d63a | |
parent | 495a1e5c3aec4d44558cd86161b8385f1b1b6822 (diff) |
Added SRP_VBASE_add0_user()
Signed-off-by: Antoine Salon <asalon@vmware.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7522)
-rw-r--r-- | crypto/srp/srp_vfy.c | 7 | ||||
-rw-r--r-- | doc/man3/SRP_VBASE_new.pod | 12 | ||||
-rw-r--r-- | doc/man3/SRP_create_verifier.pod | 2 | ||||
-rw-r--r-- | include/openssl/srp.h | 1 | ||||
-rw-r--r-- | util/libcrypto.num | 1 |
5 files changed, 21 insertions, 2 deletions
diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c index 622fffbcd0..397d26c9d7 100644 --- a/crypto/srp/srp_vfy.c +++ b/crypto/srp/srp_vfy.c @@ -514,6 +514,13 @@ static SRP_user_pwd *find_user(SRP_VBASE *vb, char *username) return NULL; } +int SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd) +{ + if (sk_SRP_user_pwd_push(vb->users_pwd, user_pwd) <= 0) + return 0; + return 1; +} + # if OPENSSL_API_COMPAT < 0x10100000L /* * DEPRECATED: use SRP_VBASE_get1_by_user instead. diff --git a/doc/man3/SRP_VBASE_new.pod b/doc/man3/SRP_VBASE_new.pod index b235e58710..76044ac451 100644 --- a/doc/man3/SRP_VBASE_new.pod +++ b/doc/man3/SRP_VBASE_new.pod @@ -6,6 +6,7 @@ SRP_VBASE_new, SRP_VBASE_free, SRP_user_pwd_free, SRP_VBASE_init, +SRP_VBASE_add0_user, SRP_VBASE_get1_by_user, SRP_VBASE_get_by_user - Functions to create and manage a stack of SRP user verifier information @@ -20,6 +21,7 @@ SRP_VBASE_get_by_user int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); + int SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd); SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username); @@ -47,6 +49,10 @@ where the flag can be 'V' (valid) or 'R' (revoked). Note that the base64 encoding used here is non-standard so it is recommended to use L<srp(1)> to generate this file. +The SRP_VBASE_add0_user() function adds the B<user_pwd> verifier information +to the B<vb> structure. +The library takes ownership of B<user_pwd>, it should not be freed by the caller. + The SRP_VBASE_get1_by_user() function returns the password info for the user whose username matches B<username>. It replaces the deprecated SRP_VBASE_get_by_user(). @@ -69,6 +75,8 @@ B<SRP_ERR_VBASE_INCOMPLETE_FILE> if the file could not be parsed, B<SRP_ERR_MEMORY> on memory allocation failure and B<SRP_ERR_VBASE_BN_LIB> for invalid decoded parameter values. +SRP_VBASE_add0_user() returns 1 on success and 0 on failure. + =head1 SEE ALSO L<srp(1)>, @@ -77,7 +85,9 @@ L<SSL_CTX_set_srp_password(3)> =head1 HISTORY -These functions were first added to OpenSSL 1.0.1. +SRP_VBASE_add0_user() was first added to OpenSSL 1.2.0. + +All other functions were first added to OpenSSL 1.0.1. =head1 COPYRIGHT diff --git a/doc/man3/SRP_create_verifier.pod b/doc/man3/SRP_create_verifier.pod index 9741c5c47c..f899b2471a 100644 --- a/doc/man3/SRP_create_verifier.pod +++ b/doc/man3/SRP_create_verifier.pod @@ -90,7 +90,7 @@ omitted for clarity): pwd->v = verifier; pwd->info = NULL; - sk_SRP_user_pwd_push(srpData->users_pwd, pwd); + SRP_VBASE_add0_user(srpData, pwd); =head1 SEE ALSO diff --git a/include/openssl/srp.h b/include/openssl/srp.h index aaf13558e3..8189d3e403 100644 --- a/include/openssl/srp.h +++ b/include/openssl/srp.h @@ -75,6 +75,7 @@ SRP_VBASE *SRP_VBASE_new(char *seed_key); void SRP_VBASE_free(SRP_VBASE *vb); int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); +int SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd); /* This method ignores the configured seed and fails for an unknown user. */ DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)) /* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ diff --git a/util/libcrypto.num b/util/libcrypto.num index c6de172f8e..c1c90110a8 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -4598,3 +4598,4 @@ EVP_MAC_do_all_sorted 4551 1_1_2 EXIST::FUNCTION: EVP_str2ctrl 4552 1_1_2 EXIST::FUNCTION: EVP_hex2ctrl 4553 1_1_2 EXIST::FUNCTION: EVP_PKEY_supports_digest_nid 4554 1_1_2 EXIST::FUNCTION: +SRP_VBASE_add0_user 4555 1_1_2 EXIST::FUNCTION:SRP |