Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
NAME
BN_is_prime_ex, BN_is_prime_fasttest_ex, BN_generate_prime_ex, BN_GENCB_call, BN_GENCB_new, BN_GENCB_free, BN_GENCB_set, BN_GENCB_get_arg, BN_GENCB_set_old — generate primes and test for primalitySYNOPSIS
#include <openssl/bn.h>BN_is_prime_ex(const BIGNUM *a, int nchecks, BN_CTX *ctx, BN_GENCB *cb);
BN_is_prime_fasttest_ex(const BIGNUM *a, int nchecks, BN_CTX *ctx, int do_trial_division, BN_GENCB *cb);
BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *modulus, const BIGNUM *remainder, BN_GENCB *cb);
BN_GENCB_call(BN_GENCB *cb, int state_code, int serial_number);
BN_GENCB_new(void);
BN_GENCB_free(BN_GENCB *cb);
BN_GENCB_set(BN_GENCB *cb, int (*cb_fp)(int, int, BN_GENCB *), void *cb_arg);
BN_GENCB_get_arg(BN_GENCB *cb);
void
BN_GENCB_set_old(BN_GENCB *cb, void (*cb_fp)(int, int, void *), void *cb_arg);
DESCRIPTION
BN_is_prime_ex() and BN_is_prime_fasttest_ex() test whether the number a is prime. In LibreSSL, both functions behave identically and use the Baillie-Pomerance-Selfridge-Wagstaff algorithm combined with checks Miller-Rabin rounds. The do_trial_division argument is ignored.-
If modulus is not NULL, a prime is generated that fulfills the condition ret
%
modulus=
remainder. If the remainder argument is NULL, 1 is used as the desired remainder. -
If the safe argument is non-zero, a safe prime is generated, that is, (ret
- 1
)/2 is also prime.
- BN_GENCB_call(cb, 0, serial_number) is called after generating a potential prime number.
- The state_code of 1 is reserved for callbacks during primality testing, but LibreSSL performs no such callbacks.
- When safe is non-zero and a safe prime has been found, BN_GENCB_call(cb, 2, serial_number) is called.
- The callers of BN_generate_prime_ex() may call BN_GENCB_call() with other values as described in their respective manual pages; see SEE ALSO.