1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimBN_new, BN_secure_new, BN_clear, BN_free, BN_clear_free - allocate and free BIGNUMs 6e71b7053SJung-uk Kim 7e71b7053SJung-uk Kim=head1 SYNOPSIS 8e71b7053SJung-uk Kim 9e71b7053SJung-uk Kim #include <openssl/bn.h> 10e71b7053SJung-uk Kim 11e71b7053SJung-uk Kim BIGNUM *BN_new(void); 12e71b7053SJung-uk Kim 13e71b7053SJung-uk Kim BIGNUM *BN_secure_new(void); 14e71b7053SJung-uk Kim 15e71b7053SJung-uk Kim void BN_clear(BIGNUM *a); 16e71b7053SJung-uk Kim 17e71b7053SJung-uk Kim void BN_free(BIGNUM *a); 18e71b7053SJung-uk Kim 19e71b7053SJung-uk Kim void BN_clear_free(BIGNUM *a); 20e71b7053SJung-uk Kim 21e71b7053SJung-uk Kim=head1 DESCRIPTION 22e71b7053SJung-uk Kim 23e71b7053SJung-uk KimBN_new() allocates and initializes a B<BIGNUM> structure. 24e71b7053SJung-uk KimBN_secure_new() does the same except that the secure heap 25da327cd2SJung-uk KimL<OPENSSL_secure_malloc(3)> is used to store the value. 26e71b7053SJung-uk Kim 27e71b7053SJung-uk KimBN_clear() is used to destroy sensitive data such as keys when they 28e71b7053SJung-uk Kimare no longer needed. It erases the memory used by B<a> and sets it 29e71b7053SJung-uk Kimto the value 0. 30610a21fdSJung-uk KimIf B<a> is NULL, nothing is done. 31e71b7053SJung-uk Kim 32e71b7053SJung-uk KimBN_free() frees the components of the B<BIGNUM>, and if it was created 33e71b7053SJung-uk Kimby BN_new(), also the structure itself. BN_clear_free() additionally 34e71b7053SJung-uk Kimoverwrites the data before the memory is returned to the system. 35e71b7053SJung-uk KimIf B<a> is NULL, nothing is done. 36e71b7053SJung-uk Kim 37e71b7053SJung-uk Kim=head1 RETURN VALUES 38e71b7053SJung-uk Kim 39e71b7053SJung-uk KimBN_new() and BN_secure_new() 40e71b7053SJung-uk Kimreturn a pointer to the B<BIGNUM> initialised to the value 0. 41e71b7053SJung-uk KimIf the allocation fails, 42e71b7053SJung-uk Kimthey return B<NULL> and set an error code that can be obtained 43e71b7053SJung-uk Kimby L<ERR_get_error(3)>. 44e71b7053SJung-uk Kim 45e71b7053SJung-uk KimBN_clear(), BN_free() and BN_clear_free() have no return values. 46e71b7053SJung-uk Kim 47e71b7053SJung-uk Kim=head1 SEE ALSO 48e71b7053SJung-uk Kim 49da327cd2SJung-uk KimL<ERR_get_error(3)>, L<OPENSSL_secure_malloc(3)> 50e71b7053SJung-uk Kim 51e71b7053SJung-uk Kim=head1 HISTORY 52e71b7053SJung-uk Kim 53e71b7053SJung-uk KimBN_init() was removed in OpenSSL 1.1.0; use BN_new() instead. 54e71b7053SJung-uk Kim 55e71b7053SJung-uk Kim=head1 COPYRIGHT 56e71b7053SJung-uk Kim 57*b077aed3SPierre ProncheryCopyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved. 58e71b7053SJung-uk Kim 59*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 60e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 61e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 62e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 63e71b7053SJung-uk Kim 64e71b7053SJung-uk Kim=cut 65