BN_generate_prime_ex2

Generate a probable prime into ret using caller-supplied BN_CTX scratch space.

Synopsis

Declared in <openssl/bn.h>

int
BN_generate_prime_ex2(
    BIGNUM* ret,
    int bits,
    int safe,
    BIGNUM const* add,
    BIGNUM const* rem,
    BN_GENCB* cb,
    BN_CTX* ctx);

Return Value

1 if a suitable prime was found, or 0 on error.

Parameters

NameDescription
retDestination BIGNUM that receives the prime.
bitsDesired bit length of the prime.
safeNonzero to require a safe prime ((p-1)/2 also prime).
addOptional congruence modulus for p = rem (mod add), or NULL.
remOptional remainder used with add, or NULL.
cbProgress callback, or NULL.
ctxBN_CTX used for generation (must be non-NULL).