xref: /freebsd/crypto/openssl/doc/man3/BN_CTX_start.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimBN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables
6e71b7053SJung-uk Kim
7e71b7053SJung-uk Kim=head1 SYNOPSIS
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim #include <openssl/bn.h>
10e71b7053SJung-uk Kim
11e71b7053SJung-uk Kim void BN_CTX_start(BN_CTX *ctx);
12e71b7053SJung-uk Kim
13e71b7053SJung-uk Kim BIGNUM *BN_CTX_get(BN_CTX *ctx);
14e71b7053SJung-uk Kim
15e71b7053SJung-uk Kim void BN_CTX_end(BN_CTX *ctx);
16e71b7053SJung-uk Kim
17e71b7053SJung-uk Kim=head1 DESCRIPTION
18e71b7053SJung-uk Kim
19e71b7053SJung-uk KimThese functions are used to obtain temporary B<BIGNUM> variables from
20e71b7053SJung-uk Kima B<BN_CTX> (which can been created by using L<BN_CTX_new(3)>)
21e71b7053SJung-uk Kimin order to save the overhead of repeatedly creating and
22e71b7053SJung-uk Kimfreeing B<BIGNUM>s in functions that are called from inside a loop.
23e71b7053SJung-uk Kim
24e71b7053SJung-uk KimA function must call BN_CTX_start() first. Then, BN_CTX_get() may be
25e71b7053SJung-uk Kimcalled repeatedly to obtain temporary B<BIGNUM>s. All BN_CTX_get()
26e71b7053SJung-uk Kimcalls must be made before calling any other functions that use the
27e71b7053SJung-uk KimB<ctx> as an argument.
28e71b7053SJung-uk Kim
29e71b7053SJung-uk KimFinally, BN_CTX_end() must be called before returning from the function.
30610a21fdSJung-uk KimIf B<ctx> is NULL, nothing is done.
31e71b7053SJung-uk KimWhen BN_CTX_end() is called, the B<BIGNUM> pointers obtained from
32e71b7053SJung-uk KimBN_CTX_get() become invalid.
33e71b7053SJung-uk Kim
34e71b7053SJung-uk Kim=head1 RETURN VALUES
35e71b7053SJung-uk Kim
36e71b7053SJung-uk KimBN_CTX_start() and BN_CTX_end() return no values.
37e71b7053SJung-uk Kim
38e71b7053SJung-uk KimBN_CTX_get() returns a pointer to the B<BIGNUM>, or B<NULL> on error.
39e71b7053SJung-uk KimOnce BN_CTX_get() has failed, the subsequent calls will return B<NULL>
40e71b7053SJung-uk Kimas well, so it is sufficient to check the return value of the last
41e71b7053SJung-uk KimBN_CTX_get() call. In case of an error, an error code is set, which
42e71b7053SJung-uk Kimcan be obtained by L<ERR_get_error(3)>.
43e71b7053SJung-uk Kim
44e71b7053SJung-uk Kim
45e71b7053SJung-uk Kim=head1 SEE ALSO
46e71b7053SJung-uk Kim
47e71b7053SJung-uk KimL<BN_CTX_new(3)>
48e71b7053SJung-uk Kim
49e71b7053SJung-uk Kim=head1 COPYRIGHT
50e71b7053SJung-uk Kim
51*b077aed3SPierre ProncheryCopyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
52e71b7053SJung-uk Kim
53*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
54e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
55e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
56e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
57e71b7053SJung-uk Kim
58e71b7053SJung-uk Kim=cut
59