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 a DH structure containing named parameters nid. so far, nid has to be one of these:
    • NID_ffdhe2048
    • NID_ffdhe3072
    • NID_ffdhe4096
    • NID_ffdhe6144
    • NID_ffdhe8192
    • NID_modp_1536
    • NID_modp_2048
    • NID_modp_3072
    • NID_modp_4096
    • NID_modp_6144
    • NID_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 the NID that corresponds to the matching parameters; if not, it returns NID_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, or NULL if something went wrong. that NULL is the error signal, ok? don't ignore it. πŸ’€
  • DH_get_nid() β€” returns the NID of the matching set of parameters for p and g and optionally q, otherwise it returns NID_undef if there's no match.

πŸ’œ HISTORY πŸ’œ

not me having to say this, but β€” all of these functions were deprecated in OpenSSL 3.0. periodt.


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