summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2018-02-13 01:15:24 +0000
committerschwarze <>2018-02-13 01:15:24 +0000
commitb5e5377c89b0f620aeeb1f9c406c1cfb9ff71136 (patch)
treeb286ca72419f4a07a9bda9547ac831768a390059
parentcd586736a74d50ff330156d1f38d70ac21439ef9 (diff)
downloadopenbsd-b5e5377c89b0f620aeeb1f9c406c1cfb9ff71136.tar.gz
openbsd-b5e5377c89b0f620aeeb1f9c406c1cfb9ff71136.tar.bz2
openbsd-b5e5377c89b0f620aeeb1f9c406c1cfb9ff71136.zip
Add the missing RETURN VALUES section.
Triggered by OpenSSL commit 1f13ad31 Dec 25 17:50:39 2017 +0800 by Paul Yang, but reworded for intelligibility and precision. While here, also expand the description of the "ret" argument of BIO_callback_fn(). That's a fairly complicated and alarmingly powerful concept, but the description was so brief that is was barely comprehensible.
-rw-r--r--src/lib/libcrypto/man/BIO_set_callback.390
1 files changed, 76 insertions, 14 deletions
diff --git a/src/lib/libcrypto/man/BIO_set_callback.3 b/src/lib/libcrypto/man/BIO_set_callback.3
index 4209c0818e..a56d09f428 100644
--- a/src/lib/libcrypto/man/BIO_set_callback.3
+++ b/src/lib/libcrypto/man/BIO_set_callback.3
@@ -1,8 +1,26 @@
1.\" $OpenBSD: BIO_set_callback.3,v 1.5 2016/12/06 14:45:08 schwarze Exp $ 1.\" $OpenBSD: BIO_set_callback.3,v 1.6 2018/02/13 01:15:24 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 4.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 5.\" This file is a derived work.
5.\" Copyright (c) 2000, 2016 The OpenSSL Project. All rights reserved. 6.\" The changes are covered by the following Copyright and license:
7.\"
8.\" Copyright (c) 2018 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>.
23.\" Copyright (c) 2000, 2016, 2017 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
8.\" modification, are permitted provided that the following conditions 26.\" modification, are permitted provided that the following conditions
@@ -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: December 6 2016 $ 69.Dd $Mdocdate: February 13 2018 $
52.Dt BIO_SET_CALLBACK 3 70.Dt BIO_SET_CALLBACK 3
53.Os 71.Os
54.Sh NAME 72.Sh NAME
@@ -141,20 +159,37 @@ depends on the value of
141.Fa oper 159.Fa oper
142(i.e. the operation being performed). 160(i.e. the operation being performed).
143.Pp 161.Pp
162When
163.Fa oper
164does not include
165.Dv BIO_CB_RETURN ,
166i.e. when the callback is invoked before an operation,
167the value passed into the callback via
168.Fa ret
169is always 1.
170In this case, if the callback returns a negative value, the library
171aborts the requested operation and instead returns the negative
172return value from the callback to the application.
173If the callback returns a non-negative value, that return value is
174ignored by the library, and the operation is performed normally.
175.Pp
176When
177.Fa oper
178includes
179.Dv BIO_CB_RETURN ,
180i.e. when the callback is invoked after an operation,
181the value passed into the callback via
144.Fa ret 182.Fa ret
145is the return value that would be returned to the application 183is the return value that the operation would return to the application
146if no callback were present. 184if no callback were present.
147The actual value returned is the return value of the callback itself. 185When a callback is present, the operation only passes this value
148In the case of callbacks called before the actual BIO operation, 186to the callback and instead of it returns the return value of the
1491 is placed in 187callback to the application.
150.Fa ret .
151If the return value is not positive, it will be immediately returned to
152the application and the BIO operation will not be performed.
153.Pp 188.Pp
154The callback should normally simply return 189The callback should normally simply return
155.Fa ret 190.Fa ret
156when it has finished processing, unless it specifically wishes 191when it has finished processing, unless it specifically wishes to
157to modify the value returned to the application. 192abort the operation or to modify the value returned to the application.
158.Ss Callback operations 193.Ss Callback operations
159.Bl -tag -width Ds 194.Bl -tag -width Ds
160.It Fn BIO_free b 195.It Fn BIO_free b
@@ -186,6 +221,33 @@ is called before the call and
186.Fn callback b BIO_CB_CTRL|BIO_CB_RETURN parg oper larg ret 221.Fn callback b BIO_CB_CTRL|BIO_CB_RETURN parg oper larg ret
187after. 222after.
188.El 223.El
224.Sh RETURN VALUES
225.Fn BIO_get_callback
226returns a pointer to the function
227.Fa cb
228previously installed with
229.Fn BIO_set_callback ,
230or
231.Dv NULL
232if no callback was installed.
233.Pp
234.Fn BIO_get_callback_arg
235returns a pointer to the
236.Fa arg
237previously set with
238.Fn BIO_set_callback_arg ,
239or
240.Dv NULL
241if no such argument was set.
242.Pp
243.Fn BIO_debug_callback
244returns
245.Fa ret
246if the bit
247.Dv BIO_CB_RETURN
248is set in
249.Fa cmd ,
250or 1 otherwise.
189.Sh EXAMPLES 251.Sh EXAMPLES
190The 252The
191.Fn BIO_debug_callback 253.Fn BIO_debug_callback