DH_NEW(3ossl)

✨ DH_NEW πŸ’–

okay bestie, welcome to the manual page for DH_new(3ossl) β€” yes that's the OpenSSL one, and yes we're doing this πŸ’…


🌸 NAME 🌸

DH_new, DH_free β€” the lil duo that allocates and frees DH objects πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <openssl/dh.h>

okay so first things first, heads up: 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 β€” peep openssl_user_macros(7) for the deets πŸ‘€

DH* DH_new(void);

void DH_free(DH *dh);

πŸ’œ DESCRIPTION πŸ’œ

  • DH_new() β€” allocates and initializes a DH structure. that's it, that's the whole vibe ✨
  • DH_free() β€” frees the DH structure and its components. and no cap, the values get erased before the memory is handed back to the system 🧹 (clean girl behaviour fr fr). oh and if dh is NULL, literally nothing happens β€” it just doesn't do the thing πŸ™ˆ

🫢 RETURN VALUES 🫢

if the allocation fails, DH_new() returns NULL and sets an error code that you can grab with ERR_get_error(3). otherwise it hands you back a pointer to the newly allocated structure, slay πŸ’…

DH_free() returns no value. it's giving silent but deadly (in a good way) πŸ’€


🌈 SEE ALSO 🌈


⭐ HISTORY ⭐

all of these functions were deprecated in OpenSSL 3.0 😭

for the replacement, go look at EVP_PKEY-DH(7) β€” that's your main character now πŸ‘‘


Copyright 2000-2016 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 bestie, mwah 😘 this was OpenSSL version 3.5.9, dated 2026-09-29, and the manual name is DH_NEW(3ossl) in case you forgot already πŸŽ€ bye bye, go read EVP_PKEY-DH(7) πŸ¦‹πŸ’–

πŸ“¦ where this page comes from