DH_SET_METHOD(3ossl)
π NAME π
okay bestie, welcome to DH_SET_METHOD(3ossl) β the OpenSSL page about picking the DH method. The whole crew is DH_set_default_method, DH_get_default_method, DH_set_method, DH_new_method, and DH_OpenSSL, and their whole thing is select DH method. π
β¨
πΈ SYNOPSIS πΈ
First up, the include, exactly as it appears:
#include <openssl/dh.h>
The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):
void DH_set_default_method(const DH_METHOD *meth);
const DH_METHOD *DH_get_default_method(void);
int DH_set_method(DH *dh, const DH_METHOD *meth);
DH *DH_new_method(ENGINE *engine);
const DH_METHOD *DH_OpenSSL(void);
π¦ DESCRIPTION π¦
All of the functions described on this page are deprecated. Applications should instead use the provider APIs. periodt.
A DH_METHOD specifies the functions that OpenSSL uses for Diffie-Hellman operations. By modifying the method, alternative implementations such as hardware accelerators may be used. IMPORTANT: See the NOTES section for important information about how these DH API functions are affected by the use of ENGINE API calls. π
Initially, the default DH_METHOD is the OpenSSL internal implementation, as returned by DH_OpenSSL().
DH_set_default_method()β makesmeththe default method for all DH structures created later. NB: This is true only whilst no ENGINE has been set as a default for DH, so this function is no longer recommended. This function is not thread-safe and should not be called at the same time as other OpenSSL functions. π¨DH_get_default_method()β returns a pointer to the current defaultDH_METHOD. However, the meaningfulness of this result is dependent on whether the ENGINE API is being used, so this function is no longer recommended.DH_set_method()β selectsmethto perform all operations using the keydh. This will replace theDH_METHODused by the DH key and if the previous method was supplied by an ENGINE, the handle to that ENGINE will be released during the change. It is possible to have DH keys that only work with certainDH_METHODimplementations (e.g. from an ENGINE module that supports embedded hardware-protected keys), and in such cases attempting to change theDH_METHODfor the key can have unexpected results. πDH_new_method()β allocates and initializes a DH structure so thatenginewill be used for the DH operations. IfengineisNULL, the default ENGINE for DH operations is used, and if no default ENGINE is set, theDH_METHODcontrolled byDH_set_default_method()is used.
A new DH_METHOD object may be constructed using DH_meth_new() (see DH_meth_new(3)).
π RETURN VALUES π
DH_OpenSSL()andDH_get_default_method()return pointers to the respectiveDH_METHODs. π«ΆDH_set_default_method()returns no value.DH_set_method()returns nonzero if the providedmethwas successfully set as the method fordh(including unloading the ENGINE handle if the previous method was supplied by an ENGINE).DH_new_method()returnsNULLand sets an error code that can be obtained byERR_get_error(3)if the allocation fails. Otherwise it returns a pointer to the newly allocated structure. π
π¦ SEE ALSO π¦
DH_new(3)DH_new(3)β yes bestie, itβs literally listed twice in the original, no capDH_meth_new(3)
π HISTORY π
All of these functions were deprecated in OpenSSL 3.0. β
π COPYRIGHT π
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
This iconic page is from OpenSSL 3.5.6, dated 2026-04-07, and itβs literally DH_SET_METHOD(3ossl) β periodt. π
β¨π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms