diff options
Diffstat (limited to 'src/lib/libcrypto/doc/DSA_generate_parameters.pod')
-rw-r--r-- | src/lib/libcrypto/doc/DSA_generate_parameters.pod | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/src/lib/libcrypto/doc/DSA_generate_parameters.pod b/src/lib/libcrypto/doc/DSA_generate_parameters.pod index b64f0ca546..698b555a0e 100644 --- a/src/lib/libcrypto/doc/DSA_generate_parameters.pod +++ b/src/lib/libcrypto/doc/DSA_generate_parameters.pod | |||
@@ -2,20 +2,26 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | DSA_generate_parameters - generate DSA parameters | 5 | DSA_generate_parameters_ex, DSA_generate_parameters - generate DSA parameters |
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | #include <openssl/dsa.h> | 9 | #include <openssl/dsa.h> |
10 | 10 | ||
11 | int DSA_generate_parameters_ex(DSA *dsa, int bits, | ||
12 | const unsigned char *seed,int seed_len, | ||
13 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); | ||
14 | |||
15 | Deprecated: | ||
16 | |||
11 | DSA *DSA_generate_parameters(int bits, unsigned char *seed, | 17 | DSA *DSA_generate_parameters(int bits, unsigned char *seed, |
12 | int seed_len, int *counter_ret, unsigned long *h_ret, | 18 | int seed_len, int *counter_ret, unsigned long *h_ret, |
13 | void (*callback)(int, int, void *), void *cb_arg); | 19 | void (*callback)(int, int, void *), void *cb_arg); |
14 | 20 | ||
15 | =head1 DESCRIPTION | 21 | =head1 DESCRIPTION |
16 | 22 | ||
17 | DSA_generate_parameters() generates primes p and q and a generator g | 23 | DSA_generate_parameters_ex() generates primes p and q and a generator g |
18 | for use in the DSA. | 24 | for use in the DSA and stores the result in B<dsa>. |
19 | 25 | ||
20 | B<bits> is the length of the prime to be generated; the DSS allows a | 26 | B<bits> is the length of the prime to be generated; the DSS allows a |
21 | maximum of 1024 bits. | 27 | maximum of 1024 bits. |
@@ -25,64 +31,74 @@ generated at random. Otherwise, the seed is used to generate | |||
25 | them. If the given seed does not yield a prime q, a new random | 31 | them. If the given seed does not yield a prime q, a new random |
26 | seed is chosen and placed at B<seed>. | 32 | seed is chosen and placed at B<seed>. |
27 | 33 | ||
28 | DSA_generate_parameters() places the iteration count in | 34 | DSA_generate_parameters_ex() places the iteration count in |
29 | *B<counter_ret> and a counter used for finding a generator in | 35 | *B<counter_ret> and a counter used for finding a generator in |
30 | *B<h_ret>, unless these are B<NULL>. | 36 | *B<h_ret>, unless these are B<NULL>. |
31 | 37 | ||
32 | A callback function may be used to provide feedback about the progress | 38 | A callback function may be used to provide feedback about the progress |
33 | of the key generation. If B<callback> is not B<NULL>, it will be | 39 | of the key generation. If B<cb> is not B<NULL>, it will be |
34 | called as follows: | 40 | called as shown below. For information on the BN_GENCB structure and the |
41 | BN_GENCB_call function discussed below, refer to | ||
42 | L<BN_generate_prime(3)|BN_generate_prime(3)>. | ||
35 | 43 | ||
36 | =over 4 | 44 | =over 4 |
37 | 45 | ||
38 | =item * | 46 | =item * |
39 | 47 | ||
40 | When a candidate for q is generated, B<callback(0, m++, cb_arg)> is called | 48 | When a candidate for q is generated, B<BN_GENCB_call(cb, 0, m++)> is called |
41 | (m is 0 for the first candidate). | 49 | (m is 0 for the first candidate). |
42 | 50 | ||
43 | =item * | 51 | =item * |
44 | 52 | ||
45 | When a candidate for q has passed a test by trial division, | 53 | When a candidate for q has passed a test by trial division, |
46 | B<callback(1, -1, cb_arg)> is called. | 54 | B<BN_GENCB_call(cb, 1, -1)> is called. |
47 | While a candidate for q is tested by Miller-Rabin primality tests, | 55 | While a candidate for q is tested by Miller-Rabin primality tests, |
48 | B<callback(1, i, cb_arg)> is called in the outer loop | 56 | B<BN_GENCB_call(cb, 1, i)> is called in the outer loop |
49 | (once for each witness that confirms that the candidate may be prime); | 57 | (once for each witness that confirms that the candidate may be prime); |
50 | i is the loop counter (starting at 0). | 58 | i is the loop counter (starting at 0). |
51 | 59 | ||
52 | =item * | 60 | =item * |
53 | 61 | ||
54 | When a prime q has been found, B<callback(2, 0, cb_arg)> and | 62 | When a prime q has been found, B<BN_GENCB_call(cb, 2, 0)> and |
55 | B<callback(3, 0, cb_arg)> are called. | 63 | B<BN_GENCB_call(cb, 3, 0)> are called. |
56 | 64 | ||
57 | =item * | 65 | =item * |
58 | 66 | ||
59 | Before a candidate for p (other than the first) is generated and tested, | 67 | Before a candidate for p (other than the first) is generated and tested, |
60 | B<callback(0, counter, cb_arg)> is called. | 68 | B<BN_GENCB_call(cb, 0, counter)> is called. |
61 | 69 | ||
62 | =item * | 70 | =item * |
63 | 71 | ||
64 | When a candidate for p has passed the test by trial division, | 72 | When a candidate for p has passed the test by trial division, |
65 | B<callback(1, -1, cb_arg)> is called. | 73 | B<BN_GENCB_call(cb, 1, -1)> is called. |
66 | While it is tested by the Miller-Rabin primality test, | 74 | While it is tested by the Miller-Rabin primality test, |
67 | B<callback(1, i, cb_arg)> is called in the outer loop | 75 | B<BN_GENCB_call(cb, 1, i)> is called in the outer loop |
68 | (once for each witness that confirms that the candidate may be prime). | 76 | (once for each witness that confirms that the candidate may be prime). |
69 | i is the loop counter (starting at 0). | 77 | i is the loop counter (starting at 0). |
70 | 78 | ||
71 | =item * | 79 | =item * |
72 | 80 | ||
73 | When p has been found, B<callback(2, 1, cb_arg)> is called. | 81 | When p has been found, B<BN_GENCB_call(cb, 2, 1)> is called. |
74 | 82 | ||
75 | =item * | 83 | =item * |
76 | 84 | ||
77 | When the generator has been found, B<callback(3, 1, cb_arg)> is called. | 85 | When the generator has been found, B<BN_GENCB_call(cb, 3, 1)> is called. |
78 | 86 | ||
79 | =back | 87 | =back |
80 | 88 | ||
89 | DSA_generate_parameters() (deprecated) works in much the same way as for DSA_generate_parameters_ex, except that no B<dsa> parameter is passed and | ||
90 | instead a newly allocated B<DSA> structure is returned. Additionally "old | ||
91 | style" callbacks are used instead of the newer BN_GENCB based approach. | ||
92 | Refer to L<BN_generate_prime(3)|BN_generate_prime(3)> for further information. | ||
93 | |||
81 | =head1 RETURN VALUE | 94 | =head1 RETURN VALUE |
82 | 95 | ||
96 | DSA_generate_parameters_ex() returns a 1 on success, or 0 otherwise. | ||
97 | |||
83 | DSA_generate_parameters() returns a pointer to the DSA structure, or | 98 | DSA_generate_parameters() returns a pointer to the DSA structure, or |
84 | B<NULL> if the parameter generation fails. The error codes can be | 99 | B<NULL> if the parameter generation fails. |
85 | obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | 100 | |
101 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
86 | 102 | ||
87 | =head1 BUGS | 103 | =head1 BUGS |
88 | 104 | ||
@@ -91,7 +107,7 @@ Seed lengths E<gt> 20 are not supported. | |||
91 | =head1 SEE ALSO | 107 | =head1 SEE ALSO |
92 | 108 | ||
93 | L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, | 109 | L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, |
94 | L<DSA_free(3)|DSA_free(3)> | 110 | L<DSA_free(3)|DSA_free(3)>, L<BN_generate_prime(3)|BN_generate_prime(3)> |
95 | 111 | ||
96 | =head1 HISTORY | 112 | =head1 HISTORY |
97 | 113 | ||