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