---
name: "libressl-DH_size"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-DH_size"
---

# libressl-DH\_size(3)

get Diffie-Hellman prime size

## NAME

**DH\_size**, **DH\_bits** – get Diffie-Hellman prime size

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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.
