]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/SRP_create_verifier.pod
Added SRP_VBASE_add0_user()
[thirdparty/openssl.git] / doc / man3 / SRP_create_verifier.pod
CommitLineData
495a1e5c
AS
1=pod
2
3=head1 NAME
4
5SRP_create_verifier,
6SRP_create_verifier_BN,
7SRP_check_known_gN_param,
8SRP_get_default_gN
9- SRP authentication primitives
10
11=head1 SYNOPSIS
12
13 #include <openssl/srp.h>
14
15 char *SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
16 BIGNUM **verifier, const BIGNUM *N, const BIGNUM *g);
17 char *SRP_create_verifier(const char *user, const char *pass, char **salt,
18 char **verifier, const char *N, const char *g);
19
20 char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);
21 SRP_gN *SRP_get_default_gN(const char *id);
22
23=head1 DESCRIPTION
24
25The SRP_create_verifier_BN() function creates an SRP password verifier from
26the supplied parameters as defined in section 2.4 of RFC 5054.
27On successful exit B<*verifier> will point to a newly allocated BIGNUM containing
28the verifier and (if a salt was not provided) B<*salt> will be populated with a
29newly allocated BIGNUM containing a random salt. If B<*salt> is not NULL then
30the provided salt is used instead.
31The caller is responsible for freeing the allocated B<*salt> and B<*verifier>
32BIGNUMS (use L<BN_free(3)>).
33
34The SRP_create_verifier() function is similar to SRP_create_verifier_BN() but
35all numeric parameters are in a non-standard base64 encoding originally designed
36for compatibility with libsrp. This is mainly present for historical compatibility
37and its use is discouraged.
38It is possible to pass NULL as B<N> and an SRP group id as B<g> instead to
39load the appropriate gN values (see SRP_get_default_gN()).
40If both B<N> and B<g> are NULL the 8192-bit SRP group parameters are used.
41The caller is responsible for freeing the allocated *salt and *verifier char*
42(use L<OPENSSL_free(3)>).
43
44The SRP_check_known_gN_param() function checks that B<g> and B<N> are valid
45SRP group parameters from RFC 5054 appendix A.
46
47The SRP_get_default_gN() function returns the gN parameters for the RFC 5054 B<id>
48SRP group size.
49The known ids are "1024", "1536", "2048", "3072", "4096", "6144" and "8192".
50
51=head1 RETURN VALUES
52
53SRP_create_verifier_BN() returns 1 on success and 0 on failure.
54
55SRP_create_verifier() returns NULL on failure and a non-NULL value on success:
56"*" if B<N> is not NULL, the selected group id otherwise. This value should
57not be freed.
58
59SRP_check_known_gN_param() returns the text representation of the group id
60(ie. the prime bit size) or NULL if the arguments are not valid SRP group parameters.
61This value should not be freed.
62
63SRP_get_default_gN() returns NULL if B<id> is not a valid group size,
64or the 8192-bit group parameters if B<id> is NULL.
65
66=head1 EXAMPLES
67
68Generate and store a 8192 bit password verifier (error handling
69omitted for clarity):
70
71 #include <openssl/bn.h>
72 #include <openssl/srp.h>
73
74 const char *username = "username";
75 const char *password = "password";
76
77 SRP_VBASE *srpData = SRP_VBASE_new(NULL);
78
79 SRP_user_pwd *pwd = (SRP_user_pwd*) OPENSSL_malloc(sizeof(SRP_user_pwd));
80 SRP_gN *gN = SRP_get_default_gN("8192");
81
82 BIGNUM *salt = NULL, *verifier = NULL;
83 SRP_create_verifier_BN(username, password, &salt, &verifier, gN->N, gN->g);
84
85 // TODO: replace with SRP_user_pwd_new()
86 pwd->id = OPENSSL_strdup(username);
87 pwd->g = gN->g;
88 pwd->N = gN->N;
89 pwd->s = salt;
90 pwd->v = verifier;
91 pwd->info = NULL;
92
51f03f12 93 SRP_VBASE_add0_user(srpData, pwd);
495a1e5c
AS
94
95=head1 SEE ALSO
96
97L<srp(1)>,
98L<BN_new(3)>,
99L<OPENSSL_malloc(3)>,
100L<SRP_VBASE_new(3)>
101
102=head1 HISTORY
103
104These functions were first added to OpenSSL 1.0.1.
105
106=head1 COPYRIGHT
107
108Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
109
110Licensed under the OpenSSL license (the "License"). You may not use
111this file except in compliance with the License. You can obtain a copy
112in the file LICENSE in the source distribution or at
113L<https://www.openssl.org/source/license.html>.
114
115=cut