[#BN_generate_prime]
= BN&lowbar;generate&lowbar;prime
:mrdocs:

Generate a prime of approximately `bits` (deprecated&semi; prefer BN&lowbar;generate&lowbar;prime&lowbar;ex)&period;

== Synopsis

Declared in `&lt;openssl&sol;bn&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;deprecated&rsqb;&rsqb;
xref:BIGNUM.adoc[BIGNUM]*
BN&lowbar;generate&lowbar;prime(
    xref:BIGNUM.adoc[BIGNUM]* ret,
    int bits,
    int safe,
    xref:BIGNUM.adoc[BIGNUM] const* add,
    xref:BIGNUM.adoc[BIGNUM] const* rem,
    void(* callback)(int, int, void*),
    void* cb&lowbar;arg);
----

[WARNING]
====
https://en.cppreference.com/cpp/language/attributes/deprecated[Deprecated^]. Use of this entity is allowed but discouraged.
====
== Return Value

Generated prime BIGNUM, or NULL on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ret*
| Destination BIGNUM, or NULL to allocate a new one&period;
| *bits*
| Desired bit length of the prime&period;
| *safe*
| Nonzero to require a safe prime ((p&hyphen;1)&sol;2 also prime)&period;
| *add*
| Optional congruence modulus constraint, or NULL&period;
| *rem*
| Optional remainder for the `add` constraint, or NULL&period;
| *callback*
| Progress callback, or NULL&period;
| *cb&lowbar;arg*
| User argument passed to `callback&period;`
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
