summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2023-04-04 17:10:37 +0000
committerschwarze <>2023-04-04 17:10:37 +0000
commita842b1fc304364a2fcb5f261f0682291b3ff3dcc (patch)
tree40f12bb0ea20f91d29a7be9c4d87bdb87f9a1875 /src/lib
parentd953e42079697b91918dd0ba43dc0d5ccbed414a (diff)
downloadopenbsd-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.3124
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
175are described in the specific BIO's manual page 193are described in the specific BIO's manual page
176as well as any special features of the standard calls. 194as well as any special features of the standard calls.
177.Pp 195.Pp
196Depending on the
197.Fa cmd
198and on the type of
199.Fa b ,
200.Fn BIO_ctrl
201may have a read-only effect on
202.Fa b
203or change data in
204.Fa b
205or in its sub-structures.
206It may also have a side effect of changing the memory pointed to by
207.Fa parg .
208.Pp
209.Fn BIO_callback_ctrl
210does not call
211.Fn BIO_ctrl
212but instead requires that the BIO type of
213.Fa b
214provides a dedicated
215.Fa callback_ctrl
216function pointer, which is built into the library for some standard BIO
217types and can be provided with
218.Xr BIO_meth_set_callback_ctrl 3
219for application-defined BIO types.
220.Pp
221.Fn BIO_ptr_ctrl
222calls
223.Fn BIO_ctrl
224with
225.Fa parg
226pointing to the location of a temporary pointer variable initialized to
227.Dv NULL .
228.Pp
229.Fn BIO_int_ctrl
230calls
231.Fn BIO_ctrl
232with
233.Fa parg
234pointing to the location of a temporary
235.Vt int
236variable initialized to
237.Fa iarg .
238If
239.Fn BIO_ctrl
240changes the value stored at
241.Pf * Fa parg ,
242the new value is ignored.
243.Pp
178.Fn BIO_reset 244.Fn BIO_reset
179typically resets a BIO to some initial state. 245typically resets a BIO to some initial state.
180In the case of file related BIOs, for example, 246In the case of file related BIOs, for example,
@@ -234,6 +300,46 @@ and
234are macros which call 300are macros which call
235.Fn BIO_ctrl . 301.Fn BIO_ctrl .
236.Sh RETURN VALUES 302.Sh RETURN VALUES
303The meaning of the return values of
304.Fn BIO_ctrl ,
305.Fn BIO_callback_ctrl ,
306and
307.Fn BIO_int_ctrl
308depends on both the type of
309.Fa b
310and on the
311.Fa cmd .
312If
313.Fa b
314is a
315.Dv NULL
316pointer, no action occurs and 0 is returned.
317The return value \-2 usually indicates a fatal error.
318In particular, it is returned if the
319.Fa cmd
320is unsupported by the type of
321.Fa b .
322If a callback was installed with
323.Xr BIO_set_callback_ex 3
324or
325.Xr BIO_set_callback 3
326and returns a negative value, that value is returned.
327.Pp
328.Fn BIO_ptr_ctrl
329returns
330.Dv NULL
331if the
332.Fn BIO_ctrl
333call returns a negative value or does not change
334.Pf * Fa parg ,
335or the pointer it puts into
336.Pf * Fa parg
337otherwise.
338.Pp
339.Fn BIO_int_ctrl
340returns the return value of
341.Fn BIO_ctrl .
342.Pp
237.Fn BIO_reset 343.Fn BIO_reset
238normally returns 1 for success and 0 or -1 for failure. 344normally returns 1 for success and 0 or -1 for failure.
239File BIOs are an exception, returning 0 for success and -1 for failure. 345File BIOs are an exception, returning 0 for success and -1 for failure.
@@ -295,7 +401,7 @@ to the next BIO in the chain.
295This often means there is no need to locate the required BIO for 401This often means there is no need to locate the required BIO for
296a particular operation: it can be called on a chain and it will 402a particular operation: it can be called on a chain and it will
297be automatically passed to the relevant BIO. 403be automatically passed to the relevant BIO.
298However this can cause unexpected results. 404However, this can cause unexpected results.
299For example no current filter BIOs implement 405For example no current filter BIOs implement
300.Fn BIO_seek , 406.Fn BIO_seek ,
301but this may still succeed if the chain ends 407but this may still succeed if the chain ends