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.1.3  christos BIO_new_ex, BIO_new, BIO_up_ref, BIO_free, BIO_vfree, BIO_free_all
      6      1.1  christos - BIO allocation and freeing functions
      7      1.1  christos 
      8      1.1  christos =head1 SYNOPSIS
      9      1.1  christos 
     10      1.1  christos  #include <openssl/bio.h>
     11      1.1  christos 
     12  1.1.1.3  christos  BIO *BIO_new_ex(OSSL_LIB_CTX *libctx, const BIO_METHOD *type);
     13  1.1.1.3  christos  BIO *BIO_new(const BIO_METHOD *type);
     14  1.1.1.3  christos  int BIO_up_ref(BIO *a);
     15  1.1.1.3  christos  int BIO_free(BIO *a);
     16  1.1.1.3  christos  void BIO_vfree(BIO *a);
     17  1.1.1.3  christos  void BIO_free_all(BIO *a);
     18      1.1  christos 
     19      1.1  christos =head1 DESCRIPTION
     20      1.1  christos 
     21  1.1.1.3  christos The BIO_new_ex() function returns a new BIO using method B<type> associated with
     22  1.1.1.3  christos the library context I<libctx> (see OSSL_LIB_CTX(3)). The library context may be
     23  1.1.1.3  christos NULL to indicate the default library context.
     24  1.1.1.3  christos 
     25  1.1.1.3  christos The BIO_new() is the same as BIO_new_ex() except the default library context is
     26  1.1.1.3  christos always used.
     27      1.1  christos 
     28      1.1  christos BIO_up_ref() increments the reference count associated with the BIO object.
     29      1.1  christos 
     30      1.1  christos BIO_free() frees up a single BIO, BIO_vfree() also frees up a single BIO
     31      1.1  christos but it does not return a value.
     32      1.1  christos If B<a> is NULL nothing is done.
     33      1.1  christos Calling BIO_free() may also have some effect
     34      1.1  christos on the underlying I/O structure, for example it may close the file being
     35      1.1  christos referred to under certain circumstances. For more details see the individual
     36      1.1  christos BIO_METHOD descriptions.
     37      1.1  christos 
     38      1.1  christos BIO_free_all() frees up an entire BIO chain, it does not halt if an error
     39      1.1  christos occurs freeing up an individual BIO in the chain.
     40      1.1  christos If B<a> is NULL nothing is done.
     41      1.1  christos 
     42      1.1  christos =head1 RETURN VALUES
     43      1.1  christos 
     44  1.1.1.3  christos BIO_new_ex() and BIO_new() return a newly created BIO or NULL if the call fails.
     45      1.1  christos 
     46      1.1  christos BIO_up_ref() and BIO_free() return 1 for success and 0 for failure.
     47      1.1  christos 
     48      1.1  christos BIO_free_all() and BIO_vfree() do not return values.
     49      1.1  christos 
     50      1.1  christos =head1 NOTES
     51      1.1  christos 
     52      1.1  christos If BIO_free() is called on a BIO chain it will only free one BIO resulting
     53      1.1  christos in a memory leak.
     54      1.1  christos 
     55      1.1  christos Calling BIO_free_all() on a single BIO has the same effect as calling BIO_free()
     56      1.1  christos on it other than the discarded return value.
     57      1.1  christos 
     58      1.1  christos =head1 HISTORY
     59      1.1  christos 
     60      1.1  christos BIO_set() was removed in OpenSSL 1.1.0 as BIO type is now opaque.
     61      1.1  christos 
     62  1.1.1.3  christos BIO_new_ex() was added in OpenSSL 3.0.
     63  1.1.1.3  christos 
     64  1.1.1.2  christos =head1 EXAMPLES
     65      1.1  christos 
     66      1.1  christos Create a memory BIO:
     67      1.1  christos 
     68      1.1  christos  BIO *mem = BIO_new(BIO_s_mem());
     69      1.1  christos 
     70      1.1  christos =head1 COPYRIGHT
     71      1.1  christos 
     72  1.1.1.3  christos Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
     73      1.1  christos 
     74  1.1.1.3  christos Licensed under the Apache License 2.0 (the "License").  You may not use
     75      1.1  christos this file except in compliance with the License.  You can obtain a copy
     76      1.1  christos in the file LICENSE in the source distribution or at
     77      1.1  christos L<https://www.openssl.org/source/license.html>.
     78      1.1  christos 
     79      1.1  christos =cut
     80