summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2018-02-24 19:17:10 +0000
committerschwarze <>2018-02-24 19:17:10 +0000
commit04c35f519b79459878122196d79ac349c1cde600 (patch)
tree368a375b4bba9d7f6269ad8fd045cf7849c99a6e
parentcf66d3f302f879e277f51c4243285fa853b21f46 (diff)
downloadopenbsd-04c35f519b79459878122196d79ac349c1cde600.tar.gz
openbsd-04c35f519b79459878122196d79ac349c1cde600.tar.bz2
openbsd-04c35f519b79459878122196d79ac349c1cde600.zip
In bio.h rev. 1.39 2018/02/22 16:38:43, jsing@ provided BIO_up_ref(3).
Merge the documentation from OpenSSL, tweaked by me. While here, fix the in parts imprecise, in parts incorrect descriptions of BIO_new(3), BIO_set(3), BIO_free(3), and BIO_free_all(3).
-rw-r--r--src/lib/libcrypto/man/BIO_new.369
1 files changed, 57 insertions, 12 deletions
diff --git a/src/lib/libcrypto/man/BIO_new.3 b/src/lib/libcrypto/man/BIO_new.3
index cdf15278bf..8ee1bafce0 100644
--- a/src/lib/libcrypto/man/BIO_new.3
+++ b/src/lib/libcrypto/man/BIO_new.3
@@ -1,6 +1,9 @@
1.\" $OpenBSD: BIO_new.3,v 1.9 2018/02/17 23:24:38 schwarze Exp $ 1.\" $OpenBSD: BIO_new.3,v 1.10 2018/02/24 19:17:10 schwarze Exp $
2.\" OpenSSL doc/man3/BIO_new.pod ca3a82c3 Mar 25 11:31:18 2015 -0400 2.\" full merge up to:
3.\" OpenSSL doc/man7/bio.pod a9c85cea Nov 11 09:33:55 2016 +0100 3.\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000
4.\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100
5.\" partial merge up to:
6.\" OpenSSL man3/BIO_new.pod e9b77246 Jan 20 19:58:49 2017 +0100
4.\" 7.\"
5.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 8.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
6.\" Copyright (c) 2000, 2015, 2016 The OpenSSL Project. All rights reserved. 9.\" Copyright (c) 2000, 2015, 2016 The OpenSSL Project. All rights reserved.
@@ -49,11 +52,12 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 53.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 54.\"
52.Dd $Mdocdate: February 17 2018 $ 55.Dd $Mdocdate: February 24 2018 $
53.Dt BIO_NEW 3 56.Dt BIO_NEW 3
54.Os 57.Os
55.Sh NAME 58.Sh NAME
56.Nm BIO_new , 59.Nm BIO_new ,
60.Nm BIO_up_ref ,
57.Nm BIO_set , 61.Nm BIO_set ,
58.Nm BIO_free , 62.Nm BIO_free ,
59.Nm BIO_vfree , 63.Nm BIO_vfree ,
@@ -66,6 +70,10 @@
66.Fa "BIO_METHOD *type" 70.Fa "BIO_METHOD *type"
67.Fc 71.Fc
68.Ft int 72.Ft int
73.Fo BIO_up_ref
74.Fa "BIO *a"
75.Fc
76.Ft int
69.Fo BIO_set 77.Fo BIO_set
70.Fa "BIO *a" 78.Fa "BIO *a"
71.Fa "BIO_METHOD *type" 79.Fa "BIO_METHOD *type"
@@ -95,7 +103,8 @@ The
95function constructs a new 103function constructs a new
96.Vt BIO 104.Vt BIO
97using the method 105using the method
98.Fa type . 106.Fa type
107and sets its reference count to 1.
99There are two groups of BIO types, source/sink BIOs and filter BIOs. 108There are two groups of BIO types, source/sink BIOs and filter BIOs.
100.Pp 109.Pp
101Source/sink BIOs provide input or consume output. 110Source/sink BIOs provide input or consume output.
@@ -106,8 +115,8 @@ or to the application, forming a chain of BIOs.
106The data may be left unmodified (for example by a message digest BIO) 115The data may be left unmodified (for example by a message digest BIO)
107or translated (for example by an encryption BIO). 116or translated (for example by an encryption BIO).
108The effect of a filter BIO may change according to the I/O operation 117The effect of a filter BIO may change according to the I/O operation
109it is performing: for example an encryption BIO will encrypt data 118it is performing: for example an encryption BIO encrypts data
110if it is written to and decrypt data if it is read from. 119if it is written to and decrypts data if it is read from.
111.Pp 120.Pp
112Some BIOs (such as memory BIOs) can be used immediately after calling 121Some BIOs (such as memory BIOs) can be used immediately after calling
113.Fn BIO_new . 122.Fn BIO_new .
@@ -124,13 +133,33 @@ the methods for source/sink BIOs are called
124and those for filter BIOs 133and those for filter BIOs
125.Fn BIO_f_* . 134.Fn BIO_f_* .
126.Pp 135.Pp
136.Fn BIO_up_ref
137increments the reference count of
138.Fa a
139by 1.
140.Pp
127.Fn BIO_set 141.Fn BIO_set
128sets the method of an already existing BIO. 142is a deprecated function to initialize an unused
143.Vt BIO
144structure located in static memory or on the stack,
145to set its method to
146.Fa type ,
147and to set its reference count to 1.
148It must not be called on
149.Vt BIO
150objects created with
151.Fn BIO_new ,
152nor on objects that were already used.
129.Pp 153.Pp
130.Fn BIO_free 154.Fn BIO_free
131and 155and
132.Fn BIO_vfree 156.Fn BIO_vfree
133destruct a single BIO, which may also have some effect on the 157decrement the reference count of
158.Fa a
159by 1, and if the refenece count reaches 0, they destruct the single
160.Vt BIO
161.Fa a ,
162which may also have some effect on the
134underlying I/O structure, for example it may close the file being 163underlying I/O structure, for example it may close the file being
135referred to under certain circumstances. 164referred to under certain circumstances.
136If 165If
@@ -140,11 +169,26 @@ is a
140pointer, no action occurs. 169pointer, no action occurs.
141If 170If
142.Fn BIO_free 171.Fn BIO_free
143is called on a BIO chain, it will only destruct one BIO, 172is called on a BIO chain, it destructs at most one BIO,
144resulting in a memory leak. 173resulting in a memory leak.
145.Pp 174.Pp
146.Fn BIO_free_all 175.Fn BIO_free_all
147destructs an entire BIO chain. 176calls
177.Fn BIO_free
178on
179.Fa a
180and on all following
181.Vt BIO
182objects in the chain.
183As soon as the reference count of a
184.Vt BIO
185is still non-zero after calling
186.Fn BIO_free
187on it, the function
188.Fn BIO_free_all
189returns right away and refrains from freeing the remaining
190.Vt BIO
191objects in the chain.
148It does not halt if an error occurs 192It does not halt if an error occurs
149destructing an individual BIO in the chain. 193destructing an individual BIO in the chain.
150If 194If
@@ -174,7 +218,8 @@ object or
174.Dv NULL 218.Dv NULL
175on failure. 219on failure.
176.Pp 220.Pp
177.Fn BIO_set 221.Fn BIO_up_ref ,
222.Fn BIO_set ,
178and 223and
179.Fn BIO_free 224.Fn BIO_free
180return 1 for success or 0 for failure. 225return 1 for success or 0 for failure.