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

Name

Description

ret

Destination BIGNUM that receives the prime.

bits

Desired bit length of the prime.

safe

Nonzero to require a safe prime ((p‐1)/2 also prime).

add

Optional congruence modulus for p = rem (mod add), or NULL.

rem

Optional remainder used with add, or NULL.

cb

Progress callback, or NULL.

ctx

BN_CTX used for generation (must be non‐NULL).

Created with MrDocs