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