diff options
author | schwarze <> | 2022-12-06 21:13:01 +0000 |
---|---|---|
committer | schwarze <> | 2022-12-06 21:13:01 +0000 |
commit | 53ea15dc27b37f5c0f0871e7395738e8c0793a24 (patch) | |
tree | e1e299d403c5a12c3079a3c1165dbaa8a5b4f83f /src/lib | |
parent | 25379fab64d0e4e97e49ce782d1f7239af8a6192 (diff) | |
download | openbsd-53ea15dc27b37f5c0f0871e7395738e8c0793a24.tar.gz openbsd-53ea15dc27b37f5c0f0871e7395738e8c0793a24.tar.bz2 openbsd-53ea15dc27b37f5c0f0871e7395738e8c0793a24.zip |
Major rewrite for accuracy and clarity, and document BIO_set_next(3).
Feedback and OK tb@.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/man/BIO_push.3 | 185 |
1 files changed, 148 insertions, 37 deletions
diff --git a/src/lib/libcrypto/man/BIO_push.3 b/src/lib/libcrypto/man/BIO_push.3 index e757d6de67..aa0c3115a9 100644 --- a/src/lib/libcrypto/man/BIO_push.3 +++ b/src/lib/libcrypto/man/BIO_push.3 | |||
@@ -1,8 +1,26 @@ | |||
1 | .\" $OpenBSD: BIO_push.3,v 1.8 2022/12/02 22:58:56 tb Exp $ | 1 | .\" $OpenBSD: BIO_push.3,v 1.9 2022/12/06 21:13:01 schwarze Exp $ |
2 | .\" OpenSSL doc/man3/BIO_push.pod 76ed5a42 Jun 29 13:38:55 2014 +0100 | 2 | .\" full merge up to: |
3 | .\" OpenSSL doc/man7/bio.pod a9c85cea Nov 11 09:33:55 2016 +0100 | 3 | .\" OpenSSL doc/man3/BIO_push.pod 791bfd91 Nov 19 20:38:27 2021 +0100 |
4 | .\" OpenSSL doc/man7/bio.pod 1cb7eff4 Sep 10 13:56:40 2019 +0100 | ||
4 | .\" | 5 | .\" |
5 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 6 | .\" This file is a derived work. |
7 | .\" The changes are covered by the following Copyright and license: | ||
8 | .\" | ||
9 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | ||
10 | .\" | ||
11 | .\" Permission to use, copy, modify, and distribute this software for any | ||
12 | .\" purpose with or without fee is hereby granted, provided that the above | ||
13 | .\" copyright notice and this permission notice appear in all copies. | ||
14 | .\" | ||
15 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
16 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
17 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
18 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
19 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
20 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
21 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
22 | .\" | ||
23 | .\" The original file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
6 | .\" Copyright (c) 2000, 2014 The OpenSSL Project. All rights reserved. | 24 | .\" Copyright (c) 2000, 2014 The OpenSSL Project. All rights reserved. |
7 | .\" | 25 | .\" |
8 | .\" Redistribution and use in source and binary forms, with or without | 26 | .\" Redistribution and use in source and binary forms, with or without |
@@ -49,75 +67,163 @@ | |||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
51 | .\" | 69 | .\" |
52 | .Dd $Mdocdate: December 2 2022 $ | 70 | .Dd $Mdocdate: December 6 2022 $ |
53 | .Dt BIO_PUSH 3 | 71 | .Dt BIO_PUSH 3 |
54 | .Os | 72 | .Os |
55 | .Sh NAME | 73 | .Sh NAME |
56 | .Nm BIO_push , | 74 | .Nm BIO_push , |
57 | .Nm BIO_pop | 75 | .Nm BIO_pop , |
58 | .Nd add and remove BIOs from a chain | 76 | .Nm BIO_set_next |
77 | .Nd manipulate BIO chains | ||
59 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
60 | .In openssl/bio.h | 79 | .In openssl/bio.h |
61 | .Ft BIO * | 80 | .Ft BIO * |
62 | .Fo BIO_push | 81 | .Fo BIO_push |
63 | .Fa "BIO *b" | 82 | .Fa "BIO *b" |
64 | .Fa "BIO *append" | 83 | .Fa "BIO *new_tail" |
65 | .Fc | 84 | .Fc |
66 | .Ft BIO * | 85 | .Ft BIO * |
67 | .Fo BIO_pop | 86 | .Fo BIO_pop |
68 | .Fa "BIO *b" | 87 | .Fa "BIO *b" |
69 | .Fc | 88 | .Fc |
89 | .Ft void | ||
90 | .Fo BIO_set_next | ||
91 | .Fa "BIO *b" | ||
92 | .Fa "BIO *new_tail" | ||
93 | .Fc | ||
70 | .Sh DESCRIPTION | 94 | .Sh DESCRIPTION |
71 | BIOs can be joined together to form chains. | 95 | BIOs can be joined together to form chains. |
72 | A chain normally consists of one or more filter BIOs | 96 | A chain normally consists of one or more filter BIOs |
73 | and one source/sink BIO at the end. | 97 | and one source/sink BIO at the end. |
74 | Data read from or written to the first BIO traverses the chain | 98 | Data read from or written to the first BIO traverses the chain |
75 | to the end. | 99 | to the end. |
76 | A single BIO can be regarded as a chain with one component. | ||
77 | .Pp | 100 | .Pp |
78 | The | 101 | Every BIO is a member of exactly one chain. |
102 | It is either at the beginning of its chain | ||
103 | or there is exactly one preceding BIO. | ||
104 | It is either at the end of its chain | ||
105 | or there is exactly one following BIO. | ||
106 | If there is neither a preceding nor a following BIO, | ||
107 | it can be regarded as a chain with one member. | ||
108 | .Pp | ||
79 | .Fn BIO_push | 109 | .Fn BIO_push |
80 | function appends the BIO | 110 | appends the chain starting at |
81 | .Fa append | 111 | .Fa new_tail |
82 | to | 112 | to the end of the chain that contains |
83 | .Fa b | ||
84 | and returns | ||
85 | .Fa b . | 113 | .Fa b . |
114 | Unless | ||
115 | .Fa b | ||
116 | is | ||
117 | .Dv NULL , | ||
118 | it then calls | ||
119 | .Xr BIO_ctrl 3 | ||
120 | on | ||
121 | .Fa b | ||
122 | with an argument of | ||
123 | .Dv BIO_CTRL_PUSH . | ||
124 | If | ||
125 | .Fa b | ||
126 | or | ||
127 | .Fa new_tail | ||
128 | is | ||
129 | .Dv NULL , | ||
130 | nothing is appended. | ||
131 | .Pp | ||
132 | In LibreSSL, if | ||
133 | .Fa new_tail | ||
134 | is not at the beginning of its chain, | ||
135 | the head of that chain up to but not including | ||
136 | .Fa new_tail | ||
137 | is cut off and becomes a separate chain. | ||
138 | For portability, it is best to make sure that | ||
139 | .Fa new_tail | ||
140 | is at the beginning of its chain before calling | ||
141 | .Fn BIO_push . | ||
86 | .Pp | 142 | .Pp |
87 | .Fn BIO_pop | 143 | .Fn BIO_pop |
88 | removes the BIO | 144 | removes the BIO |
89 | .Fa b | 145 | .Fa b |
90 | from a chain and returns the next BIO in the chain, or | 146 | from its chain. |
91 | .Dv NULL | 147 | Despite the word |
92 | if there is no next BIO. | 148 | .Dq pop |
93 | The removed BIO then becomes a single BIO with no association with the | 149 | in the function name, |
94 | original chain. | 150 | .Fa b |
95 | It can thus be freed or attached to a different chain. | 151 | can be at the beginning, in the middle, or at the end of its chain. |
152 | Before removal, | ||
153 | .Xr BIO_ctrl 3 | ||
154 | is called on | ||
155 | .Fa b | ||
156 | with an argument of | ||
157 | .Dv BIO_CTRL_POP . | ||
158 | The removed BIO | ||
159 | .Fa b | ||
160 | becomes the only member of its own chain and can thus be freed | ||
161 | or attached to a different chain. | ||
162 | If | ||
163 | .Fa b | ||
164 | is | ||
165 | .Dv NULL , | ||
166 | no action occurs. | ||
96 | .Pp | 167 | .Pp |
97 | The names of these functions are misleading. | 168 | .Fn BIO_set_next |
98 | .Fn BIO_push | 169 | appends the chain starting with |
99 | joins two BIO chains whereas | 170 | .Fa new_tail |
100 | .Fn BIO_pop | 171 | to the chain ending with |
101 | deletes a single BIO from a chain; | 172 | .Fa b . |
102 | the deleted BIO does not need to be at the end of a chain. | ||
103 | .Pp | 173 | .Pp |
104 | The process of calling | 174 | In LibreSSL, if |
105 | .Fn BIO_push | 175 | .Fa new_tail |
106 | and | 176 | is not at the beginning of its chain, |
177 | the head of that chain up to but not including | ||
178 | .Fa new_tail | ||
179 | is cut off and becomes a separate chain, | ||
180 | and if | ||
181 | .Fa b | ||
182 | is not at the end of its chain, | ||
183 | the tail of that chain starting after | ||
184 | .Fa b | ||
185 | is cut off and becomes a separate chain, | ||
186 | .Pp | ||
187 | For portability, it is best to make sure that | ||
188 | .Fa b | ||
189 | is at the end of its chain and that | ||
190 | .Fa new_tail | ||
191 | is at the beginning of its chain before calling | ||
192 | .Fn BIO_set_next | ||
193 | and to avoid calling | ||
107 | .Fn BIO_pop | 194 | .Fn BIO_pop |
108 | on a BIO may have additional consequences: a | 195 | on |
196 | .Fa new_tail | ||
197 | afterwards. | ||
198 | .Pp | ||
199 | In LibreSSL, the only built-in BIO type for which | ||
109 | .Xr BIO_ctrl 3 | 200 | .Xr BIO_ctrl 3 |
110 | call is made to the affected BIOs. | 201 | calls with an argument of |
111 | Any effects will be noted in the descriptions of individual BIOs. | 202 | .Dv BIO_CTRL_PUSH |
203 | or | ||
204 | .Dv BIO_CTRL_POP | ||
205 | have any effect is | ||
206 | .Xr BIO_f_ssl 3 . | ||
112 | .Sh RETURN VALUES | 207 | .Sh RETURN VALUES |
113 | .Fn BIO_push | 208 | .Fn BIO_push |
114 | returns the beginning of the chain, | 209 | returns |
115 | .Fa b . | 210 | .Fa b |
211 | if it is not | ||
212 | .Dv NULL | ||
213 | or | ||
214 | .Fa new_tail | ||
215 | if it is. | ||
116 | .Pp | 216 | .Pp |
117 | .Fn BIO_pop | 217 | .Fn BIO_pop |
118 | returns the next BIO in the chain, or | 218 | returns the BIO that followed |
219 | .Fa b | ||
220 | in its chain, or | ||
221 | .Dv NULL | ||
222 | if | ||
223 | .Fa b | ||
224 | is | ||
119 | .Dv NULL | 225 | .Dv NULL |
120 | if there is no next BIO. | 226 | or was at the end of its chain. |
121 | .Sh EXAMPLES | 227 | .Sh EXAMPLES |
122 | For these examples suppose | 228 | For these examples suppose |
123 | .Sy md1 | 229 | .Sy md1 |
@@ -183,3 +289,8 @@ first appeared in SSLeay 0.6.0. | |||
183 | first appeared in SSLeay 0.6.4. | 289 | first appeared in SSLeay 0.6.4. |
184 | Both functions have been available since | 290 | Both functions have been available since |
185 | .Ox 2.4 . | 291 | .Ox 2.4 . |
292 | .Pp | ||
293 | .Fn BIO_set_next | ||
294 | first appeared in OpenSSL 1.1.0 | ||
295 | and has been available since | ||
296 | .Ox 7.1 . | ||