DH_NEW_BY_NID(3SSL)
π DH_NEW_BY_NID π
okay bestie, so this is the OpenSSL man page for DH_new_by_nid and DH_get_nid, and it lives in section 3SSL of the manual. grab a strawberry drink π and let's get into it.
β¨ NAME β¨
DH_new_by_nid, DH_get_nid β the way to create or get DH named parameters π
πΈ SYNOPSIS πΈ
#include <openssl/dh.h>
so here's the tea, and I'm gonna need you to sit with it: the following functions have been deprecated since OpenSSL 3.0, and you can hide them entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):
DH *DH_new_by_nid(int nid);
int DH_get_nid(const DH *dh);
like, they still exist, but they're giving "please move on" energy. π
π¦ DESCRIPTION π¦
DH_new_by_nid()β creates and returns aDHstructure containing named parameters nid. so far, nid has to be one of these:NID_ffdhe2048NID_ffdhe3072NID_ffdhe4096NID_ffdhe6144NID_ffdhe8192NID_modp_1536NID_modp_2048NID_modp_3072NID_modp_4096NID_modp_6144NID_modp_8192
that's the list, no substitutions, no "close enough" picks. it's giving curated menu, fr fr.
DH_get_nid()β figures out whether the parameters chilling inside dh match any named safe prime group. if they do, it returns theNIDthat corresponds to the matching parameters; if not, it returnsNID_undef. no cap, it really is that simple. also, heads up: this function is deprecated. π«Ά
π RETURN VALUES π
DH_new_by_nid()β hands you a set of DH parameters, orNULLif something went wrong. thatNULLis the error signal, ok? don't ignore it. πDH_get_nid()β returns theNIDof the matching set of parameters for p and g and optionally q, otherwise it returnsNID_undefif there's no match.
π HISTORY π
not me having to say this, but β all of these functions were deprecated in OpenSSL 3.0. periodt.
π COPYRIGHT π
Copyright 2017-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>.
πΊ okay that's the whole page, you understood all of it, main character energy πΊ
this was pulled from version 4.0.3, dated 2026-09-29, and published as DH_NEW_BY_NID(3SSL) β love that for us, bye bestie β¨π¦
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms