2018-10-26 06:43:35 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2020-03-26 01:43:50 +08:00
|
|
|
SRP_create_verifier_ex,
|
2018-10-26 06:43:35 +08:00
|
|
|
SRP_create_verifier,
|
2020-03-26 01:43:50 +08:00
|
|
|
SRP_create_verifier_BN_ex,
|
2018-10-26 06:43:35 +08:00
|
|
|
SRP_create_verifier_BN,
|
|
|
|
SRP_check_known_gN_param,
|
|
|
|
SRP_get_default_gN
|
|
|
|
- SRP authentication primitives
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/srp.h>
|
|
|
|
|
2021-12-02 19:33:49 +08:00
|
|
|
The following functions have been deprecated since OpenSSL 3.0, and can be
|
|
|
|
hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
|
|
|
|
see L<openssl_user_macros(7)>:
|
2021-02-08 23:52:07 +08:00
|
|
|
|
2020-03-26 01:43:50 +08:00
|
|
|
int SRP_create_verifier_BN_ex(const char *user, const char *pass, BIGNUM **salt,
|
|
|
|
BIGNUM **verifier, const BIGNUM *N,
|
2020-10-15 17:55:50 +08:00
|
|
|
const BIGNUM *g, OSSL_LIB_CTX *libctx,
|
2020-03-26 01:43:50 +08:00
|
|
|
const char *propq);
|
2018-10-26 06:43:35 +08:00
|
|
|
char *SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
|
|
|
|
BIGNUM **verifier, const BIGNUM *N, const BIGNUM *g);
|
2020-03-26 01:43:50 +08:00
|
|
|
char *SRP_create_verifier_ex(const char *user, const char *pass, char **salt,
|
|
|
|
char **verifier, const char *N, const char *g,
|
2020-10-15 17:55:50 +08:00
|
|
|
OSSL_LIB_CTX *libctx, const char *propq);
|
2018-10-26 06:43:35 +08:00
|
|
|
char *SRP_create_verifier(const char *user, const char *pass, char **salt,
|
|
|
|
char **verifier, const char *N, const char *g);
|
|
|
|
|
|
|
|
char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);
|
|
|
|
SRP_gN *SRP_get_default_gN(const char *id);
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2021-02-08 23:52:07 +08:00
|
|
|
All of the functions described on this page are deprecated. There are no
|
|
|
|
available replacement functions at this time.
|
|
|
|
|
2020-03-26 01:43:50 +08:00
|
|
|
The SRP_create_verifier_BN_ex() function creates an SRP password verifier from
|
|
|
|
the supplied parameters as defined in section 2.4 of RFC 5054 using the library
|
|
|
|
context I<libctx> and property query string I<propq>. Any cryptographic
|
|
|
|
algorithms that need to be fetched will use the I<libctx> and I<propq>. See
|
2021-03-26 01:02:25 +08:00
|
|
|
L<crypto(7)/ALGORITHM FETCHING>.
|
2020-03-26 01:43:50 +08:00
|
|
|
|
|
|
|
SRP_create_verifier_BN() is the same as SRP_create_verifier_BN_ex() except the
|
|
|
|
default library context and property query string is used.
|
|
|
|
|
|
|
|
On successful exit I<*verifier> will point to a newly allocated BIGNUM containing
|
|
|
|
the verifier and (if a salt was not provided) I<*salt> will be populated with a
|
|
|
|
newly allocated BIGNUM containing a random salt. If I<*salt> is not NULL then
|
2018-10-26 06:43:35 +08:00
|
|
|
the provided salt is used instead.
|
2020-03-26 01:43:50 +08:00
|
|
|
The caller is responsible for freeing the allocated I<*salt> and I<*verifier>
|
2018-10-26 06:43:35 +08:00
|
|
|
BIGNUMS (use L<BN_free(3)>).
|
|
|
|
|
|
|
|
The SRP_create_verifier() function is similar to SRP_create_verifier_BN() but
|
|
|
|
all numeric parameters are in a non-standard base64 encoding originally designed
|
|
|
|
for compatibility with libsrp. This is mainly present for historical compatibility
|
|
|
|
and its use is discouraged.
|
2020-03-26 01:43:50 +08:00
|
|
|
It is possible to pass NULL as I<N> and an SRP group id as I<g> instead to
|
2018-10-26 06:43:35 +08:00
|
|
|
load the appropriate gN values (see SRP_get_default_gN()).
|
2020-03-26 01:43:50 +08:00
|
|
|
If both I<N> and I<g> are NULL the 8192-bit SRP group parameters are used.
|
|
|
|
The caller is responsible for freeing the allocated I<*salt> and I<*verifier>
|
2018-10-26 06:43:35 +08:00
|
|
|
(use L<OPENSSL_free(3)>).
|
|
|
|
|
2020-03-26 01:43:50 +08:00
|
|
|
The SRP_check_known_gN_param() function checks that I<g> and I<N> are valid
|
2018-10-26 06:43:35 +08:00
|
|
|
SRP group parameters from RFC 5054 appendix A.
|
|
|
|
|
2020-03-26 01:43:50 +08:00
|
|
|
The SRP_get_default_gN() function returns the gN parameters for the RFC 5054 I<id>
|
2018-10-26 06:43:35 +08:00
|
|
|
SRP group size.
|
|
|
|
The known ids are "1024", "1536", "2048", "3072", "4096", "6144" and "8192".
|
|
|
|
|
|
|
|
=head1 RETURN VALUES
|
|
|
|
|
2020-03-26 01:43:50 +08:00
|
|
|
SRP_create_verifier_BN_ex() and SRP_create_verifier_BN() return 1 on success and
|
|
|
|
0 on failure.
|
2018-10-26 06:43:35 +08:00
|
|
|
|
2020-03-26 01:43:50 +08:00
|
|
|
SRP_create_verifier_ex() and SRP_create_verifier() return NULL on failure and a
|
|
|
|
non-NULL value on success:
|
|
|
|
"*" if I<N> is not NULL, the selected group id otherwise. This value should
|
2018-10-26 06:43:35 +08:00
|
|
|
not be freed.
|
|
|
|
|
|
|
|
SRP_check_known_gN_param() returns the text representation of the group id
|
2020-06-30 03:13:07 +08:00
|
|
|
(i.e. the prime bit size) or NULL if the arguments are not valid SRP group parameters.
|
2018-10-26 06:43:35 +08:00
|
|
|
This value should not be freed.
|
|
|
|
|
2020-03-26 01:43:50 +08:00
|
|
|
SRP_get_default_gN() returns NULL if I<id> is not a valid group size,
|
|
|
|
or the 8192-bit group parameters if I<id> is NULL.
|
2018-10-26 06:43:35 +08:00
|
|
|
|
|
|
|
=head1 EXAMPLES
|
|
|
|
|
|
|
|
Generate and store a 8192 bit password verifier (error handling
|
|
|
|
omitted for clarity):
|
|
|
|
|
|
|
|
#include <openssl/bn.h>
|
|
|
|
#include <openssl/srp.h>
|
|
|
|
|
|
|
|
const char *username = "username";
|
|
|
|
const char *password = "password";
|
|
|
|
|
|
|
|
SRP_VBASE *srpData = SRP_VBASE_new(NULL);
|
|
|
|
|
|
|
|
SRP_gN *gN = SRP_get_default_gN("8192");
|
|
|
|
|
|
|
|
BIGNUM *salt = NULL, *verifier = NULL;
|
2020-03-26 01:43:50 +08:00
|
|
|
SRP_create_verifier_BN_ex(username, password, &salt, &verifier, gN->N, gN->g,
|
|
|
|
NULL, NULL);
|
2018-10-26 06:43:35 +08:00
|
|
|
|
2018-11-02 06:41:16 +08:00
|
|
|
SRP_user_pwd *pwd = SRP_user_pwd_new();
|
|
|
|
SRP_user_pwd_set1_ids(pwd, username, NULL);
|
|
|
|
SRP_user_pwd_set0_sv(pwd, salt, verifier);
|
|
|
|
SRP_user_pwd_set_gN(pwd, gN->g, gN->N);
|
2018-10-26 06:43:35 +08:00
|
|
|
|
2018-11-02 02:56:55 +08:00
|
|
|
SRP_VBASE_add0_user(srpData, pwd);
|
2018-10-26 06:43:35 +08:00
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2019-11-02 04:26:05 +08:00
|
|
|
L<openssl-srp(1)>,
|
2018-11-02 06:41:16 +08:00
|
|
|
L<SRP_VBASE_new(3)>,
|
|
|
|
L<SRP_user_pwd_new(3)>
|
2018-10-26 06:43:35 +08:00
|
|
|
|
|
|
|
=head1 HISTORY
|
|
|
|
|
2021-02-08 23:52:07 +08:00
|
|
|
SRP_create_verifier_BN_ex() and SRP_create_verifier_ex() were introduced in
|
|
|
|
OpenSSL 3.0. All other functions were added in OpenSSL 1.0.1.
|
|
|
|
|
|
|
|
All of these functions were deprecated in OpenSSL 3.0.
|
2018-10-26 06:43:35 +08:00
|
|
|
|
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2021-02-18 22:57:13 +08:00
|
|
|
Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
|
2018-10-26 06:43:35 +08:00
|
|
|
|
2018-12-06 21:04:44 +08:00
|
|
|
Licensed under the Apache License 2.0 (the "License"). You may not use
|
2018-10-26 06:43:35 +08:00
|
|
|
this file except in compliance with the License. You can obtain a copy
|
|
|
|
in the file LICENSE in the source distribution or at
|
|
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
|
|
|
|
=cut
|