diff options
author | schwarze <> | 2018-02-24 19:17:10 +0000 |
---|---|---|
committer | schwarze <> | 2018-02-24 19:17:10 +0000 |
commit | 04c35f519b79459878122196d79ac349c1cde600 (patch) | |
tree | 368a375b4bba9d7f6269ad8fd045cf7849c99a6e | |
parent | cf66d3f302f879e277f51c4243285fa853b21f46 (diff) | |
download | openbsd-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.3 | 69 |
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 | |||
95 | function constructs a new | 103 | function constructs a new |
96 | .Vt BIO | 104 | .Vt BIO |
97 | using the method | 105 | using the method |
98 | .Fa type . | 106 | .Fa type |
107 | and sets its reference count to 1. | ||
99 | There are two groups of BIO types, source/sink BIOs and filter BIOs. | 108 | There are two groups of BIO types, source/sink BIOs and filter BIOs. |
100 | .Pp | 109 | .Pp |
101 | Source/sink BIOs provide input or consume output. | 110 | Source/sink BIOs provide input or consume output. |
@@ -106,8 +115,8 @@ or to the application, forming a chain of BIOs. | |||
106 | The data may be left unmodified (for example by a message digest BIO) | 115 | The data may be left unmodified (for example by a message digest BIO) |
107 | or translated (for example by an encryption BIO). | 116 | or translated (for example by an encryption BIO). |
108 | The effect of a filter BIO may change according to the I/O operation | 117 | The effect of a filter BIO may change according to the I/O operation |
109 | it is performing: for example an encryption BIO will encrypt data | 118 | it is performing: for example an encryption BIO encrypts data |
110 | if it is written to and decrypt data if it is read from. | 119 | if it is written to and decrypts data if it is read from. |
111 | .Pp | 120 | .Pp |
112 | Some BIOs (such as memory BIOs) can be used immediately after calling | 121 | Some 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 | |||
124 | and those for filter BIOs | 133 | and those for filter BIOs |
125 | .Fn BIO_f_* . | 134 | .Fn BIO_f_* . |
126 | .Pp | 135 | .Pp |
136 | .Fn BIO_up_ref | ||
137 | increments the reference count of | ||
138 | .Fa a | ||
139 | by 1. | ||
140 | .Pp | ||
127 | .Fn BIO_set | 141 | .Fn BIO_set |
128 | sets the method of an already existing BIO. | 142 | is a deprecated function to initialize an unused |
143 | .Vt BIO | ||
144 | structure located in static memory or on the stack, | ||
145 | to set its method to | ||
146 | .Fa type , | ||
147 | and to set its reference count to 1. | ||
148 | It must not be called on | ||
149 | .Vt BIO | ||
150 | objects created with | ||
151 | .Fn BIO_new , | ||
152 | nor on objects that were already used. | ||
129 | .Pp | 153 | .Pp |
130 | .Fn BIO_free | 154 | .Fn BIO_free |
131 | and | 155 | and |
132 | .Fn BIO_vfree | 156 | .Fn BIO_vfree |
133 | destruct a single BIO, which may also have some effect on the | 157 | decrement the reference count of |
158 | .Fa a | ||
159 | by 1, and if the refenece count reaches 0, they destruct the single | ||
160 | .Vt BIO | ||
161 | .Fa a , | ||
162 | which may also have some effect on the | ||
134 | underlying I/O structure, for example it may close the file being | 163 | underlying I/O structure, for example it may close the file being |
135 | referred to under certain circumstances. | 164 | referred to under certain circumstances. |
136 | If | 165 | If |
@@ -140,11 +169,26 @@ is a | |||
140 | pointer, no action occurs. | 169 | pointer, no action occurs. |
141 | If | 170 | If |
142 | .Fn BIO_free | 171 | .Fn BIO_free |
143 | is called on a BIO chain, it will only destruct one BIO, | 172 | is called on a BIO chain, it destructs at most one BIO, |
144 | resulting in a memory leak. | 173 | resulting in a memory leak. |
145 | .Pp | 174 | .Pp |
146 | .Fn BIO_free_all | 175 | .Fn BIO_free_all |
147 | destructs an entire BIO chain. | 176 | calls |
177 | .Fn BIO_free | ||
178 | on | ||
179 | .Fa a | ||
180 | and on all following | ||
181 | .Vt BIO | ||
182 | objects in the chain. | ||
183 | As soon as the reference count of a | ||
184 | .Vt BIO | ||
185 | is still non-zero after calling | ||
186 | .Fn BIO_free | ||
187 | on it, the function | ||
188 | .Fn BIO_free_all | ||
189 | returns right away and refrains from freeing the remaining | ||
190 | .Vt BIO | ||
191 | objects in the chain. | ||
148 | It does not halt if an error occurs | 192 | It does not halt if an error occurs |
149 | destructing an individual BIO in the chain. | 193 | destructing an individual BIO in the chain. |
150 | If | 194 | If |
@@ -174,7 +218,8 @@ object or | |||
174 | .Dv NULL | 218 | .Dv NULL |
175 | on failure. | 219 | on failure. |
176 | .Pp | 220 | .Pp |
177 | .Fn BIO_set | 221 | .Fn BIO_up_ref , |
222 | .Fn BIO_set , | ||
178 | and | 223 | and |
179 | .Fn BIO_free | 224 | .Fn BIO_free |
180 | return 1 for success or 0 for failure. | 225 | return 1 for success or 0 for failure. |