xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/doc/man3/BN_CTX_start.pod (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos=pod
2*4724848cSchristos
3*4724848cSchristos=head1 NAME
4*4724848cSchristos
5*4724848cSchristosBN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables
6*4724848cSchristos
7*4724848cSchristos=head1 SYNOPSIS
8*4724848cSchristos
9*4724848cSchristos #include <openssl/bn.h>
10*4724848cSchristos
11*4724848cSchristos void BN_CTX_start(BN_CTX *ctx);
12*4724848cSchristos
13*4724848cSchristos BIGNUM *BN_CTX_get(BN_CTX *ctx);
14*4724848cSchristos
15*4724848cSchristos void BN_CTX_end(BN_CTX *ctx);
16*4724848cSchristos
17*4724848cSchristos=head1 DESCRIPTION
18*4724848cSchristos
19*4724848cSchristosThese functions are used to obtain temporary B<BIGNUM> variables from
20*4724848cSchristosa B<BN_CTX> (which can been created by using L<BN_CTX_new(3)>)
21*4724848cSchristosin order to save the overhead of repeatedly creating and
22*4724848cSchristosfreeing B<BIGNUM>s in functions that are called from inside a loop.
23*4724848cSchristos
24*4724848cSchristosA function must call BN_CTX_start() first. Then, BN_CTX_get() may be
25*4724848cSchristoscalled repeatedly to obtain temporary B<BIGNUM>s. All BN_CTX_get()
26*4724848cSchristoscalls must be made before calling any other functions that use the
27*4724848cSchristosB<ctx> as an argument.
28*4724848cSchristos
29*4724848cSchristosFinally, BN_CTX_end() must be called before returning from the function.
30*4724848cSchristosIf B<ctx> is NULL, nothing is done.
31*4724848cSchristosWhen BN_CTX_end() is called, the B<BIGNUM> pointers obtained from
32*4724848cSchristosBN_CTX_get() become invalid.
33*4724848cSchristos
34*4724848cSchristos=head1 RETURN VALUES
35*4724848cSchristos
36*4724848cSchristosBN_CTX_start() and BN_CTX_end() return no values.
37*4724848cSchristos
38*4724848cSchristosBN_CTX_get() returns a pointer to the B<BIGNUM>, or B<NULL> on error.
39*4724848cSchristosOnce BN_CTX_get() has failed, the subsequent calls will return B<NULL>
40*4724848cSchristosas well, so it is sufficient to check the return value of the last
41*4724848cSchristosBN_CTX_get() call. In case of an error, an error code is set, which
42*4724848cSchristoscan be obtained by L<ERR_get_error(3)>.
43*4724848cSchristos
44*4724848cSchristos
45*4724848cSchristos=head1 SEE ALSO
46*4724848cSchristos
47*4724848cSchristosL<BN_CTX_new(3)>
48*4724848cSchristos
49*4724848cSchristos=head1 COPYRIGHT
50*4724848cSchristos
51*4724848cSchristosCopyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
52*4724848cSchristos
53*4724848cSchristosLicensed under the OpenSSL license (the "License").  You may not use
54*4724848cSchristosthis file except in compliance with the License.  You can obtain a copy
55*4724848cSchristosin the file LICENSE in the source distribution or at
56*4724848cSchristosL<https://www.openssl.org/source/license.html>.
57*4724848cSchristos
58*4724848cSchristos=cut
59