Sortix
Sortix Download Manual Development Source Code News Blog More
current nightly

Sortix nightly manual

This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.

NAME

DH_size, DH_bits — get Diffie-Hellman prime size

SYNOPSIS

#include <openssl/dh.h>
int
DH_size(const DH *dh);
int
DH_bits(const DH *dh);

DESCRIPTION

DH_size() returns the Diffie-Hellman prime size in bytes. It can be used to determine how much memory must be allocated for the shared secret computed by DH_compute_key(3).
DH_bits() returns the number of significant bits in the key.
dh and dh->p must not be NULL.

SEE ALSO

BN_num_bytes(3), DH_generate_key(3), DH_get0_key(3), DH_new(3), DH_security_bits(3)

HISTORY

DH_size() first appeared in SSLeay 0.5.1 and has been available since OpenBSD 2.4.
DH_bits() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.3.
Copyright 2011-2025 Jonas 'Sortie' Termansen and contributors.
Sortix's source code is free software under the ISC license.
#sortix on irc.sortix.org
@sortix_org