]>
Commit | Line | Data |
---|---|---|
4486d0cd UM |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
5bf73873 | 5 | DH_set_default_method, DH_get_default_method, |
5270e702 | 6 | DH_set_method, DH_new_method, DH_OpenSSL - select DH method |
4486d0cd UM |
7 | |
8 | =head1 SYNOPSIS | |
9 | ||
10 | #include <openssl/dh.h> | |
11 | ||
5bf73873 | 12 | void DH_set_default_method(const DH_METHOD *meth); |
4486d0cd | 13 | |
5bf73873 | 14 | const DH_METHOD *DH_get_default_method(void); |
4486d0cd | 15 | |
5bf73873 | 16 | int DH_set_method(DH *dh, const DH_METHOD *meth); |
4486d0cd | 17 | |
6aba658c | 18 | DH *DH_new_method(ENGINE *engine); |
4486d0cd | 19 | |
5bf73873 | 20 | const DH_METHOD *DH_OpenSSL(void); |
4486d0cd UM |
21 | |
22 | =head1 DESCRIPTION | |
23 | ||
24 | A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman | |
25 | operations. By modifying the method, alternative implementations | |
5bf73873 GT |
26 | such as hardware accelerators may be used. IMPORTANT: See the NOTES section for |
27 | important information about how these DH API functions are affected by the use | |
28 | of B<ENGINE> API calls. | |
29 | ||
30 | Initially, the default DH_METHOD is the OpenSSL internal implementation, as | |
31 | returned by DH_OpenSSL(). | |
32 | ||
33 | DH_set_default_method() makes B<meth> the default method for all DH | |
076fc555 RS |
34 | structures created later. |
35 | B<NB>: This is true only whilst no ENGINE has been set | |
5bf73873 | 36 | as a default for DH, so this function is no longer recommended. |
076fc555 RS |
37 | This function is not thread-safe and should not be called at the same time |
38 | as other OpenSSL functions. | |
5bf73873 GT |
39 | |
40 | DH_get_default_method() returns a pointer to the current default DH_METHOD. | |
b6a338cb | 41 | However, the meaningfulness of this result is dependent on whether the ENGINE |
5bf73873 GT |
42 | API is being used, so this function is no longer recommended. |
43 | ||
44 | DH_set_method() selects B<meth> to perform all operations using the key B<dh>. | |
45 | This will replace the DH_METHOD used by the DH key and if the previous method | |
46 | was supplied by an ENGINE, the handle to that ENGINE will be released during the | |
47 | change. It is possible to have DH keys that only work with certain DH_METHOD | |
48 | implementations (eg. from an ENGINE module that supports embedded | |
49 | hardware-protected keys), and in such cases attempting to change the DH_METHOD | |
50 | for the key can have unexpected results. | |
51 | ||
52 | DH_new_method() allocates and initializes a DH structure so that B<engine> will | |
53 | be used for the DH operations. If B<engine> is NULL, the default ENGINE for DH | |
54 | operations is used, and if no default ENGINE is set, the DH_METHOD controlled by | |
55 | DH_set_default_method() is used. | |
4486d0cd | 56 | |
0263b992 MC |
57 | A new DH_METHOD object may be constructed using DH_meth_new() (see |
58 | L<DH_meth_new(3)>). | |
4486d0cd UM |
59 | |
60 | =head1 RETURN VALUES | |
61 | ||
5bf73873 GT |
62 | DH_OpenSSL() and DH_get_default_method() return pointers to the respective |
63 | B<DH_METHOD>s. | |
64 | ||
65 | DH_set_default_method() returns no value. | |
66 | ||
67 | DH_set_method() returns non-zero if the provided B<meth> was successfully set as | |
68 | the method for B<dh> (including unloading the ENGINE handle if the previous | |
69 | method was supplied by an ENGINE). | |
4486d0cd | 70 | |
5bf73873 | 71 | DH_new_method() returns NULL and sets an error code that can be obtained by |
9b86974e | 72 | L<ERR_get_error(3)> if the allocation fails. Otherwise it |
5bf73873 | 73 | returns a pointer to the newly allocated structure. |
4486d0cd | 74 | |
4486d0cd UM |
75 | =head1 SEE ALSO |
76 | ||
b97fdb57 | 77 | L<DH_new(3)>, L<DH_new(3)>, L<DH_meth_new(3)> |
4486d0cd | 78 | |
e2f92610 RS |
79 | =head1 COPYRIGHT |
80 | ||
81 | Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. | |
82 | ||
83 | Licensed under the OpenSSL license (the "License"). You may not use | |
84 | this file except in compliance with the License. You can obtain a copy | |
85 | in the file LICENSE in the source distribution or at | |
86 | L<https://www.openssl.org/source/license.html>. | |
87 | ||
88 | =cut |