Debian Codegraph @

upstream/debian-unstable/man3/DH_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 "DH_GENERATE_PARAMETERS 3SSL"
58 .TH DH_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 DH_generate_parameters_ex, DH_generate_parameters,
65 DH_check, DH_check_params,
66 DH_check_ex, DH_check_params_ex, DH_check_pub_key_ex
67 \&\- generate and check Diffie\-Hellman
68 parameters
69 .SH SYNOPSIS
70 .IX Header "SYNOPSIS"
71 .Vb 1
72 \& #include <openssl/dh.h>
73 .Ve
74 .PP
75 The following functions have been deprecated since OpenSSL 3.0, and can be
76 hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value,
77 see \fBopenssl_user_macros\fR\|(7):
78 .PP
79 .Vb 1
80 \& int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, BN_GENCB *cb);
81 \&
82 \& int DH_check(DH *dh, int *codes);
83 \& int DH_check_params(DH *dh, int *codes);
84 \&
85 \& int DH_check_ex(const DH *dh);
86 \& int DH_check_params_ex(const DH *dh);
87 \& int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key);
88 .Ve
89 .PP
90 The following functions have been deprecated since OpenSSL 0.9.8, and can be
91 hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value,
92 see \fBopenssl_user_macros\fR\|(7):
93 .PP
94 .Vb 2
95 \& DH *DH_generate_parameters(int prime_len, int generator,
96 \& void (*callback)(int, int, void *), void *cb_arg);
97 .Ve
98 .SH DESCRIPTION
99 .IX Header "DESCRIPTION"
100 All of the functions described on this page are deprecated.
101 Applications should instead use \fBEVP_PKEY_check\fR\|(3),
102 \&\fBEVP_PKEY_public_check\fR\|(3), \fBEVP_PKEY_private_check\fR\|(3) and
103 \&\fBEVP_PKEY_param_check\fR\|(3).
104 .PP
105 \&\fBDH_generate_parameters_ex()\fR generates Diffie-Hellman parameters that can
106 be shared among a group of users, and stores them in the provided \fBDH\fR
107 structure. The pseudo-random number generator must be
108 seeded before calling it.
109 The parameters generated by \fBDH_generate_parameters_ex()\fR should not be used in
110 signature schemes.
111 .PP
112 \&\fBprime_len\fR is the length in bits of the safe prime to be generated.
113 \&\fBgenerator\fR is a small number > 1, typically 2 or 5.
114 .PP
115 A callback function may be used to provide feedback about the progress
116 of the key generation. If \fBcb\fR is not \fBNULL\fR, it will be
117 called as described in \fBBN_generate_prime\fR\|(3) while a random prime
118 number is generated, and when a prime has been found, \fBBN_GENCB_call(cb, 3, 0)\fR
119 is called. See \fBBN_generate_prime_ex\fR\|(3) for information on
120 the \fBBN_GENCB_call()\fR function.
121 .PP
122 \&\fBDH_generate_parameters()\fR is similar to \fBDH_generate_prime_ex()\fR but
123 expects an old-style callback function; see
124 \&\fBBN_generate_prime\fR\|(3) for information on the old-style callback.
125 .PP
126 \&\fBDH_check_params()\fR confirms that the \fBp\fR and \fBg\fR are likely enough to
127 be valid.
128 This is a lightweight check, if a more thorough check is needed, use
129 \&\fBDH_check()\fR.
130 The value of \fB*codes\fR is updated with any problems found.
131 If \fB*codes\fR is zero then no problems were found, otherwise the
132 following bits may be set:
133 .IP DH_CHECK_P_NOT_PRIME 4
134 .IX Item "DH_CHECK_P_NOT_PRIME"
135 The parameter \fBp\fR has been determined to not being an odd prime.
136 Note that the lack of this bit doesn't guarantee that \fBp\fR is a
137 prime.
138 .IP DH_NOT_SUITABLE_GENERATOR 4
139 .IX Item "DH_NOT_SUITABLE_GENERATOR"
140 The generator \fBg\fR is not suitable.
141 Note that the lack of this bit doesn't guarantee that \fBg\fR is
142 suitable, unless \fBp\fR is known to be a strong prime.
143 .IP DH_MODULUS_TOO_SMALL 4
144 .IX Item "DH_MODULUS_TOO_SMALL"
145 The modulus is too small.
146 .IP DH_MODULUS_TOO_LARGE 4
147 .IX Item "DH_MODULUS_TOO_LARGE"
148 The modulus is too large.
149 .PP
150 \&\fBDH_check()\fR confirms that the Diffie-Hellman parameters \fBdh\fR are valid. The
151 value of \fB*codes\fR is updated with any problems found. If \fB*codes\fR is zero then
152 no problems were found, otherwise the following bits may be set:
153 .IP DH_CHECK_P_NOT_PRIME 4
154 .IX Item "DH_CHECK_P_NOT_PRIME"
155 The parameter \fBp\fR is not prime.
156 .IP DH_CHECK_P_NOT_SAFE_PRIME 4
157 .IX Item "DH_CHECK_P_NOT_SAFE_PRIME"
158 The parameter \fBp\fR is not a safe prime and no \fBq\fR value is present.
159 .IP DH_UNABLE_TO_CHECK_GENERATOR 4
160 .IX Item "DH_UNABLE_TO_CHECK_GENERATOR"
161 The generator \fBg\fR cannot be checked for suitability.
162 .IP DH_NOT_SUITABLE_GENERATOR 4
163 .IX Item "DH_NOT_SUITABLE_GENERATOR"
164 The generator \fBg\fR is not suitable.
165 .IP DH_CHECK_Q_NOT_PRIME 4
166 .IX Item "DH_CHECK_Q_NOT_PRIME"
167 The parameter \fBq\fR is not prime.
168 .IP DH_CHECK_INVALID_Q_VALUE 4
169 .IX Item "DH_CHECK_INVALID_Q_VALUE"
170 The parameter \fBq\fR is invalid.
171 .IP DH_CHECK_INVALID_J_VALUE 4
172 .IX Item "DH_CHECK_INVALID_J_VALUE"
173 The parameter \fBj\fR is invalid.
174 .PP
175 If 0 is returned or \fB*codes\fR is set to a nonzero value the supplied
176 parameters should not be used for Diffie-Hellman operations otherwise
177 the security properties of the key exchange are not guaranteed.
178 .PP
179 \&\fBDH_check_ex()\fR, \fBDH_check_params()\fR and \fBDH_check_pub_key_ex()\fR are similar to
180 \&\fBDH_check()\fR and \fBDH_check_params()\fR respectively, but the error reasons are added
181 to the thread's error queue instead of provided as return values from the
182 function.
183 .SH "RETURN VALUES"
184 .IX Header "RETURN VALUES"
185 \&\fBDH_generate_parameters_ex()\fR, \fBDH_check()\fR and \fBDH_check_params()\fR return 1
186 if the check could be performed, 0 otherwise.
187 .PP
188 \&\fBDH_generate_parameters()\fR returns a pointer to the DH structure or NULL if
189 the parameter generation fails.
190 .PP
191 \&\fBDH_check_ex()\fR, \fBDH_check_params()\fR and \fBDH_check_pub_key_ex()\fR return 1 if the
192 check is successful, 0 for failed.
193 .PP
194 The error codes can be obtained by \fBERR_get_error\fR\|(3).
195 .SH "SEE ALSO"
196 .IX Header "SEE ALSO"
197 \&\fBDH_new\fR\|(3), \fBERR_get_error\fR\|(3), \fBRAND_bytes\fR\|(3),
198 \&\fBDH_free\fR\|(3)
199 .SH HISTORY
200 .IX Header "HISTORY"
201 All of these functions were deprecated in OpenSSL 3.0.
202 .PP
203 \&\fBDH_generate_parameters()\fR was deprecated in OpenSSL 0.9.8; use
204 \&\fBDH_generate_parameters_ex()\fR instead.
205 .SH COPYRIGHT
206 .IX Header "COPYRIGHT"
207 Copyright 2000\-2020 The OpenSSL Project Authors. All Rights Reserved.
208 .PP
209 Licensed under the Apache License 2.0 (the "License"). You may not use
210 this file except in compliance with the License. You can obtain a copy
211 in the file LICENSE in the source distribution or at
212 <https://www.openssl.org/source/license.html>.