Blame doc/man3/BN_CTX_new.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
BN_CTX_new, BN_CTX_secure_new, BN_CTX_free - allocate and free BN_CTX structures
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/bn.h>
Packit c4476c
Packit c4476c
 BN_CTX *BN_CTX_new(void);
Packit c4476c
Packit c4476c
 BN_CTX *BN_CTX_secure_new(void);
Packit c4476c
Packit c4476c
 void BN_CTX_free(BN_CTX *c);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
A B<BN_CTX> is a structure that holds B<BIGNUM> temporary variables used by
Packit c4476c
library functions. Since dynamic memory allocation to create B<BIGNUM>s
Packit c4476c
is rather expensive when used in conjunction with repeated subroutine
Packit c4476c
calls, the B<BN_CTX> structure is used.
Packit c4476c
Packit c4476c
BN_CTX_new() allocates and initializes a B<BN_CTX> structure.
Packit c4476c
BN_CTX_secure_new() allocates and initializes a B<BN_CTX> structure
Packit c4476c
but uses the secure heap (see L<CRYPTO_secure_malloc(3)>) to hold the
Packit c4476c
B<BIGNUM>s.
Packit c4476c
Packit c4476c
BN_CTX_free() frees the components of the B<BN_CTX> and the structure itself.
Packit c4476c
Since BN_CTX_start() is required in order to obtain B<BIGNUM>s from the
Packit c4476c
B<BN_CTX>, in most cases BN_CTX_end() must be called before the B<BN_CTX> may
Packit c4476c
be freed by BN_CTX_free().  If B<c> is NULL, nothing is done.
Packit c4476c
Packit c4476c
A given B<BN_CTX> must only be used by a single thread of execution.  No
Packit c4476c
locking is performed, and the internal pool allocator will not properly handle
Packit c4476c
multiple threads of execution.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
BN_CTX_new() and BN_CTX_secure_new() return a pointer to the B<BN_CTX>.
Packit c4476c
If the allocation fails,
Packit c4476c
they return B<NULL> and sets an error code that can be obtained by
Packit c4476c
L<ERR_get_error(3)>.
Packit c4476c
Packit c4476c
BN_CTX_free() has no return values.
Packit c4476c
Packit c4476c
=head1 REMOVED FUNCTIONALITY
Packit c4476c
Packit c4476c
 void BN_CTX_init(BN_CTX *c);
Packit c4476c
Packit c4476c
BN_CTX_init() is no longer available as of OpenSSL 1.1.0. Applications should
Packit c4476c
replace use of BN_CTX_init with BN_CTX_new instead:
Packit c4476c
Packit c4476c
 BN_CTX *ctx;
Packit c4476c
 ctx = BN_CTX_new();
Packit c4476c
 if (!ctx)
Packit c4476c
     /* error */
Packit c4476c
 ...
Packit c4476c
 BN_CTX_free(ctx);
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<ERR_get_error(3)>, L<BN_add(3)>,
Packit c4476c
L<BN_CTX_start(3)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
BN_CTX_init() was removed in OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut