]>
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> | |
6aba658c | 11 | #include <openssl/engine.h> |
4486d0cd | 12 | |
5bf73873 | 13 | void DH_set_default_method(const DH_METHOD *meth); |
4486d0cd | 14 | |
5bf73873 | 15 | const DH_METHOD *DH_get_default_method(void); |
4486d0cd | 16 | |
5bf73873 | 17 | int DH_set_method(DH *dh, const DH_METHOD *meth); |
4486d0cd | 18 | |
6aba658c | 19 | DH *DH_new_method(ENGINE *engine); |
4486d0cd | 20 | |
5bf73873 | 21 | const DH_METHOD *DH_OpenSSL(void); |
4486d0cd UM |
22 | |
23 | =head1 DESCRIPTION | |
24 | ||
25 | A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman | |
26 | operations. By modifying the method, alternative implementations | |
5bf73873 GT |
27 | such as hardware accelerators may be used. IMPORTANT: See the NOTES section for |
28 | important information about how these DH API functions are affected by the use | |
29 | of B<ENGINE> API calls. | |
30 | ||
31 | Initially, the default DH_METHOD is the OpenSSL internal implementation, as | |
32 | returned by DH_OpenSSL(). | |
33 | ||
34 | DH_set_default_method() makes B<meth> the default method for all DH | |
35 | structures created later. B<NB>: This is true only whilst no ENGINE has been set | |
36 | as a default for DH, so this function is no longer recommended. | |
37 | ||
38 | DH_get_default_method() returns a pointer to the current default DH_METHOD. | |
b6a338cb | 39 | However, the meaningfulness of this result is dependent on whether the ENGINE |
5bf73873 GT |
40 | API is being used, so this function is no longer recommended. |
41 | ||
42 | DH_set_method() selects B<meth> to perform all operations using the key B<dh>. | |
43 | This will replace the DH_METHOD used by the DH key and if the previous method | |
44 | was supplied by an ENGINE, the handle to that ENGINE will be released during the | |
45 | change. It is possible to have DH keys that only work with certain DH_METHOD | |
46 | implementations (eg. from an ENGINE module that supports embedded | |
47 | hardware-protected keys), and in such cases attempting to change the DH_METHOD | |
48 | for the key can have unexpected results. | |
49 | ||
50 | DH_new_method() allocates and initializes a DH structure so that B<engine> will | |
51 | be used for the DH operations. If B<engine> is NULL, the default ENGINE for DH | |
52 | operations is used, and if no default ENGINE is set, the DH_METHOD controlled by | |
53 | DH_set_default_method() is used. | |
4486d0cd | 54 | |
0263b992 MC |
55 | A new DH_METHOD object may be constructed using DH_meth_new() (see |
56 | L<DH_meth_new(3)>). | |
4486d0cd UM |
57 | |
58 | =head1 RETURN VALUES | |
59 | ||
5bf73873 GT |
60 | DH_OpenSSL() and DH_get_default_method() return pointers to the respective |
61 | B<DH_METHOD>s. | |
62 | ||
63 | DH_set_default_method() returns no value. | |
64 | ||
65 | DH_set_method() returns non-zero if the provided B<meth> was successfully set as | |
66 | the method for B<dh> (including unloading the ENGINE handle if the previous | |
67 | method was supplied by an ENGINE). | |
4486d0cd | 68 | |
5bf73873 | 69 | DH_new_method() returns NULL and sets an error code that can be obtained by |
9b86974e | 70 | L<ERR_get_error(3)> if the allocation fails. Otherwise it |
5bf73873 | 71 | returns a pointer to the newly allocated structure. |
4486d0cd | 72 | |
4486d0cd UM |
73 | =head1 SEE ALSO |
74 | ||
0263b992 | 75 | L<dh(3)>, L<DH_new(3)>, L<DH_meth_new(3)> |
4486d0cd | 76 | |
4486d0cd | 77 | =cut |