summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/BIO_new.3
diff options
context:
space:
mode:
authorschwarze <>2016-12-06 12:54:19 +0000
committerschwarze <>2016-12-06 12:54:19 +0000
commit3472b6f5a290febbe7727d2886dce3ddeb0798e4 (patch)
treeff8829e73684df79b569988da2fa0850acaa867f /src/lib/libcrypto/man/BIO_new.3
parenteea7454d5f0937c3ffb6642ac5b1ba135b172e29 (diff)
downloadopenbsd-3472b6f5a290febbe7727d2886dce3ddeb0798e4.tar.gz
openbsd-3472b6f5a290febbe7727d2886dce3ddeb0798e4.tar.bz2
openbsd-3472b6f5a290febbe7727d2886dce3ddeb0798e4.zip
We don't want section 3 manual pages with names that do not correspond
to functions, so delete the BIO(3) manual page and merge its content into BIO_new(3) and BIO_push(3). Sort the content of BIO_new(3) into a logical order and improve the wording in various ways. Add the required cross references to BIO_push(3).
Diffstat (limited to 'src/lib/libcrypto/man/BIO_new.3')
-rw-r--r--src/lib/libcrypto/man/BIO_new.3131
1 files changed, 89 insertions, 42 deletions
diff --git a/src/lib/libcrypto/man/BIO_new.3 b/src/lib/libcrypto/man/BIO_new.3
index 59a5b37056..654f4e844a 100644
--- a/src/lib/libcrypto/man/BIO_new.3
+++ b/src/lib/libcrypto/man/BIO_new.3
@@ -1,5 +1,6 @@
1.\" $OpenBSD: BIO_new.3,v 1.5 2016/11/18 18:43:05 schwarze Exp $ 1.\" $OpenBSD: BIO_new.3,v 1.6 2016/12/06 12:54:19 schwarze Exp $
2.\" OpenSSL ca3a82c3 Mar 25 11:31:18 2015 -0400 2.\" OpenSSL doc/man3/BIO_new.pod ca3a82c3 Mar 25 11:31:18 2015 -0400
3.\" OpenSSL doc/man7/bio.pod a9c85cea Nov 11 09:33:55 2016 +0100
3.\" 4.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 5.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2000, 2015, 2016 The OpenSSL Project. All rights reserved. 6.\" Copyright (c) 2000, 2015, 2016 The OpenSSL Project. All rights reserved.
@@ -48,7 +49,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 51.\"
51.Dd $Mdocdate: November 18 2016 $ 52.Dd $Mdocdate: December 6 2016 $
52.Dt BIO_NEW 3 53.Dt BIO_NEW 3
53.Os 54.Os
54.Sh NAME 55.Sh NAME
@@ -57,7 +58,7 @@
57.Nm BIO_free , 58.Nm BIO_free ,
58.Nm BIO_vfree , 59.Nm BIO_vfree ,
59.Nm BIO_free_all 60.Nm BIO_free_all
60.Nd BIO allocation and freeing functions 61.Nd construct and destruct I/O abstraction objects
61.Sh SYNOPSIS 62.Sh SYNOPSIS
62.In openssl/bio.h 63.In openssl/bio.h
63.Ft BIO * 64.Ft BIO *
@@ -82,78 +83,124 @@
82.Fa "BIO *a" 83.Fa "BIO *a"
83.Fc 84.Fc
84.Sh DESCRIPTION 85.Sh DESCRIPTION
86A
87.Vt BIO
88is an I/O abstraction object, hiding many of the underlying I/O
89details from an application.
90If an application uses BIOs for its I/O, it can transparently handle
91SSL connections, unencrypted network connections, and file I/O.
92.Pp
85The 93The
86.Fn BIO_new 94.Fn BIO_new
87function returns a new BIO using method 95function constructs a new
96.Vt BIO
97using the method
88.Fa type . 98.Fa type .
99There are two groups of BIO types, source/sink BIOs and a filter BIOs.
100.Pp
101Source/sink BIOs provide input or consume output.
102Examples include socket BIOs and file BIOs.
103.Pp
104Filter BIOs take data from one BIO and pass it through to another,
105or to the application, forming a chain of BIOs.
106The data may be left unmodified (for example by a message digest BIO)
107or translated (for example by an encryption BIO).
108The effect of a filter BIO may change according to the I/O operation
109it is performing: for example an encryption BIO will encrypt data
110if it is written to and decrypt data if it is read from.
111.Pp
112Some BIOs (such as memory BIOs) can be used immediately after calling
113.Fn BIO_new .
114Others (such as file BIOs) need some additional initialization, and
115utility functions exists to construct and initialize such BIOs.
116.Pp
117Normally the
118.Fa type
119argument is supplied by a function which returns a pointer to a
120.Vt BIO_METHOD .
121There is a naming convention for such functions:
122the methods for source/sink BIOs are called
123.Fn BIO_s_*
124and those for filter BIOs
125.Fn BIO_f_* .
89.Pp 126.Pp
90.Fn BIO_set 127.Fn BIO_set
91sets the method of an already existing BIO. 128sets the method of an already existing BIO.
92.Pp 129.Pp
93.Fn BIO_free 130.Fn BIO_free
94frees up a single BIO; 131and
95.Fn BIO_vfree 132.Fn BIO_vfree
96also frees up a single BIO, but it does not return a value. 133destruct a single BIO, which may also have some effect on the
134underlying I/O structure, for example it may close the file being
135referred to under certain circumstances.
97If 136If
98.Fa a 137.Fa a
99is a 138is a
100.Dv NULL 139.Dv NULL
101pointer, no action occurs. 140pointer, no action occurs.
102Calling 141If
103.Fn BIO_free 142.Fn BIO_free
104may also have some effect on the underlying I/O structure, 143is called on a BIO chain, it will only destruct one BIO,
105for example it may close the file being 144resulting in a memory leak.
106referred to under certain circumstances.
107For more details see the individual
108.Vt BIO_METHOD
109descriptions.
110.Pp 145.Pp
111.Fn BIO_free_all 146.Fn BIO_free_all
112frees up an entire BIO chain. 147destructs an entire BIO chain.
113It does not halt if an error occurs 148It does not halt if an error occurs
114freeing up an individual BIO in the chain. 149destructing an individual BIO in the chain.
115If 150If
116.Fa a 151.Fa a
117is a 152is a
118.Dv NULL 153.Dv NULL
119pointer, no action occurs. 154pointer, no action occurs.
120.Pp
121Some BIOs (such as memory BIOs) can be used immediately after calling
122.Fn BIO_new .
123Others (such as file BIOs) need some additional initialization, and
124frequently a utility function exists to create and initialize such BIOs.
125.Pp
126If
127.Fn BIO_free
128is called on a BIO chain, it will only free one BIO,
129resulting in a memory leak.
130.Pp
131Calling 155Calling
132.Fn BIO_free_all 156.Fn BIO_free_all
133on a single BIO has the same effect as calling 157on a single BIO has the same effect as
134.Fn BIO_free 158.Fn BIO_vfree .
135on it other than the discarded return value.
136.Pp 159.Pp
137Normally the 160Common I/O functions are documented in
138.Fa type 161.Xr BIO_read 3 .
139argument is supplied by a function which returns a pointer to a 162Forming chains is explained in
140.Vt BIO_METHOD . 163.Xr BIO_push 3 ,
141There is a naming convention for such functions: 164inspecting them in
142a source/sink BIO is normally called 165.Xr BIO_find_type 3 .
143.Fn BIO_s_* 166For more details about the different kinds of BIOs, see the individual
144and a filter BIO 167.Vt BIO_METHOD
145.Fn BIO_f_* . 168manual pages.
146.Sh RETURN VALUES 169.Sh RETURN VALUES
147.Fn BIO_new 170.Fn BIO_new
148returns a newly created BIO or 171returns a newly constructed
172.Vt BIO
173object or
149.Dv NULL 174.Dv NULL
150if the call fails. 175on failure.
151.Pp 176.Pp
152.Fn BIO_set 177.Fn BIO_set
153and 178and
154.Fn BIO_free 179.Fn BIO_free
155return 1 for success and 0 for failure. 180return 1 for success or 0 for failure.
156.Sh EXAMPLES 181.Sh EXAMPLES
157Create a memory BIO: 182Create a memory BIO:
158.Pp 183.Pp
159.Dl BIO *mem = BIO_new(BIO_s_mem()); 184.Dl BIO *mem = BIO_new(BIO_s_mem());
185.Sh SEE ALSO
186.Xr BIO_ctrl 3 ,
187.Xr BIO_f_base64 3 ,
188.Xr BIO_f_buffer 3 ,
189.Xr BIO_f_cipher 3 ,
190.Xr BIO_f_md 3 ,
191.Xr BIO_f_null 3 ,
192.Xr BIO_f_ssl 3 ,
193.Xr BIO_get_ex_new_index.3 ,
194.Xr BIO_find_type 3 ,
195.Xr BIO_push 3 ,
196.Xr BIO_read 3 ,
197.Xr BIO_s_accept 3 ,
198.Xr BIO_s_bio 3 ,
199.Xr BIO_s_connect 3 ,
200.Xr BIO_s_fd 3 ,
201.Xr BIO_s_file 3 ,
202.Xr BIO_s_mem 3 ,
203.Xr BIO_s_null 3 ,
204.Xr BIO_s_socket 3 ,
205.Xr BIO_set_callback 3 ,
206.Xr BIO_should_retry 3