BN_CTX_start.pod 1.7 KB

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