
#use wml::openssl-macros area=docs page=BN_CTX_start

<title>Documents, BN_CTX_start(3)</title>

<h1>BN_CTX_start(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
	<LI><A HREF="#HISTORY">HISTORY</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
BN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/bn.h&gt;
</PRE>
<PRE> void BN_CTX_start(BN_CTX *ctx);
</PRE>
<PRE> BIGNUM *BN_CTX_get(BN_CTX *ctx);
</PRE>
<PRE> void BN_CTX_end(BN_CTX *ctx);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
These functions are used to obtain temporary <STRONG>BIGNUM</STRONG> variables from a <STRONG>BN_CTX</STRONG> (which can been created by using <A HREF="../crypto/BN_CTX_new.html#">BN_CTX_new(3)</A>) in order to save the overhead of repeatedly creating and freeing <STRONG>BIGNUM</STRONG>s in functions that are called from inside a loop.

</P>
<P>
A function must call <CODE>BN_CTX_start()</CODE> first. Then,
<CODE>BN_CTX_get()</CODE> may be called repeatedly to obtain temporary <STRONG>BIGNUM</STRONG>s. All <CODE>BN_CTX_get()</CODE> calls must be made before calling any
other functions that use the
<STRONG>ctx</STRONG> as an argument.

</P>
<P>
Finally, <CODE>BN_CTX_end()</CODE> must be called before returning from the
function. When <CODE>BN_CTX_end()</CODE> is called, the <STRONG>BIGNUM</STRONG> pointers obtained from <CODE>BN_CTX_get()</CODE> become invalid.

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
<CODE>BN_CTX_start()</CODE> and <CODE>BN_CTX_end()</CODE> return no values.

</P>
<P>
<CODE>BN_CTX_get()</CODE> returns a pointer to the <STRONG>BIGNUM</STRONG>, or <STRONG>NULL</STRONG> on error. Once <CODE>BN_CTX_get()</CODE> has failed, the subsequent calls
will return <STRONG>NULL</STRONG>
as well, so it is sufficient to check the return value of the last
<CODE>BN_CTX_get()</CODE> call. In case of an error, an error code is set,
which can be obtained by <A HREF="../crypto/ERR_get_error.html#">ERR_get_error(3)</A>.

</P>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../crypto/BN_CTX_new.html#">BN_CTX_new(3)</A>



</P>
<P>
<HR>
<H1><A NAME="HISTORY">HISTORY</A></H1>
<P>
<CODE>BN_CTX_start(),</CODE> <CODE>BN_CTX_get()</CODE> and
<CODE>BN_CTX_end()</CODE> were added in OpenSSL 0.9.5.

</P>
:}

