BN_new.pod 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. =pod
  2. =head1 NAME
  3. BN_new, BN_secure_new, BN_clear, BN_free, BN_clear_free - allocate and free BIGNUMs
  4. =head1 SYNOPSIS
  5. #include <openssl/bn.h>
  6. BIGNUM *BN_new(void);
  7. BIGNUM *BN_secure_new(void);
  8. void BN_clear(BIGNUM *a);
  9. void BN_free(BIGNUM *a);
  10. void BN_clear_free(BIGNUM *a);
  11. =head1 DESCRIPTION
  12. BN_new() allocates and initializes a B<BIGNUM> structure.
  13. BN_secure_new() does the same except that the secure heap
  14. L<OPENSSL_secure_malloc(3)> is used to store the value.
  15. BN_clear() is used to destroy sensitive data such as keys when they
  16. are no longer needed. It erases the memory used by B<a> and sets it
  17. to the value 0.
  18. If B<a> is NULL, nothing is done.
  19. BN_free() frees the components of the B<BIGNUM>, and if it was created
  20. by BN_new(), also the structure itself. BN_clear_free() additionally
  21. overwrites the data before the memory is returned to the system.
  22. If B<a> is NULL, nothing is done.
  23. =head1 RETURN VALUES
  24. BN_new() and BN_secure_new()
  25. return a pointer to the B<BIGNUM> initialised to the value 0.
  26. If the allocation fails,
  27. they return B<NULL> and set an error code that can be obtained
  28. by L<ERR_get_error(3)>.
  29. BN_clear(), BN_free() and BN_clear_free() have no return values.
  30. =head1 SEE ALSO
  31. L<ERR_get_error(3)>, L<OPENSSL_secure_malloc(3)>
  32. =head1 HISTORY
  33. BN_init() was removed in OpenSSL 1.1.0; use BN_new() instead.
  34. =head1 COPYRIGHT
  35. Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
  36. Licensed under the Apache License 2.0 (the "License"). You may not use
  37. this file except in compliance with the License. You can obtain a copy
  38. in the file LICENSE in the source distribution or at
  39. L<https://www.openssl.org/source/license.html>.
  40. =cut