Debian Codegraph @

upstream/debian-unstable/man3/DH_get0_pqg.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_GET0_PQG 3SSL"
58 .TH DH_GET0_PQG 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_get0_pqg, DH_set0_pqg, DH_get0_key, DH_set0_key,
65 DH_get0_p, DH_get0_q, DH_get0_g,
66 DH_get0_priv_key, DH_get0_pub_key,
67 DH_clear_flags, DH_test_flags, DH_set_flags, DH_get0_engine,
68 DH_get_length, DH_set_length \- Routines for getting and setting data in a DH object
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 10
80 \& void DH_get0_pqg(const DH *dh,
81 \& const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
82 \& int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
83 \& void DH_get0_key(const DH *dh,
84 \& const BIGNUM **pub_key, const BIGNUM **priv_key);
85 \& int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
86 \& const BIGNUM *DH_get0_p(const DH *dh);
87 \& const BIGNUM *DH_get0_q(const DH *dh);
88 \& const BIGNUM *DH_get0_g(const DH *dh);
89 \& const BIGNUM *DH_get0_priv_key(const DH *dh);
90 \& const BIGNUM *DH_get0_pub_key(const DH *dh);
91 \& void DH_clear_flags(DH *dh, int flags);
92 \& int DH_test_flags(const DH *dh, int flags);
93 \& void DH_set_flags(DH *dh, int flags);
94 \&
95 \& long DH_get_length(const DH *dh);
96 \& int DH_set_length(DH *dh, long length);
97 \&
98 \& ENGINE *DH_get0_engine(DH *d);
99 .Ve
100 .SH DESCRIPTION
101 .IX Header "DESCRIPTION"
102 All of the functions described on this page are deprecated.
103 Applications should instead use \fBEVP_PKEY_get_bn_param\fR\|(3) for any methods that
104 return a \fBBIGNUM\fR. Refer to \fBEVP_PKEY\-DH\fR\|(7) for more information.
105 .PP
106 A DH object contains the parameters \fIp\fR, \fIq\fR and \fIg\fR. Note that the \fIq\fR
107 parameter is optional. It also contains a public key (\fIpub_key\fR) and
108 (optionally) a private key (\fIpriv_key\fR).
109 .PP
110 The \fIp\fR, \fIq\fR and \fIg\fR parameters can be obtained by calling \fBDH_get0_pqg()\fR.
111 If the parameters have not yet been set then \fI*p\fR, \fI*q\fR and \fI*g\fR will be set
112 to NULL. Otherwise they are set to pointers to their respective values. These
113 point directly to the internal representations of the values and therefore
114 should not be freed directly.
115 Any of the out parameters \fIp\fR, \fIq\fR, and \fIg\fR can be NULL, in which case no
116 value will be returned for that parameter.
117 .PP
118 The \fIp\fR, \fIq\fR and \fIg\fR values can be set by calling \fBDH_set0_pqg()\fR and passing
119 the new values for \fIp\fR, \fIq\fR and \fIg\fR as parameters to the function. Calling
120 this function transfers the memory management of the values to the DH object,
121 and therefore the values that have been passed in should not be freed directly
122 after this function has been called. The \fIq\fR parameter may be NULL.
123 \&\fBDH_set0_pqg()\fR also checks if the parameters associated with \fIp\fR and \fIg\fR and
124 optionally \fIq\fR are associated with known safe prime groups. If it is a safe
125 prime group then the value of \fIq\fR will be set to q = (p \- 1) / 2 if \fIq\fR is
126 NULL. The optional length parameter will be set to BN_num_bits(\fIq\fR) if \fIq\fR
127 is not NULL.
128 .PP
129 To get the public and private key values use the \fBDH_get0_key()\fR function. A
130 pointer to the public key will be stored in \fI*pub_key\fR, and a pointer to the
131 private key will be stored in \fI*priv_key\fR. Either may be NULL if they have not
132 been set yet, although if the private key has been set then the public key must
133 be. The values point to the internal representation of the public key and
134 private key values. This memory should not be freed directly.
135 Any of the out parameters \fIpub_key\fR and \fIpriv_key\fR can be NULL, in which case
136 no value will be returned for that parameter.
137 .PP
138 The public and private key values can be set using \fBDH_set0_key()\fR. Either
139 parameter may be NULL, which means the corresponding DH field is left
140 untouched. As with \fBDH_set0_pqg()\fR this function transfers the memory management
141 of the key values to the DH object, and therefore they should not be freed
142 directly after this function has been called.
143 .PP
144 Any of the values \fIp\fR, \fIq\fR, \fIg\fR, \fIpriv_key\fR, and \fIpub_key\fR can also be
145 retrieved separately by the corresponding function \fBDH_get0_p()\fR, \fBDH_get0_q()\fR,
146 \&\fBDH_get0_g()\fR, \fBDH_get0_priv_key()\fR, and \fBDH_get0_pub_key()\fR, respectively.
147 .PP
148 \&\fBDH_set_flags()\fR sets the flags in the \fIflags\fR parameter on the DH object.
149 Multiple flags can be passed in one go (bitwise ORed together). Any flags that
150 are already set are left set. \fBDH_test_flags()\fR tests to see whether the flags
151 passed in the \fIflags\fR parameter are currently set in the DH object. Multiple
152 flags can be tested in one go. All flags that are currently set are returned, or
153 zero if none of the flags are set. \fBDH_clear_flags()\fR clears the specified flags
154 within the DH object.
155 .PP
156 \&\fBDH_get0_engine()\fR returns a handle to the ENGINE that has been set for this DH
157 object, or NULL if no such ENGINE has been set. This function is deprecated. All
158 engines should be replaced by providers.
159 .PP
160 The \fBDH_get_length()\fR and \fBDH_set_length()\fR functions get and set the optional
161 length parameter associated with this DH object. If the length is nonzero then
162 it is used, otherwise it is ignored. The \fIlength\fR parameter indicates the
163 length of the secret exponent (private key) in bits. For safe prime groups the optional length parameter \fIlength\fR can be
164 set to a value greater or equal to 2 * maximum_target_security_strength(BN_num_bits(\fIp\fR))
165 as listed in SP800\-56Ar3 Table(s) 25 & 26.
166 These functions are deprecated and should be replaced with
167 \&\fBEVP_PKEY_CTX_set_params()\fR and \fBEVP_PKEY_get_int_param()\fR using the parameter key
168 \&\fBOSSL_PKEY_PARAM_DH_PRIV_LEN\fR as described in \fBEVP_PKEY\-DH\fR\|(7).
169 .SH NOTES
170 .IX Header "NOTES"
171 Values retrieved with \fBDH_get0_key()\fR are owned by the DH object used
172 in the call and may therefore \fInot\fR be passed to \fBDH_set0_key()\fR. If
173 needed, duplicate the received value using \fBBN_dup()\fR and pass the
174 duplicate. The same applies to \fBDH_get0_pqg()\fR and \fBDH_set0_pqg()\fR.
175 .SH "RETURN VALUES"
176 .IX Header "RETURN VALUES"
177 \&\fBDH_set0_pqg()\fR and \fBDH_set0_key()\fR return 1 on success or 0 on failure.
178 .PP
179 \&\fBDH_get0_p()\fR, \fBDH_get0_q()\fR, \fBDH_get0_g()\fR, \fBDH_get0_priv_key()\fR, and \fBDH_get0_pub_key()\fR
180 return the respective value, or NULL if it is unset.
181 .PP
182 \&\fBDH_test_flags()\fR returns the current state of the flags in the DH object.
183 .PP
184 \&\fBDH_get0_engine()\fR returns the ENGINE set for the DH object or NULL if no ENGINE
185 has been set.
186 .PP
187 \&\fBDH_get_length()\fR returns the length of the secret exponent (private key) in bits,
188 or zero if no such length has been explicitly set.
189 .SH "SEE ALSO"
190 .IX Header "SEE ALSO"
191 \&\fBDH_new\fR\|(3), \fBDH_new\fR\|(3), \fBDH_generate_parameters\fR\|(3), \fBDH_generate_key\fR\|(3),
192 \&\fBDH_set_method\fR\|(3), \fBDH_size\fR\|(3), \fBDH_meth_new\fR\|(3)
193 .SH HISTORY
194 .IX Header "HISTORY"
195 The functions described here were added in OpenSSL 1.1.0.
196 .PP
197 All of these functions were deprecated in OpenSSL 3.0.
198 .SH COPYRIGHT
199 .IX Header "COPYRIGHT"
200 Copyright 2016\-2022 The OpenSSL Project Authors. All Rights Reserved.
201 .PP
202 Licensed under the Apache License 2.0 (the "License"). You may not use
203 this file except in compliance with the License. You can obtain a copy
204 in the file LICENSE in the source distribution or at
205 <https://www.openssl.org/source/license.html>.