diff options
author | schwarze <> | 2023-04-04 17:10:37 +0000 |
---|---|---|
committer | schwarze <> | 2023-04-04 17:10:37 +0000 |
commit | a842b1fc304364a2fcb5f261f0682291b3ff3dcc (patch) | |
tree | 40f12bb0ea20f91d29a7be9c4d87bdb87f9a1875 /src/lib | |
parent | d953e42079697b91918dd0ba43dc0d5ccbed414a (diff) | |
download | openbsd-a842b1fc304364a2fcb5f261f0682291b3ff3dcc.tar.gz openbsd-a842b1fc304364a2fcb5f261f0682291b3ff3dcc.tar.bz2 openbsd-a842b1fc304364a2fcb5f261f0682291b3ff3dcc.zip |
In preparation for better documenting BIO info callbacks, improve the
description of BIO_ctrl(3) and its three siblings. Given the vast range
of effects these functions can have, the text is unavoidably still
vague, but at least some information can be provided.
While here, fix one wrong parameter type and three inconsistent
parameter names in the SYNOPSIS.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/man/BIO_ctrl.3 | 124 |
1 files changed, 115 insertions, 9 deletions
diff --git a/src/lib/libcrypto/man/BIO_ctrl.3 b/src/lib/libcrypto/man/BIO_ctrl.3 index 762d45a5ed..a5c181307e 100644 --- a/src/lib/libcrypto/man/BIO_ctrl.3 +++ b/src/lib/libcrypto/man/BIO_ctrl.3 | |||
@@ -1,7 +1,25 @@ | |||
1 | .\" $OpenBSD: BIO_ctrl.3,v 1.16 2022/08/18 18:42:13 tb Exp $ | 1 | .\" $OpenBSD: BIO_ctrl.3,v 1.17 2023/04/04 17:10:37 schwarze Exp $ |
2 | .\" OpenSSL b055fceb Thu Oct 20 09:56:18 2016 +0100 | 2 | .\" full merge up to: OpenSSL 24a535eaf Tue Sep 22 13:14:20 2020 +0100 |
3 | .\" selective merge up to: OpenSSL 0c5bc96f Tue Mar 15 13:57:22 2022 +0000 | ||
3 | .\" | 4 | .\" |
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 5 | .\" This file is a derived work. |
6 | .\" The changes are covered by the following Copyright and license: | ||
7 | .\" | ||
8 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> | ||
9 | .\" | ||
10 | .\" Permission to use, copy, modify, and distribute this software for any | ||
11 | .\" purpose with or without fee is hereby granted, provided that the above | ||
12 | .\" copyright notice and this permission notice appear in all copies. | ||
13 | .\" | ||
14 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
15 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
16 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
17 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
18 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
19 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
20 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
21 | .\" | ||
22 | .\" The original file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
5 | .\" Copyright (c) 2000, 2016 The OpenSSL Project. All rights reserved. | 23 | .\" Copyright (c) 2000, 2016 The OpenSSL Project. All rights reserved. |
6 | .\" | 24 | .\" |
7 | .\" Redistribution and use in source and binary forms, with or without | 25 | .\" Redistribution and use in source and binary forms, with or without |
@@ -48,7 +66,7 @@ | |||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
50 | .\" | 68 | .\" |
51 | .Dd $Mdocdate: August 18 2022 $ | 69 | .Dd $Mdocdate: April 4 2023 $ |
52 | .Dt BIO_CTRL 3 | 70 | .Dt BIO_CTRL 3 |
53 | .Os | 71 | .Os |
54 | .Sh NAME | 72 | .Sh NAME |
@@ -75,7 +93,7 @@ | |||
75 | .In openssl/bio.h | 93 | .In openssl/bio.h |
76 | .Ft long | 94 | .Ft long |
77 | .Fo BIO_ctrl | 95 | .Fo BIO_ctrl |
78 | .Fa "BIO *bp" | 96 | .Fa "BIO *b" |
79 | .Fa "int cmd" | 97 | .Fa "int cmd" |
80 | .Fa "long larg" | 98 | .Fa "long larg" |
81 | .Fa "void *parg" | 99 | .Fa "void *parg" |
@@ -84,17 +102,17 @@ | |||
84 | .Fo BIO_callback_ctrl | 102 | .Fo BIO_callback_ctrl |
85 | .Fa "BIO *b" | 103 | .Fa "BIO *b" |
86 | .Fa "int cmd" | 104 | .Fa "int cmd" |
87 | .Fa "BIO_info_cb cb" | 105 | .Fa "BIO_info_cb *cb" |
88 | .Fc | 106 | .Fc |
89 | .Ft char * | 107 | .Ft char * |
90 | .Fo BIO_ptr_ctrl | 108 | .Fo BIO_ptr_ctrl |
91 | .Fa "BIO *bp" | 109 | .Fa "BIO *b" |
92 | .Fa "int cmd" | 110 | .Fa "int cmd" |
93 | .Fa "long larg" | 111 | .Fa "long larg" |
94 | .Fc | 112 | .Fc |
95 | .Ft long | 113 | .Ft long |
96 | .Fo BIO_int_ctrl | 114 | .Fo BIO_int_ctrl |
97 | .Fa "BIO *bp" | 115 | .Fa "BIO *b" |
98 | .Fa "int cmd" | 116 | .Fa "int cmd" |
99 | .Fa "long larg" | 117 | .Fa "long larg" |
100 | .Fa "int iarg" | 118 | .Fa "int iarg" |
@@ -175,6 +193,54 @@ Macros specific to a particular type of BIO | |||
175 | are described in the specific BIO's manual page | 193 | are described in the specific BIO's manual page |
176 | as well as any special features of the standard calls. | 194 | as well as any special features of the standard calls. |
177 | .Pp | 195 | .Pp |
196 | Depending on the | ||
197 | .Fa cmd | ||
198 | and on the type of | ||
199 | .Fa b , | ||
200 | .Fn BIO_ctrl | ||
201 | may have a read-only effect on | ||
202 | .Fa b | ||
203 | or change data in | ||
204 | .Fa b | ||
205 | or in its sub-structures. | ||
206 | It may also have a side effect of changing the memory pointed to by | ||
207 | .Fa parg . | ||
208 | .Pp | ||
209 | .Fn BIO_callback_ctrl | ||
210 | does not call | ||
211 | .Fn BIO_ctrl | ||
212 | but instead requires that the BIO type of | ||
213 | .Fa b | ||
214 | provides a dedicated | ||
215 | .Fa callback_ctrl | ||
216 | function pointer, which is built into the library for some standard BIO | ||
217 | types and can be provided with | ||
218 | .Xr BIO_meth_set_callback_ctrl 3 | ||
219 | for application-defined BIO types. | ||
220 | .Pp | ||
221 | .Fn BIO_ptr_ctrl | ||
222 | calls | ||
223 | .Fn BIO_ctrl | ||
224 | with | ||
225 | .Fa parg | ||
226 | pointing to the location of a temporary pointer variable initialized to | ||
227 | .Dv NULL . | ||
228 | .Pp | ||
229 | .Fn BIO_int_ctrl | ||
230 | calls | ||
231 | .Fn BIO_ctrl | ||
232 | with | ||
233 | .Fa parg | ||
234 | pointing to the location of a temporary | ||
235 | .Vt int | ||
236 | variable initialized to | ||
237 | .Fa iarg . | ||
238 | If | ||
239 | .Fn BIO_ctrl | ||
240 | changes the value stored at | ||
241 | .Pf * Fa parg , | ||
242 | the new value is ignored. | ||
243 | .Pp | ||
178 | .Fn BIO_reset | 244 | .Fn BIO_reset |
179 | typically resets a BIO to some initial state. | 245 | typically resets a BIO to some initial state. |
180 | In the case of file related BIOs, for example, | 246 | In the case of file related BIOs, for example, |
@@ -234,6 +300,46 @@ and | |||
234 | are macros which call | 300 | are macros which call |
235 | .Fn BIO_ctrl . | 301 | .Fn BIO_ctrl . |
236 | .Sh RETURN VALUES | 302 | .Sh RETURN VALUES |
303 | The meaning of the return values of | ||
304 | .Fn BIO_ctrl , | ||
305 | .Fn BIO_callback_ctrl , | ||
306 | and | ||
307 | .Fn BIO_int_ctrl | ||
308 | depends on both the type of | ||
309 | .Fa b | ||
310 | and on the | ||
311 | .Fa cmd . | ||
312 | If | ||
313 | .Fa b | ||
314 | is a | ||
315 | .Dv NULL | ||
316 | pointer, no action occurs and 0 is returned. | ||
317 | The return value \-2 usually indicates a fatal error. | ||
318 | In particular, it is returned if the | ||
319 | .Fa cmd | ||
320 | is unsupported by the type of | ||
321 | .Fa b . | ||
322 | If a callback was installed with | ||
323 | .Xr BIO_set_callback_ex 3 | ||
324 | or | ||
325 | .Xr BIO_set_callback 3 | ||
326 | and returns a negative value, that value is returned. | ||
327 | .Pp | ||
328 | .Fn BIO_ptr_ctrl | ||
329 | returns | ||
330 | .Dv NULL | ||
331 | if the | ||
332 | .Fn BIO_ctrl | ||
333 | call returns a negative value or does not change | ||
334 | .Pf * Fa parg , | ||
335 | or the pointer it puts into | ||
336 | .Pf * Fa parg | ||
337 | otherwise. | ||
338 | .Pp | ||
339 | .Fn BIO_int_ctrl | ||
340 | returns the return value of | ||
341 | .Fn BIO_ctrl . | ||
342 | .Pp | ||
237 | .Fn BIO_reset | 343 | .Fn BIO_reset |
238 | normally returns 1 for success and 0 or -1 for failure. | 344 | normally returns 1 for success and 0 or -1 for failure. |
239 | File BIOs are an exception, returning 0 for success and -1 for failure. | 345 | File BIOs are an exception, returning 0 for success and -1 for failure. |
@@ -295,7 +401,7 @@ to the next BIO in the chain. | |||
295 | This often means there is no need to locate the required BIO for | 401 | This often means there is no need to locate the required BIO for |
296 | a particular operation: it can be called on a chain and it will | 402 | a particular operation: it can be called on a chain and it will |
297 | be automatically passed to the relevant BIO. | 403 | be automatically passed to the relevant BIO. |
298 | However this can cause unexpected results. | 404 | However, this can cause unexpected results. |
299 | For example no current filter BIOs implement | 405 | For example no current filter BIOs implement |
300 | .Fn BIO_seek , | 406 | .Fn BIO_seek , |
301 | but this may still succeed if the chain ends | 407 | but this may still succeed if the chain ends |