summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/DSA_generate_parameters_ex.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/DSA_generate_parameters_ex.3')
-rw-r--r--src/lib/libcrypto/man/DSA_generate_parameters_ex.3174
1 files changed, 174 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/DSA_generate_parameters_ex.3 b/src/lib/libcrypto/man/DSA_generate_parameters_ex.3
new file mode 100644
index 0000000000..a318bf8298
--- /dev/null
+++ b/src/lib/libcrypto/man/DSA_generate_parameters_ex.3
@@ -0,0 +1,174 @@
1.\" $OpenBSD: DSA_generate_parameters_ex.3,v 1.1 2023/12/29 19:15:15 tb Exp $
2.\" OpenSSL 9b86974e Aug 7 22:14:47 2015 -0400
3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>,
5.\" Bodo Moeller <bodo@openssl.org>, and Matt Caswell <matt@openssl.org>.
6.\" Copyright (c) 2000, 2013 The OpenSSL Project. All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\"
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\"
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\" notice, this list of conditions and the following disclaimer in
17.\" the documentation and/or other materials provided with the
18.\" distribution.
19.\"
20.\" 3. All advertising materials mentioning features or use of this
21.\" software must display the following acknowledgment:
22.\" "This product includes software developed by the OpenSSL Project
23.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24.\"
25.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26.\" endorse or promote products derived from this software without
27.\" prior written permission. For written permission, please contact
28.\" openssl-core@openssl.org.
29.\"
30.\" 5. Products derived from this software may not be called "OpenSSL"
31.\" nor may "OpenSSL" appear in their names without prior written
32.\" permission of the OpenSSL Project.
33.\"
34.\" 6. Redistributions of any form whatsoever must retain the following
35.\" acknowledgment:
36.\" "This product includes software developed by the OpenSSL Project
37.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38.\"
39.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\"
52.Dd $Mdocdate: December 29 2023 $
53.Dt DSA_GENERATE_PARAMETERS_EX 3
54.Os
55.Sh NAME
56.\" .Nm DSA_generate_parameters is intentionally undocumented
57.\" because it will be removed in the next major bump
58.Nm DSA_generate_parameters_ex
59.Nd generate DSA parameters
60.Sh SYNOPSIS
61.In openssl/dsa.h
62.Ft int
63.Fo DSA_generate_parameters_ex
64.Fa "DSA *dsa"
65.Fa "int bits"
66.Fa "const unsigned char *seed"
67.Fa "int seed_len"
68.Fa "int *counter_ret"
69.Fa "unsigned long *h_ret"
70.Fa "BN_GENCB *cb"
71.Fc
72.Sh DESCRIPTION
73.Fn DSA_generate_parameters_ex
74generates primes p and q and a generator g for use in the DSA and stores
75the result in
76.Fa dsa .
77.Pp
78.Fa bits
79is the length of the prime to be generated; the DSS allows a maximum of
801024 bits.
81.Pp
82If
83.Fa seed
84is
85.Dv NULL
86or
87.Fa seed_len
88< 20, the primes will be generated at random.
89Otherwise, the seed is used to generate them.
90If the given seed does not yield a prime q, a new random seed is chosen
91and placed at
92.Fa seed .
93.Pp
94.Fn DSA_generate_parameters_ex
95places the iteration count in
96.Pf * Fa counter_ret
97and a counter used for finding a generator in
98.Pf * Fa h_ret ,
99unless these are
100.Dv NULL .
101.Pp
102A callback function may be used to provide feedback about the progress
103of the key generation.
104If
105.Fa cb
106is not
107.Dv NULL ,
108it will be called as shown below.
109For information on the
110.Vt BN_GENCB
111structure, refer to
112.Xr BN_GENCB_call 3 .
113.Bl -bullet
114.It
115When a candidate for q is generated,
116.Fn BN_GENCB_call cb 0 m++
117is called
118.Pf ( Fa m
119is 0 for the first candidate).
120.It
121When a candidate for q has passed a test by trial division,
122.Fn BN_GENCB_call cb 1 -1
123is called.
124While a candidate for q is tested by Miller-Rabin primality tests,
125.Fn BN_GENCB_call cb 1 i
126is called in the outer loop (once for each witness that confirms that
127the candidate may be prime);
128.Fa i
129is the loop counter (starting at 0).
130.It
131When a prime q has been found,
132.Fn BN_GENCB_call cb 2 0
133and
134.Fn BN_GENCB_call cb 3 0
135are called.
136.It
137Before a candidate for p (other than the first) is generated and tested,
138.Fn BN_GENCB_call cb 0 counter
139is called.
140.It
141When a candidate for p has passed the test by trial division,
142.Fn BN_GENCB_call cb 1 -1
143is called.
144While it is tested by the Miller-Rabin primality test,
145.Fn BN_GENCB_call cb 1 i
146is called in the outer loop (once for each witness that confirms that
147the candidate may be prime).
148.Fa i
149is the loop counter (starting at 0).
150.It
151When p has been found,
152.Fn BN_GENCB_call cb 2 1
153is called.
154.It
155When the generator has been found,
156.Fn BN_GENCB_call cb 3 1
157is called.
158.El
159.Sh RETURN VALUES
160.Fn DSA_generate_parameters_ex
161returns a 1 on success, or 0 otherwise.
162.Pp
163The error codes can be obtained by
164.Xr ERR_get_error 3 .
165.Sh SEE ALSO
166.Xr BN_generate_prime 3 ,
167.Xr DSA_get0_pqg 3 ,
168.Xr DSA_new 3
169.Sh HISTORY
170.Fn DSA_generate_parameters_ex
171first appeared in OpenSSL 0.9.8 and has been available since
172.Ox 4.5 .
173.Sh BUGS
174Seed lengths > 20 are not supported.