1DH_GET0_PQG(3ossl)                  OpenSSL                 DH_GET0_PQG(3ossl)
2
3
4

NAME

6       DH_get0_pqg, DH_set0_pqg, DH_get0_key, DH_set0_key, DH_get0_p,
7       DH_get0_q, DH_get0_g, DH_get0_priv_key, DH_get0_pub_key,
8       DH_clear_flags, DH_test_flags, DH_set_flags, DH_get0_engine,
9       DH_get_length, DH_set_length - Routines for getting and setting data in
10       a DH object
11

SYNOPSIS

13        #include <openssl/dh.h>
14
15       The following functions have been deprecated since OpenSSL 3.0, and can
16       be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
17       version value, see openssl_user_macros(7):
18
19        void DH_get0_pqg(const DH *dh,
20                         const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
21        int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
22        void DH_get0_key(const DH *dh,
23                         const BIGNUM **pub_key, const BIGNUM **priv_key);
24        int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
25        const BIGNUM *DH_get0_p(const DH *dh);
26        const BIGNUM *DH_get0_q(const DH *dh);
27        const BIGNUM *DH_get0_g(const DH *dh);
28        const BIGNUM *DH_get0_priv_key(const DH *dh);
29        const BIGNUM *DH_get0_pub_key(const DH *dh);
30        void DH_clear_flags(DH *dh, int flags);
31        int DH_test_flags(const DH *dh, int flags);
32        void DH_set_flags(DH *dh, int flags);
33
34        long DH_get_length(const DH *dh);
35        int DH_set_length(DH *dh, long length);
36
37        ENGINE *DH_get0_engine(DH *d);
38

DESCRIPTION

40       All of the functions described on this page are deprecated.
41       Applications should instead use EVP_PKEY_get_bn_param(3) for any
42       methods that return a BIGNUM. Refer to EVP_PKEY-DH(7) for more
43       infomation.
44
45       A DH object contains the parameters p, q and g. Note that the q
46       parameter is optional. It also contains a public key (pub_key) and
47       (optionally) a private key (priv_key).
48
49       The p, q and g parameters can be obtained by calling DH_get0_pqg().  If
50       the parameters have not yet been set then *p, *q and *g will be set to
51       NULL. Otherwise they are set to pointers to their respective values.
52       These point directly to the internal representations of the values and
53       therefore should not be freed directly.  Any of the out parameters p,
54       q, and g can be NULL, in which case no value will be returned for that
55       parameter.
56
57       The p, q and g values can be set by calling DH_set0_pqg() and passing
58       the new values for p, q and g as parameters to the function. Calling
59       this function transfers the memory management of the values to the DH
60       object, and therefore the values that have been passed in should not be
61       freed directly after this function has been called. The q parameter may
62       be NULL.  DH_set0_pqg() also checks if the parameters associated with p
63       and g and optionally q are associated with known safe prime groups. If
64       it is a safe prime group then the value of q will be set to q = (p - 1)
65       / 2 if q is NULL. The optional length parameter will be set to
66       BN_num_bits(q) if q is not NULL.
67
68       To get the public and private key values use the DH_get0_key()
69       function. A pointer to the public key will be stored in *pub_key, and a
70       pointer to the private key will be stored in *priv_key. Either may be
71       NULL if they have not been set yet, although if the private key has
72       been set then the public key must be. The values point to the internal
73       representation of the public key and private key values. This memory
74       should not be freed directly.  Any of the out parameters pub_key and
75       priv_key can be NULL, in which case no value will be returned for that
76       parameter.
77
78       The public and private key values can be set using DH_set0_key().
79       Either parameter may be NULL, which means the corresponding DH field is
80       left untouched. As with DH_set0_pqg() this function transfers the
81       memory management of the key values to the DH object, and therefore
82       they should not be freed directly after this function has been called.
83
84       Any of the values p, q, g, priv_key, and pub_key can also be retrieved
85       separately by the corresponding function DH_get0_p(), DH_get0_q(),
86       DH_get0_g(), DH_get0_priv_key(), and DH_get0_pub_key(), respectively.
87
88       DH_set_flags() sets the flags in the flags parameter on the DH object.
89       Multiple flags can be passed in one go (bitwise ORed together). Any
90       flags that are already set are left set. DH_test_flags() tests to see
91       whether the flags passed in the flags parameter are currently set in
92       the DH object. Multiple flags can be tested in one go. All flags that
93       are currently set are returned, or zero if none of the flags are set.
94       DH_clear_flags() clears the specified flags within the DH object.
95
96       DH_get0_engine() returns a handle to the ENGINE that has been set for
97       this DH object, or NULL if no such ENGINE has been set. This function
98       is deprecated. All engines should be replaced by providers.
99
100       The DH_get_length() and DH_set_length() functions get and set the
101       optional length parameter associated with this DH object. If the length
102       is nonzero then it is used, otherwise it is ignored. The length
103       parameter indicates the length of the secret exponent (private key) in
104       bits. For safe prime groups the optional length parameter length can be
105       set to a value greater or equal to 2 *
106       maximum_target_security_strength(BN_num_bits(p)) as listed in
107       SP800-56Ar3 Table(s) 25 & 26.  These functions are deprecated and
108       should be replaced with EVP_PKEY_CTX_set_params() and
109       EVP_PKEY_get_int_param() using the parameter key
110       OSSL_PKEY_PARAM_DH_PRIV_LEN as described in EVP_PKEY-DH(7).
111

NOTES

113       Values retrieved with DH_get0_key() are owned by the DH object used in
114       the call and may therefore not be passed to DH_set0_key().  If needed,
115       duplicate the received value using BN_dup() and pass the duplicate.
116       The same applies to DH_get0_pqg() and DH_set0_pqg().
117

RETURN VALUES

119       DH_set0_pqg() and DH_set0_key() return 1 on success or 0 on failure.
120
121       DH_get0_p(), DH_get0_q(), DH_get0_g(), DH_get0_priv_key(), and
122       DH_get0_pub_key() return the respective value, or NULL if it is unset.
123
124       DH_test_flags() returns the current state of the flags in the DH
125       object.
126
127       DH_get0_engine() returns the ENGINE set for the DH object or NULL if no
128       ENGINE has been set.
129
130       DH_get_length() returns the length of the secret exponent (private key)
131       in bits, or zero if no such length has been explicitly set.
132

SEE ALSO

134       DH_new(3), DH_new(3), DH_generate_parameters(3), DH_generate_key(3),
135       DH_set_method(3), DH_size(3), DH_meth_new(3)
136

HISTORY

138       The functions described here were added in OpenSSL 1.1.0.
139
140       All of these functions were deprecated in OpenSSL 3.0.
141
143       Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
144
145       Licensed under the Apache License 2.0 (the "License").  You may not use
146       this file except in compliance with the License.  You can obtain a copy
147       in the file LICENSE in the source distribution or at
148       <https://www.openssl.org/source/license.html>.
149
150
151
1523.0.9                             2023-07-27                DH_GET0_PQG(3ossl)
Impressum