BN_generate_prime_ex

Generate a probable prime of the requested size and congruence constraints.

Synopsis

Declared in <openssl/bn.h>

int
BN_generate_prime_ex(
    BIGNUM* ret,
    int bits,
    int safe,
    BIGNUM const* add,
    BIGNUM const* rem,
    BN_GENCB* cb);

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
retDestination BIGNUM for the prime.
bitsDesired bit length.
safeNon-zero to require a safe prime ((p-1)/2 also prime).
addOptional modulus for the constraint ret ≡ rem (mod add), or NULL.
remOptional residue for that constraint, or NULL (defaults to 1).
cbOptional generation callback, or NULL.