[#BN_mod_inverse]
= BN&lowbar;mod&lowbar;inverse
:mrdocs:

Compute the modular inverse of `a` modulo `n&period;`

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BIGNUM.adoc[BIGNUM]*
BN&lowbar;mod&lowbar;inverse(
    xref:BIGNUM.adoc[BIGNUM]* ret,
    xref:BIGNUM.adoc[BIGNUM] const* a,
    xref:BIGNUM.adoc[BIGNUM] const* n,
    xref:BN_CTX.adoc[BN&lowbar;CTX]* ctx);
----

== Return Value

Result BIGNUM (possibly newly allocated) on success, or NULL if no inverse exists &sol; on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ret*
| Existing BIGNUM to receive the result, or NULL to allocate&period;
| *a*
| Value to invert&period;
| *n*
| Modulus&semi; must be non&hyphen;zero&period;
| *ctx*
| BN&lowbar;CTX scratch space&period;
|===


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