159191Skris=pod 259191Skris 359191Skris=head1 NAME 459191Skris 559191SkrisBN_CTX_new, BN_CTX_init, BN_CTX_free - allocate and free BN_CTX structures 659191Skris 759191Skris=head1 SYNOPSIS 859191Skris 959191Skris #include <openssl/bn.h> 1059191Skris 1159191Skris BN_CTX *BN_CTX_new(void); 1259191Skris 1359191Skris void BN_CTX_init(BN_CTX *c); 1459191Skris 1559191Skris void BN_CTX_free(BN_CTX *c); 1659191Skris 1759191Skris=head1 DESCRIPTION 1859191Skris 1959191SkrisA B<BN_CTX> is a structure that holds B<BIGNUM> temporary variables used by 2059191Skrislibrary functions. Since dynamic memory allocation to create B<BIGNUM>s 2159191Skrisis rather expensive when used in conjunction with repeated subroutine 2259191Skriscalls, the B<BN_CTX> structure is used. 2359191Skris 2459191SkrisBN_CTX_new() allocates and initializes a B<BN_CTX> 2559191Skrisstructure. BN_CTX_init() initializes an existing uninitialized 2659191SkrisB<BN_CTX>. 2759191Skris 2859191SkrisBN_CTX_free() frees the components of the B<BN_CTX>, and if it was 2959191Skriscreated by BN_CTX_new(), also the structure itself. 3059191SkrisIf L<BN_CTX_start(3)|BN_CTX_start(3)> has been used on the B<BN_CTX>, 3159191SkrisL<BN_CTX_end(3)|BN_CTX_end(3)> must be called before the B<BN_CTX> 3259191Skrismay be freed by BN_CTX_free(). 3359191Skris 3459191Skris 3559191Skris=head1 RETURN VALUES 3659191Skris 3759191SkrisBN_CTX_new() returns a pointer to the B<BN_CTX>. If the allocation fails, 3859191Skrisit returns B<NULL> and sets an error code that can be obtained by 3959191SkrisL<ERR_get_error(3)|ERR_get_error(3)>. 4059191Skris 4159191SkrisBN_CTX_init() and BN_CTX_free() have no return values. 4259191Skris 4359191Skris=head1 SEE ALSO 4459191Skris 45109998SmarkmL<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>, 4659191SkrisL<BN_CTX_start(3)|BN_CTX_start(3)> 4759191Skris 4859191Skris=head1 HISTORY 4959191Skris 5059191SkrisBN_CTX_new() and BN_CTX_free() are available in all versions on SSLeay 5159191Skrisand OpenSSL. BN_CTX_init() was added in SSLeay 0.9.1b. 5259191Skris 5359191Skris=cut 54