1BIO_NEW(3ossl)                      OpenSSL                     BIO_NEW(3ossl)
2
3
4

NAME

6       BIO_new_ex, BIO_new, BIO_up_ref, BIO_free, BIO_vfree, BIO_free_all -
7       BIO allocation and freeing functions
8

SYNOPSIS

10        #include <openssl/bio.h>
11
12        BIO *BIO_new_ex(OSSL_LIB_CTX *libctx, const BIO_METHOD *type);
13        BIO *BIO_new(const BIO_METHOD *type);
14        int BIO_up_ref(BIO *a);
15        int BIO_free(BIO *a);
16        void BIO_vfree(BIO *a);
17        void BIO_free_all(BIO *a);
18

DESCRIPTION

20       The BIO_new_ex() function returns a new BIO using method type
21       associated with the library context libctx (see OSSL_LIB_CTX(3)). The
22       library context may be NULL to indicate the default library context.
23
24       The BIO_new() is the same as BIO_new_ex() except the default library
25       context is always used.
26
27       BIO_up_ref() increments the reference count associated with the BIO
28       object.
29
30       BIO_free() frees up a single BIO, BIO_vfree() also frees up a single
31       BIO but it does not return a value.  If a is NULL nothing is done.
32       Calling BIO_free() may also have some effect on the underlying I/O
33       structure, for example it may close the file being referred to under
34       certain circumstances. For more details see the individual BIO_METHOD
35       descriptions.
36
37       BIO_free_all() frees up an entire BIO chain, it does not halt if an
38       error occurs freeing up an individual BIO in the chain.  If a is NULL
39       nothing is done.
40

RETURN VALUES

42       BIO_new_ex() and BIO_new() return a newly created BIO or NULL if the
43       call fails.
44
45       BIO_up_ref() and BIO_free() return 1 for success and 0 for failure.
46
47       BIO_free_all() and BIO_vfree() do not return values.
48

NOTES

50       If BIO_free() is called on a BIO chain it will only free one BIO
51       resulting in a memory leak.
52
53       Calling BIO_free_all() on a single BIO has the same effect as calling
54       BIO_free() on it other than the discarded return value.
55

HISTORY

57       BIO_set() was removed in OpenSSL 1.1.0 as BIO type is now opaque.
58
59       BIO_new_ex() was added in OpenSSL 3.0.
60

EXAMPLES

62       Create a memory BIO:
63
64        BIO *mem = BIO_new(BIO_s_mem());
65
67       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
68
69       Licensed under the Apache License 2.0 (the "License").  You may not use
70       this file except in compliance with the License.  You can obtain a copy
71       in the file LICENSE in the source distribution or at
72       <https://www.openssl.org/source/license.html>.
73
74
75
763.0.5                             2022-11-01                    BIO_NEW(3ossl)
Impressum