Debian Codegraph @

upstream/debian-unstable/man3/DSA_generate_parameters.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "DSA_GENERATE_PARAMETERS 3SSL"
58 .TH DSA_GENERATE_PARAMETERS 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 DSA_generate_parameters_ex, DSA_generate_parameters \- generate DSA parameters
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 1
68 \& #include <openssl/dsa.h>
69 .Ve
70 .PP
71 The following functions have been deprecated since OpenSSL 3.0, and can be
72 hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value,
73 see \fBopenssl_user_macros\fR\|(7):
74 .PP
75 .Vb 4
76 \& int DSA_generate_parameters_ex(DSA *dsa, int bits,
77 \& const unsigned char *seed, int seed_len,
78 \& int *counter_ret, unsigned long *h_ret,
79 \& BN_GENCB *cb);
80 .Ve
81 .PP
82 The following functions have been deprecated since OpenSSL 0.9.8, and can be
83 hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value,
84 see \fBopenssl_user_macros\fR\|(7):
85 .PP
86 .Vb 3
87 \& DSA *DSA_generate_parameters(int bits, unsigned char *seed, int seed_len,
88 \& int *counter_ret, unsigned long *h_ret,
89 \& void (*callback)(int, int, void *), void *cb_arg);
90 .Ve
91 .SH DESCRIPTION
92 .IX Header "DESCRIPTION"
93 All of the functions described on this page are deprecated.
94 Applications should instead use \fBEVP_PKEY_paramgen_init\fR\|(3) and
95 \&\fBEVP_PKEY_keygen\fR\|(3) as described in \fBEVP_PKEY\-DSA\fR\|(7).
96 .PP
97 \&\fBDSA_generate_parameters_ex()\fR generates primes p and q and a generator g
98 for use in the DSA and stores the result in \fBdsa\fR.
99 .PP
100 \&\fBbits\fR is the length of the prime p to be generated.
101 For lengths under 2048 bits, the length of q is 160 bits; for lengths
102 greater than or equal to 2048 bits, the length of q is set to 256 bits.
103 .PP
104 If \fBseed\fR is NULL, the primes will be generated at random.
105 If \fBseed_len\fR is less than the length of q, an error is returned.
106 .PP
107 \&\fBDSA_generate_parameters_ex()\fR places the iteration count in
108 *\fBcounter_ret\fR and a counter used for finding a generator in
109 *\fBh_ret\fR, unless these are \fBNULL\fR.
110 .PP
111 A callback function may be used to provide feedback about the progress
112 of the key generation. If \fBcb\fR is not \fBNULL\fR, it will be
113 called as shown below. For information on the BN_GENCB structure and the
114 BN_GENCB_call function discussed below, refer to
115 \&\fBBN_generate_prime\fR\|(3).
116 .PP
117 \&\fBDSA_generate_parameters()\fR is similar to \fBDSA_generate_parameters_ex()\fR but
118 expects an old-style callback function; see
119 \&\fBBN_generate_prime\fR\|(3) for information on the old-style callback.
120 .IP \(bu 2
121 When a candidate for q is generated, \fBBN_GENCB_call(cb, 0, m++)\fR is called
122 (m is 0 for the first candidate).
123 .IP \(bu 2
124 When a candidate for q has passed a test by trial division,
125 \&\fBBN_GENCB_call(cb, 1, \-1)\fR is called.
126 While a candidate for q is tested by Miller-Rabin primality tests,
127 \&\fBBN_GENCB_call(cb, 1, i)\fR is called in the outer loop
128 (once for each witness that confirms that the candidate may be prime);
129 i is the loop counter (starting at 0).
130 .IP \(bu 2
131 When a prime q has been found, \fBBN_GENCB_call(cb, 2, 0)\fR and
132 \&\fBBN_GENCB_call(cb, 3, 0)\fR are called.
133 .IP \(bu 2
134 Before a candidate for p (other than the first) is generated and tested,
135 \&\fBBN_GENCB_call(cb, 0, counter)\fR is called.
136 .IP \(bu 2
137 When a candidate for p has passed the test by trial division,
138 \&\fBBN_GENCB_call(cb, 1, \-1)\fR is called.
139 While it is tested by the Miller-Rabin primality test,
140 \&\fBBN_GENCB_call(cb, 1, i)\fR is called in the outer loop
141 (once for each witness that confirms that the candidate may be prime).
142 i is the loop counter (starting at 0).
143 .IP \(bu 2
144 When p has been found, \fBBN_GENCB_call(cb, 2, 1)\fR is called.
145 .IP \(bu 2
146 When the generator has been found, \fBBN_GENCB_call(cb, 3, 1)\fR is called.
147 .SH "RETURN VALUES"
148 .IX Header "RETURN VALUES"
149 \&\fBDSA_generate_parameters_ex()\fR returns a 1 on success, or 0 otherwise.
150 The error codes can be obtained by \fBERR_get_error\fR\|(3).
151 .PP
152 \&\fBDSA_generate_parameters()\fR returns a pointer to the DSA structure or
153 \&\fBNULL\fR if the parameter generation fails.
154 .SH BUGS
155 .IX Header "BUGS"
156 Seed lengths greater than 20 are not supported.
157 .SH "SEE ALSO"
158 .IX Header "SEE ALSO"
159 \&\fBDSA_new\fR\|(3), \fBERR_get_error\fR\|(3), \fBRAND_bytes\fR\|(3),
160 \&\fBDSA_free\fR\|(3), \fBBN_generate_prime\fR\|(3)
161 .SH HISTORY
162 .IX Header "HISTORY"
163 \&\fBDSA_generate_parameters_ex()\fR was deprecated in OpenSSL 3.0.
164 .PP
165 \&\fBDSA_generate_parameters()\fR was deprecated in OpenSSL 0.9.8; use
166 \&\fBDSA_generate_parameters_ex()\fR instead.
167 .SH COPYRIGHT
168 .IX Header "COPYRIGHT"
169 Copyright 2000\-2021 The OpenSSL Project Authors. All Rights Reserved.
170 .PP
171 Licensed under the Apache License 2.0 (the "License"). You may not use
172 this file except in compliance with the License. You can obtain a copy
173 in the file LICENSE in the source distribution or at
174 <https://www.openssl.org/source/license.html>.