]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man7/bio.pod
Change all references to OpenSSL 3.1 to OpenSSL 3.2 in the master branch
[thirdparty/openssl.git] / doc / man7 / bio.pod
CommitLineData
47770c4d
DSH
1=pod
2
3=head1 NAME
4
53934822 5bio - Basic I/O abstraction
47770c4d
DSH
6
7=head1 SYNOPSIS
8
bb82531f 9=for openssl generic
a9c85cea 10
47770c4d
DSH
11 #include <openssl/bio.h>
12
47770c4d
DSH
13=head1 DESCRIPTION
14
15A BIO is an I/O abstraction, it hides many of the underlying I/O
16details from an application. If an application uses a BIO for its
17I/O it can transparently handle SSL connections, unencrypted network
18connections and file I/O.
19
1ee1a169 20There are two types of BIO, a source/sink BIO and a filter BIO.
47770c4d 21
1974a58f 22As its name implies a source/sink BIO is a source and/or sink of data,
47770c4d
DSH
23examples include a socket BIO and a file BIO.
24
25A filter BIO takes data from one BIO and passes it through to
26another, or the application. The data may be left unmodified (for
27example a message digest BIO) or translated (for example an
28encryption BIO). The effect of a filter BIO may change according
29to the I/O operation it is performing: for example an encryption
30BIO will encrypt data if it is being written to and decrypt data
31if it is being read from.
32
33BIOs can be joined together to form a chain (a single BIO is a chain
1ee1a169 34with one component). A chain normally consists of one source/sink
47770c4d 35BIO and one or more filter BIOs. Data read from or written to the
5fd0cd9a 36first BIO then traverses the chain to the end (normally a source/sink
47770c4d
DSH
37BIO).
38
53934822
RS
39Some BIOs (such as memory BIOs) can be used immediately after calling
40BIO_new(). Others (such as file BIOs) need some additional initialization,
41and frequently a utility function exists to create and initialize such BIOs.
42
43If BIO_free() is called on a BIO chain it will only free one BIO resulting
44in a memory leak.
45
631c37be
DB
46Calling BIO_free_all() on a single BIO has the same effect as calling
47BIO_free() on it other than the discarded return value.
53934822 48
dfabee82 49Normally the I<type> argument is supplied by a function which returns a
53934822 50pointer to a BIO_METHOD. There is a naming convention for such functions:
57cd10dd 51a source/sink BIO typically starts with I<BIO_s_> and
e8769719 52a filter BIO with I<BIO_f_>.
53934822 53
a3e53d56
TS
54=head2 TCP Fast Open
55
56TCP Fast Open (RFC7413), abbreviated "TFO", is supported by the BIO
45ada6b9 57interface since OpenSSL 3.2. TFO is supported in the following operating systems:
a3e53d56
TS
58
59=over 4
60
61=item * Linux kernel 3.13 and later, where TFO is enabled by default.
62
63=item * Linux kernel 4.11 and later, using TCP_FASTOPEN_CONNECT.
64
65=item * FreeBSD 10.3 to 11.4, supports server TFO only.
66
67=item * FreeBSD 12.0 and later, supports both client and server TFO.
68
69=item * macOS 10.14 and later.
70
71=back
72
73Each operating system has a slightly different API for TFO. Please
74refer to the operating systems' API documentation when using
75sockets directly.
76
cda77422 77=head1 EXAMPLES
53934822
RS
78
79Create a memory BIO:
80
81 BIO *mem = BIO_new(BIO_s_mem());
82
47770c4d
DSH
83=head1 SEE ALSO
84
9b86974e
RS
85L<BIO_ctrl(3)>,
86L<BIO_f_base64(3)>, L<BIO_f_buffer(3)>,
87L<BIO_f_cipher(3)>, L<BIO_f_md(3)>,
88L<BIO_f_null(3)>, L<BIO_f_ssl(3)>,
a30823c8 89L<BIO_f_readbuffer(3)>,
a3e53d56
TS
90L<BIO_find_type(3)>,
91L<BIO_get_conn_mode(3)>,
92L<BIO_new(3)>,
9b86974e 93L<BIO_new_bio_pair(3)>,
b055fceb 94L<BIO_push(3)>, L<BIO_read_ex(3)>,
9b86974e
RS
95L<BIO_s_accept(3)>, L<BIO_s_bio(3)>,
96L<BIO_s_connect(3)>, L<BIO_s_fd(3)>,
97L<BIO_s_file(3)>, L<BIO_s_mem(3)>,
9b86974e
RS
98L<BIO_s_null(3)>, L<BIO_s_socket(3)>,
99L<BIO_set_callback(3)>,
a3e53d56
TS
100L<BIO_set_conn_mode(3)>,
101L<BIO_set_tfo(3)>,
102L<BIO_set_tfo_accept(3)>,
9b86974e 103L<BIO_should_retry(3)>
99ec4fdb 104
e2f92610
RS
105=head1 COPYRIGHT
106
fecb3aae 107Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 108
3187791e 109Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
110this file except in compliance with the License. You can obtain a copy
111in the file LICENSE in the source distribution or at
112L<https://www.openssl.org/source/license.html>.
113
114=cut