summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/doc/DSA_generate_parameters.pod
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/doc/DSA_generate_parameters.pod')
-rw-r--r--src/lib/libcrypto/doc/DSA_generate_parameters.pod54
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
5DSA_generate_parameters - generate DSA parameters 5DSA_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
15Deprecated:
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
17DSA_generate_parameters() generates primes p and q and a generator g 23DSA_generate_parameters_ex() generates primes p and q and a generator g
18for use in the DSA. 24for use in the DSA and stores the result in B<dsa>.
19 25
20B<bits> is the length of the prime to be generated; the DSS allows a 26B<bits> is the length of the prime to be generated; the DSS allows a
21maximum of 1024 bits. 27maximum of 1024 bits.
@@ -25,64 +31,74 @@ generated at random. Otherwise, the seed is used to generate
25them. If the given seed does not yield a prime q, a new random 31them. If the given seed does not yield a prime q, a new random
26seed is chosen and placed at B<seed>. 32seed is chosen and placed at B<seed>.
27 33
28DSA_generate_parameters() places the iteration count in 34DSA_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
32A callback function may be used to provide feedback about the progress 38A callback function may be used to provide feedback about the progress
33of the key generation. If B<callback> is not B<NULL>, it will be 39of the key generation. If B<cb> is not B<NULL>, it will be
34called as follows: 40called as shown below. For information on the BN_GENCB structure and the
41BN_GENCB_call function discussed below, refer to
42L<BN_generate_prime(3)|BN_generate_prime(3)>.
35 43
36=over 4 44=over 4
37 45
38=item * 46=item *
39 47
40When a candidate for q is generated, B<callback(0, m++, cb_arg)> is called 48When 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
45When a candidate for q has passed a test by trial division, 53When a candidate for q has passed a test by trial division,
46B<callback(1, -1, cb_arg)> is called. 54B<BN_GENCB_call(cb, 1, -1)> is called.
47While a candidate for q is tested by Miller-Rabin primality tests, 55While a candidate for q is tested by Miller-Rabin primality tests,
48B<callback(1, i, cb_arg)> is called in the outer loop 56B<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);
50i is the loop counter (starting at 0). 58i is the loop counter (starting at 0).
51 59
52=item * 60=item *
53 61
54When a prime q has been found, B<callback(2, 0, cb_arg)> and 62When a prime q has been found, B<BN_GENCB_call(cb, 2, 0)> and
55B<callback(3, 0, cb_arg)> are called. 63B<BN_GENCB_call(cb, 3, 0)> are called.
56 64
57=item * 65=item *
58 66
59Before a candidate for p (other than the first) is generated and tested, 67Before a candidate for p (other than the first) is generated and tested,
60B<callback(0, counter, cb_arg)> is called. 68B<BN_GENCB_call(cb, 0, counter)> is called.
61 69
62=item * 70=item *
63 71
64When a candidate for p has passed the test by trial division, 72When a candidate for p has passed the test by trial division,
65B<callback(1, -1, cb_arg)> is called. 73B<BN_GENCB_call(cb, 1, -1)> is called.
66While it is tested by the Miller-Rabin primality test, 74While it is tested by the Miller-Rabin primality test,
67B<callback(1, i, cb_arg)> is called in the outer loop 75B<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).
69i is the loop counter (starting at 0). 77i is the loop counter (starting at 0).
70 78
71=item * 79=item *
72 80
73When p has been found, B<callback(2, 1, cb_arg)> is called. 81When p has been found, B<BN_GENCB_call(cb, 2, 1)> is called.
74 82
75=item * 83=item *
76 84
77When the generator has been found, B<callback(3, 1, cb_arg)> is called. 85When the generator has been found, B<BN_GENCB_call(cb, 3, 1)> is called.
78 86
79=back 87=back
80 88
89DSA_generate_parameters() (deprecated) works in much the same way as for DSA_generate_parameters_ex, except that no B<dsa> parameter is passed and
90instead a newly allocated B<DSA> structure is returned. Additionally "old
91style" callbacks are used instead of the newer BN_GENCB based approach.
92Refer to L<BN_generate_prime(3)|BN_generate_prime(3)> for further information.
93
81=head1 RETURN VALUE 94=head1 RETURN VALUE
82 95
96DSA_generate_parameters_ex() returns a 1 on success, or 0 otherwise.
97
83DSA_generate_parameters() returns a pointer to the DSA structure, or 98DSA_generate_parameters() returns a pointer to the DSA structure, or
84B<NULL> if the parameter generation fails. The error codes can be 99B<NULL> if the parameter generation fails.
85obtained by L<ERR_get_error(3)|ERR_get_error(3)>. 100
101The 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
93L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, 109L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>,
94L<DSA_free(3)|DSA_free(3)> 110L<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