DH_SIZE(3ossl)
π DH_SIZE(3ossl) β like, the OpenSSL manual, but make it make sense π«Ά
okay so bestie, welcome to the DH_SIZE(3ossl) page of the OpenSSL manual π this is where we learn how to get the Diffie-Hellman prime size and the security bits, and honestly? it's giving "small but mighty." no cap.
β¨ NAME β¨
DH_size, DH_bits, DH_security_bits β get the Diffie-Hellman prime size and the security bits πΈ
π SYNOPSIS π
#include <openssl/dh.h>
so like, heads up bestie π β the functions below 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) for the deets β¨
int DH_bits(const DH *dh);
int DH_size(const DH *dh);
int DH_security_bits(const DH *dh);
π¦ DESCRIPTION π¦
okay so first thing first: the functions on this page are deprecated π like, they still work, but they're not the moment anymore. applications should instead use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3). slay, moving on π
DH_bits()β returns the number of significant bits β¨
π¨ tiny but crucial:dhanddh->pmust not beNULL. like, don't do that. please. π
DH_size()β returns the Diffie-Hellman prime size in bytes. it's literally the glow-up you need to figure out how much memory must be allocated for the shared secret computed byDH_compute_key(3)π§DH_security_bits()β returns the number of security bits of the givendhkey. seeBN_security_bits(3)for the full vibe check π₯
β RETURN VALUES β
DH_bits()β returns the number of bits in the key, or-1ifdhdoesn't hold any key parameters πDH_size()β returns the prime size of Diffie-Hellman in bytes, or-1ifdhdoesn't hold any key parameters πDH_security_bits()β returns the number of security bits, or-1ifdhdoesn't hold any key parameters π
so yeah, if you see a-1it's not a personality trait, it meansdhis out here holding zero key parameters. empty-handed. iconic but unhelpful π«Ά
π SEE ALSO π
go read those too, iykyk π
π HISTORY π
all of these functions were deprecated in OpenSSL 3.0. that's the whole saga. periodt. π
π COPYRIGHT π
Copyright 2000-2021 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>.
and that's the page bestie! π this was version 3.5.6, dated 2026-04-07, filed under DH_SIZE(3ossl) β go forth and check your bits responsibly, mwah πβ¨π¦
π¦ 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