1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimDH_set_default_method, DH_get_default_method, 6e71b7053SJung-uk KimDH_set_method, DH_new_method, DH_OpenSSL - select DH method 7e71b7053SJung-uk Kim 8e71b7053SJung-uk Kim=head1 SYNOPSIS 9e71b7053SJung-uk Kim 10e71b7053SJung-uk Kim #include <openssl/dh.h> 11e71b7053SJung-uk Kim 12*b077aed3SPierre ProncheryThe following functions have been deprecated since OpenSSL 3.0, and can be 13*b077aed3SPierre Proncheryhidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value, 14*b077aed3SPierre Proncherysee L<openssl_user_macros(7)>: 15*b077aed3SPierre Pronchery 16e71b7053SJung-uk Kim void DH_set_default_method(const DH_METHOD *meth); 17e71b7053SJung-uk Kim 18e71b7053SJung-uk Kim const DH_METHOD *DH_get_default_method(void); 19e71b7053SJung-uk Kim 20e71b7053SJung-uk Kim int DH_set_method(DH *dh, const DH_METHOD *meth); 21e71b7053SJung-uk Kim 22e71b7053SJung-uk Kim DH *DH_new_method(ENGINE *engine); 23e71b7053SJung-uk Kim 24e71b7053SJung-uk Kim const DH_METHOD *DH_OpenSSL(void); 25e71b7053SJung-uk Kim 26e71b7053SJung-uk Kim=head1 DESCRIPTION 27e71b7053SJung-uk Kim 28*b077aed3SPierre ProncheryAll of the functions described on this page are deprecated. 29*b077aed3SPierre ProncheryApplications should instead use the provider APIs. 30*b077aed3SPierre Pronchery 31e71b7053SJung-uk KimA B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman 32e71b7053SJung-uk Kimoperations. By modifying the method, alternative implementations 33e71b7053SJung-uk Kimsuch as hardware accelerators may be used. IMPORTANT: See the NOTES section for 34e71b7053SJung-uk Kimimportant information about how these DH API functions are affected by the use 35e71b7053SJung-uk Kimof B<ENGINE> API calls. 36e71b7053SJung-uk Kim 37e71b7053SJung-uk KimInitially, the default DH_METHOD is the OpenSSL internal implementation, as 38e71b7053SJung-uk Kimreturned by DH_OpenSSL(). 39e71b7053SJung-uk Kim 40e71b7053SJung-uk KimDH_set_default_method() makes B<meth> the default method for all DH 41e71b7053SJung-uk Kimstructures created later. 42e71b7053SJung-uk KimB<NB>: This is true only whilst no ENGINE has been set 43e71b7053SJung-uk Kimas a default for DH, so this function is no longer recommended. 44e71b7053SJung-uk KimThis function is not thread-safe and should not be called at the same time 45e71b7053SJung-uk Kimas other OpenSSL functions. 46e71b7053SJung-uk Kim 47e71b7053SJung-uk KimDH_get_default_method() returns a pointer to the current default DH_METHOD. 48e71b7053SJung-uk KimHowever, the meaningfulness of this result is dependent on whether the ENGINE 49e71b7053SJung-uk KimAPI is being used, so this function is no longer recommended. 50e71b7053SJung-uk Kim 51e71b7053SJung-uk KimDH_set_method() selects B<meth> to perform all operations using the key B<dh>. 52e71b7053SJung-uk KimThis will replace the DH_METHOD used by the DH key and if the previous method 53e71b7053SJung-uk Kimwas supplied by an ENGINE, the handle to that ENGINE will be released during the 54e71b7053SJung-uk Kimchange. It is possible to have DH keys that only work with certain DH_METHOD 5558f35182SJung-uk Kimimplementations (e.g. from an ENGINE module that supports embedded 56e71b7053SJung-uk Kimhardware-protected keys), and in such cases attempting to change the DH_METHOD 57e71b7053SJung-uk Kimfor the key can have unexpected results. 58e71b7053SJung-uk Kim 59e71b7053SJung-uk KimDH_new_method() allocates and initializes a DH structure so that B<engine> will 60e71b7053SJung-uk Kimbe used for the DH operations. If B<engine> is NULL, the default ENGINE for DH 61e71b7053SJung-uk Kimoperations is used, and if no default ENGINE is set, the DH_METHOD controlled by 62e71b7053SJung-uk KimDH_set_default_method() is used. 63e71b7053SJung-uk Kim 64e71b7053SJung-uk KimA new DH_METHOD object may be constructed using DH_meth_new() (see 65e71b7053SJung-uk KimL<DH_meth_new(3)>). 66e71b7053SJung-uk Kim 67e71b7053SJung-uk Kim=head1 RETURN VALUES 68e71b7053SJung-uk Kim 69e71b7053SJung-uk KimDH_OpenSSL() and DH_get_default_method() return pointers to the respective 70e71b7053SJung-uk KimB<DH_METHOD>s. 71e71b7053SJung-uk Kim 72e71b7053SJung-uk KimDH_set_default_method() returns no value. 73e71b7053SJung-uk Kim 7458f35182SJung-uk KimDH_set_method() returns nonzero if the provided B<meth> was successfully set as 75e71b7053SJung-uk Kimthe method for B<dh> (including unloading the ENGINE handle if the previous 76e71b7053SJung-uk Kimmethod was supplied by an ENGINE). 77e71b7053SJung-uk Kim 78e71b7053SJung-uk KimDH_new_method() returns NULL and sets an error code that can be obtained by 79e71b7053SJung-uk KimL<ERR_get_error(3)> if the allocation fails. Otherwise it 80e71b7053SJung-uk Kimreturns a pointer to the newly allocated structure. 81e71b7053SJung-uk Kim 82e71b7053SJung-uk Kim=head1 SEE ALSO 83e71b7053SJung-uk Kim 84e71b7053SJung-uk KimL<DH_new(3)>, L<DH_new(3)>, L<DH_meth_new(3)> 85e71b7053SJung-uk Kim 86*b077aed3SPierre Pronchery=head1 HISTORY 87*b077aed3SPierre Pronchery 88*b077aed3SPierre ProncheryAll of these functions were deprecated in OpenSSL 3.0. 89*b077aed3SPierre Pronchery 90e71b7053SJung-uk Kim=head1 COPYRIGHT 91e71b7053SJung-uk Kim 92*b077aed3SPierre ProncheryCopyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. 93e71b7053SJung-uk Kim 94*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 95e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 96e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 97e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 98e71b7053SJung-uk Kim 99e71b7053SJung-uk Kim=cut 100