/b> modulo <b>n</b> places the result in <b>r</b> (<code>(a*r)%n==1</code>). If <b>r</b> is NULL, a new <b>BIGNUM</b> is created.</p>

<p><b>ctx</b> is a previously allocated <b>BN_CTX</b> used for temporary variables. <b>r</b> may be the same <b>BIGNUM</b> as <b>a</b>.</p>

<h1 id="NOTES">NOTES</h1>

<p>It is an error to use the same <b>BIGNUM</b> as <b>n</b>.</p>

<h1 id="RETURN-VALUES">RETURN VALUES</h1>

<p>BN_mod_inverse() returns the <b>BIGNUM</b> containing the inverse, and NULL on error. The error c