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

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

<h1>BN_new(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_new, BN_init, BN_clear, BN_free, BN_clear_free - allocate and free
BIGNUMs

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/bn.h&gt;
</PRE>
<PRE> BIGNUM *BN_new(void);
</PRE>
<PRE> void BN_init(BIGNUM *);
</PRE>
<PRE> void BN_clear(BIGNUM *a);
</PRE>
<PRE> void BN_free(BIGNUM *a);
</PRE>
<PRE> void BN_clear_free(BIGNUM *a);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>BN_new()</CODE> allocates and initializes a <STRONG>BIGNUM</STRONG> structure. <CODE>BN_init()</CODE> initializes an existing uninitialized <STRONG>BIGNUM</STRONG>.

</P>
<P>
<CODE>BN_clear()</CODE> is used to destroy sensitive data such as keys when
they are no longer needed. It erases the memory used by <STRONG>a</STRONG> and sets it to the value 0.

</P>
<P>
<CODE>BN_free()</CODE> frees the components of the <STRONG>BIGNUM</STRONG>, and if it was created by <CODE>BN_new(),</CODE> also the structure
itself. <CODE>BN_clear_free()</CODE> additionally overwrites the data
before the memory is returned to the system.

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
<CODE>BN_new()</CODE> returns a pointer to the <STRONG>BIGNUM</STRONG>. If the allocation fails, it returns <STRONG>NULL</STRONG> and sets an error code that can be obtained by <A HREF="../crypto/ERR_get_error.html#">ERR_get_error(3)</A>.

</P>
<P>
<CODE>BN_init(),</CODE> <CODE>BN_clear(),</CODE> <CODE>BN_free()</CODE> and
<CODE>BN_clear_free()</CODE> have no return values.

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



</P>
<P>
<HR>
<H1><A NAME="HISTORY">HISTORY</A></H1>
<P>
<CODE>BN_new(),</CODE> <CODE>BN_clear(),</CODE> <CODE>BN_free()</CODE> and
<CODE>BN_clear_free()</CODE> are available in all versions on SSLeay and
OpenSSL. <CODE>BN_init()</CODE> was added in SSLeay 0.9.1b.

</P>
:}

