1DH_SET_METHOD(3ossl) OpenSSL DH_SET_METHOD(3ossl)
2
3
4
6 DH_set_default_method, DH_get_default_method, DH_set_method,
7 DH_new_method, DH_OpenSSL - select DH method
8
10 #include <openssl/dh.h>
11
12 The following functions have been deprecated since OpenSSL 3.0, and can
13 be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
14 version value, see openssl_user_macros(7):
15
16 void DH_set_default_method(const DH_METHOD *meth);
17
18 const DH_METHOD *DH_get_default_method(void);
19
20 int DH_set_method(DH *dh, const DH_METHOD *meth);
21
22 DH *DH_new_method(ENGINE *engine);
23
24 const DH_METHOD *DH_OpenSSL(void);
25
27 All of the functions described on this page are deprecated.
28 Applications should instead use the provider APIs.
29
30 A DH_METHOD specifies the functions that OpenSSL uses for Diffie-
31 Hellman operations. By modifying the method, alternative
32 implementations such as hardware accelerators may be used. IMPORTANT:
33 See the NOTES section for important information about how these DH API
34 functions are affected by the use of ENGINE API calls.
35
36 Initially, the default DH_METHOD is the OpenSSL internal
37 implementation, as returned by DH_OpenSSL().
38
39 DH_set_default_method() makes meth the default method for all DH
40 structures created later. NB: This is true only whilst no ENGINE has
41 been set as a default for DH, so this function is no longer
42 recommended. This function is not thread-safe and should not be called
43 at the same time as other OpenSSL functions.
44
45 DH_get_default_method() returns a pointer to the current default
46 DH_METHOD. However, the meaningfulness of this result is dependent on
47 whether the ENGINE API is being used, so this function is no longer
48 recommended.
49
50 DH_set_method() selects meth to perform all operations using the key
51 dh. This will replace the DH_METHOD used by the DH key and if the
52 previous method was supplied by an ENGINE, the handle to that ENGINE
53 will be released during the change. It is possible to have DH keys that
54 only work with certain DH_METHOD implementations (e.g. from an ENGINE
55 module that supports embedded hardware-protected keys), and in such
56 cases attempting to change the DH_METHOD for the key can have
57 unexpected results.
58
59 DH_new_method() allocates and initializes a DH structure so that engine
60 will be used for the DH operations. If engine is NULL, the default
61 ENGINE for DH operations is used, and if no default ENGINE is set, the
62 DH_METHOD controlled by DH_set_default_method() is used.
63
64 A new DH_METHOD object may be constructed using DH_meth_new() (see
65 DH_meth_new(3)).
66
68 DH_OpenSSL() and DH_get_default_method() return pointers to the
69 respective DH_METHODs.
70
71 DH_set_default_method() returns no value.
72
73 DH_set_method() returns nonzero if the provided meth was successfully
74 set as the method for dh (including unloading the ENGINE handle if the
75 previous method was supplied by an ENGINE).
76
77 DH_new_method() returns NULL and sets an error code that can be
78 obtained by ERR_get_error(3) if the allocation fails. Otherwise it
79 returns a pointer to the newly allocated structure.
80
82 DH_new(3), DH_new(3), DH_meth_new(3)
83
85 All of these functions were deprecated in OpenSSL 3.0.
86
88 Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
89
90 Licensed under the Apache License 2.0 (the "License"). You may not use
91 this file except in compliance with the License. You can obtain a copy
92 in the file LICENSE in the source distribution or at
93 <https://www.openssl.org/source/license.html>.
94
95
96
973.1.1 2023-08-31 DH_SET_METHOD(3ossl)