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