]>
Commit | Line | Data |
---|---|---|
9b141126 UM |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
5 | BN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables | |
6 | ||
7 | =head1 SYNOPSIS | |
8 | ||
9 | #include <openssl/bn.h> | |
10 | ||
11 | void BN_CTX_start(BN_CTX *ctx); | |
12 | ||
13 | BIGNUM *BN_CTX_get(BN_CTX *ctx); | |
14 | ||
15 | void BN_CTX_end(BN_CTX *ctx); | |
16 | ||
17 | =head1 DESCRIPTION | |
18 | ||
19 | These functions are used to obtain temporary B<BIGNUM> variables from | |
9b86974e | 20 | a B<BN_CTX> (which can been created by using L<BN_CTX_new(3)>) |
16ece03a | 21 | in order to save the overhead of repeatedly creating and |
9b141126 UM |
22 | freeing B<BIGNUM>s in functions that are called from inside a loop. |
23 | ||
24 | A function must call BN_CTX_start() first. Then, BN_CTX_get() may be | |
25 | called repeatedly to obtain temporary B<BIGNUM>s. All BN_CTX_get() | |
26 | calls must be made before calling any other functions that use the | |
27 | B<ctx> as an argument. | |
28 | ||
29 | Finally, BN_CTX_end() must be called before returning from the function. | |
138ef774 | 30 | If B<ctx> is NULL, nothing is done. |
9b141126 UM |
31 | When BN_CTX_end() is called, the B<BIGNUM> pointers obtained from |
32 | BN_CTX_get() become invalid. | |
33 | ||
34 | =head1 RETURN VALUES | |
35 | ||
36 | BN_CTX_start() and BN_CTX_end() return no values. | |
37 | ||
38 | BN_CTX_get() returns a pointer to the B<BIGNUM>, or B<NULL> on error. | |
39 | Once BN_CTX_get() has failed, the subsequent calls will return B<NULL> | |
40 | as well, so it is sufficient to check the return value of the last | |
37e48b88 | 41 | BN_CTX_get() call. In case of an error, an error code is set, which |
9b86974e | 42 | can be obtained by L<ERR_get_error(3)>. |
37e48b88 | 43 | |
9b141126 UM |
44 | |
45 | =head1 SEE ALSO | |
46 | ||
9b86974e | 47 | L<BN_CTX_new(3)> |
9b141126 | 48 | |
e2f92610 RS |
49 | =head1 COPYRIGHT |
50 | ||
51 | Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. | |
52 | ||
4746f25a | 53 | Licensed under the Apache License 2.0 (the "License"). You may not use |
e2f92610 RS |
54 | this file except in compliance with the License. You can obtain a copy |
55 | in the file LICENSE in the source distribution or at | |
56 | L<https://www.openssl.org/source/license.html>. | |
57 | ||
58 | =cut |