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