---
name: "libressl-BN_get_rfc3526_prime_8192"
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-BN_get_rfc3526_prime_8192"
---

# libressl-BN\_get\_rfc3526\_prime\_8192(3)

standard moduli for Diffie-Hellman key exchange

## NAME

**BN\_get\_rfc2409\_prime\_768**, **BN\_get\_rfc2409\_prime\_1024**, **BN\_get\_rfc3526\_prime\_1536**, **BN\_get\_rfc3526\_prime\_2048**, **BN\_get\_rfc3526\_prime\_3072**, **BN\_get\_rfc3526\_prime\_4096**, **BN\_get\_rfc3526\_prime\_6144**, **BN\_get\_rfc3526\_prime\_8192** – standard moduli for Diffie-Hellman key exchange

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/bn.h\>**

*BIGNUM* *\**\

**BN\_get\_rfc2409\_prime\_768**(*BIGNUM \*bn*);

*BIGNUM* *\**\

**BN\_get\_rfc2409\_prime\_1024**(*BIGNUM \*bn*);

*BIGNUM* *\**\

**BN\_get\_rfc3526\_prime\_1536**(*BIGNUM \*bn*);

*BIGNUM* *\**\

**BN\_get\_rfc3526\_prime\_2048**(*BIGNUM \*bn*);

*BIGNUM* *\**\

**BN\_get\_rfc3526\_prime\_3072**(*BIGNUM \*bn*);

*BIGNUM* *\**\

**BN\_get\_rfc3526\_prime\_4096**(*BIGNUM \*bn*);

*BIGNUM* *\**\

**BN\_get\_rfc3526\_prime\_6144**(*BIGNUM \*bn*);

*BIGNUM* *\**\

**BN\_get\_rfc3526\_prime\_8192**(*BIGNUM \*bn*);

## DESCRIPTION

Each of these functions returns one specific constant Sophie Germain prime number *p*.

If *bn* is NULL, a new *BIGNUM* object is created and returned. Otherwise, the number is stored in \**bn* and *bn* is returned.

All these numbers are of the form

p = 2 sup s - 2 sup left ( s - 64 right ) - 1 + 2 sup 64 \* left { left \[ 2 sup left ( s - 130 right ) pi right \] + offset right } delim $$

where *s* is the size of the binary representation of the number in bits and appears at the end of the function names. As long as the offset is sufficiently small, the above form assures that the top and bottom 64 bits of each number are all 1.

The offsets are defined in the standards as follows:

| | |
| --- | --- |
| size *s* | *offset* |
|  |  |
| 768 = 3 \* 2^8 | 149686 |
| 1024 = 2 \* 2^9 | 129093 |
| 1536 = 3 \* 2^9 | 741804 |
| 2048 = 2 \* 2^10 | 124476 |
| 3072 = 3 \* 2^10 | 1690314 |
| 4096 = 2 \* 2^11 | 240904 |
| 6144 = 3 \* 2^11 | 929484 |
| 8192 = 2 \* 2^12 | 4743158 |

For each of these prime numbers, the finite group of natural numbers smaller than *p*, where the group operation is defined as multiplication modulo *p*, is used for Diffie-Hellman key exchange. The first two of these groups are called the First Oakley Group and the Second Oakley Group. Obviously, all these groups are cyclic groups of order *p*, respectively, and the numbers returned by these functions are not secrets.

## RETURN VALUES

If memory allocation fails, these functions return NULL. That can happen even if *bn* is not NULL.

## SEE ALSO

BN\_mod\_exp(3), BN\_new(3), BN\_set\_flags(3), DH\_new(3)

## STANDARDS

RFC 2409, "The Internet Key Exchange (IKE)", defines the Oakley Groups.

RFC 2412, "The OAKLEY Key Determination Protocol", contains additional information about these numbers.

RFC 3526, "More Modular Exponential (MODP) Diffie-Hellman groups for Internet Key Exchange (IKE)", defines the other six numbers.

## HISTORY

**BN\_get\_rfc2409\_prime\_768**(), **BN\_get\_rfc2409\_prime\_1024**(), **BN\_get\_rfc3526\_prime\_1536**(), **BN\_get\_rfc3526\_prime\_2048**(), **BN\_get\_rfc3526\_prime\_3072**(), **BN\_get\_rfc3526\_prime\_4096**(), **BN\_get\_rfc3526\_prime\_6144**(), and **BN\_get\_rfc3526\_prime\_8192**() first appeared in OpenSSL 1.1.0 and have been available since OpenBSD 6.3. The same functions without **BN\_** prefix first appeared in OpenSSL 0.9.8a and OpenBSD 4.5; they were removed in OpenBSD 7.4.

## CAVEATS

As all the memory needed for storing the numbers is dynamically allocated, the BN\_FLG\_STATIC\_DATA flag is not set on the returned *BIGNUM* objects. So be careful to not change the returned numbers.
