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