[#BN_generate_prime_ex2] = BN_generate_prime_ex2 :mrdocs: Generate a probable prime into `ret` using caller‐supplied BN_CTX scratch space. == Synopsis Declared in `<openssl/bn.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int BN_generate_prime_ex2( xref:BIGNUM.adoc[BIGNUM]* ret, int bits, int safe, xref:BIGNUM.adoc[BIGNUM] const* add, xref:BIGNUM.adoc[BIGNUM] const* rem, xref:BN_GENCB.adoc[BN_GENCB]* cb, xref:BN_CTX.adoc[BN_CTX]* ctx); ---- == Return Value 1 if a suitable prime was found, or 0 on error. == Parameters [cols="1,4"] |=== | 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). |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#