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