diff options
author | schwarze <> | 2018-02-13 01:15:24 +0000 |
---|---|---|
committer | schwarze <> | 2018-02-13 01:15:24 +0000 |
commit | b5e5377c89b0f620aeeb1f9c406c1cfb9ff71136 (patch) | |
tree | b286ca72419f4a07a9bda9547ac831768a390059 | |
parent | cd586736a74d50ff330156d1f38d70ac21439ef9 (diff) | |
download | openbsd-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.3 | 90 |
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 |
162 | When | ||
163 | .Fa oper | ||
164 | does not include | ||
165 | .Dv BIO_CB_RETURN , | ||
166 | i.e. when the callback is invoked before an operation, | ||
167 | the value passed into the callback via | ||
168 | .Fa ret | ||
169 | is always 1. | ||
170 | In this case, if the callback returns a negative value, the library | ||
171 | aborts the requested operation and instead returns the negative | ||
172 | return value from the callback to the application. | ||
173 | If the callback returns a non-negative value, that return value is | ||
174 | ignored by the library, and the operation is performed normally. | ||
175 | .Pp | ||
176 | When | ||
177 | .Fa oper | ||
178 | includes | ||
179 | .Dv BIO_CB_RETURN , | ||
180 | i.e. when the callback is invoked after an operation, | ||
181 | the value passed into the callback via | ||
144 | .Fa ret | 182 | .Fa ret |
145 | is the return value that would be returned to the application | 183 | is the return value that the operation would return to the application |
146 | if no callback were present. | 184 | if no callback were present. |
147 | The actual value returned is the return value of the callback itself. | 185 | When a callback is present, the operation only passes this value |
148 | In the case of callbacks called before the actual BIO operation, | 186 | to the callback and instead of it returns the return value of the |
149 | 1 is placed in | 187 | callback to the application. |
150 | .Fa ret . | ||
151 | If the return value is not positive, it will be immediately returned to | ||
152 | the application and the BIO operation will not be performed. | ||
153 | .Pp | 188 | .Pp |
154 | The callback should normally simply return | 189 | The callback should normally simply return |
155 | .Fa ret | 190 | .Fa ret |
156 | when it has finished processing, unless it specifically wishes | 191 | when it has finished processing, unless it specifically wishes to |
157 | to modify the value returned to the application. | 192 | abort 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 |
187 | after. | 222 | after. |
188 | .El | 223 | .El |
224 | .Sh RETURN VALUES | ||
225 | .Fn BIO_get_callback | ||
226 | returns a pointer to the function | ||
227 | .Fa cb | ||
228 | previously installed with | ||
229 | .Fn BIO_set_callback , | ||
230 | or | ||
231 | .Dv NULL | ||
232 | if no callback was installed. | ||
233 | .Pp | ||
234 | .Fn BIO_get_callback_arg | ||
235 | returns a pointer to the | ||
236 | .Fa arg | ||
237 | previously set with | ||
238 | .Fn BIO_set_callback_arg , | ||
239 | or | ||
240 | .Dv NULL | ||
241 | if no such argument was set. | ||
242 | .Pp | ||
243 | .Fn BIO_debug_callback | ||
244 | returns | ||
245 | .Fa ret | ||
246 | if the bit | ||
247 | .Dv BIO_CB_RETURN | ||
248 | is set in | ||
249 | .Fa cmd , | ||
250 | or 1 otherwise. | ||
189 | .Sh EXAMPLES | 251 | .Sh EXAMPLES |
190 | The | 252 | The |
191 | .Fn BIO_debug_callback | 253 | .Fn BIO_debug_callback |