diff options
| author | schwarze <> | 2023-04-06 19:06:51 +0000 |
|---|---|---|
| committer | schwarze <> | 2023-04-06 19:06:51 +0000 |
| commit | 383b8bb0a5bb367cf3cf5bc6230105ca7cecaace (patch) | |
| tree | 5484188e38eb349efcb590a47bd2145c6d0b89ba /src/lib | |
| parent | 6b96be485d4f4b85dc6607815f97a646181ea6ed (diff) | |
| download | openbsd-383b8bb0a5bb367cf3cf5bc6230105ca7cecaace.tar.gz openbsd-383b8bb0a5bb367cf3cf5bc6230105ca7cecaace.tar.bz2 openbsd-383b8bb0a5bb367cf3cf5bc6230105ca7cecaace.zip | |
Properly document BIO_set_info_callback(3) and BIO_get_info_callback(3)
which where mentioned below SYNOPSIS and HISTORY but not described.
Also document the command constant BIO_CTRL_SET_CALLBACK
and the deprecated function type name bio_info_cb(3).
Mention that callbacks installed using BIO_set_callback_ex(3)
and BIO_set_callback(3) can tamper with *all* the return values.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/libcrypto/man/BIO_ctrl.3 | 104 |
1 files changed, 96 insertions, 8 deletions
diff --git a/src/lib/libcrypto/man/BIO_ctrl.3 b/src/lib/libcrypto/man/BIO_ctrl.3 index a5c181307e..0c2ad2b737 100644 --- a/src/lib/libcrypto/man/BIO_ctrl.3 +++ b/src/lib/libcrypto/man/BIO_ctrl.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_ctrl.3,v 1.17 2023/04/04 17:10:37 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_ctrl.3,v 1.18 2023/04/06 19:06:51 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 24a535eaf Tue Sep 22 13:14:20 2020 +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 | .\" selective merge up to: OpenSSL 0c5bc96f Tue Mar 15 13:57:22 2022 +0000 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" 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 |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: April 4 2023 $ | 69 | .Dd $Mdocdate: April 6 2023 $ |
| 70 | .Dt BIO_CTRL 3 | 70 | .Dt BIO_CTRL 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -87,7 +87,8 @@ | |||
| 87 | .Nm BIO_ctrl_wpending , | 87 | .Nm BIO_ctrl_wpending , |
| 88 | .Nm BIO_get_info_callback , | 88 | .Nm BIO_get_info_callback , |
| 89 | .Nm BIO_set_info_callback , | 89 | .Nm BIO_set_info_callback , |
| 90 | .Nm BIO_info_cb | 90 | .Nm BIO_info_cb , |
| 91 | .Nm bio_info_cb | ||
| 91 | .Nd BIO control operations | 92 | .Nd BIO control operations |
| 92 | .Sh SYNOPSIS | 93 | .Sh SYNOPSIS |
| 93 | .In openssl/bio.h | 94 | .In openssl/bio.h |
| @@ -179,6 +180,12 @@ | |||
| 179 | .Fa "int state" | 180 | .Fa "int state" |
| 180 | .Fa "int res" | 181 | .Fa "int res" |
| 181 | .Fc | 182 | .Fc |
| 183 | .Ft typedef int | ||
| 184 | .Fo bio_info_cb | ||
| 185 | .Fa "BIO *b" | ||
| 186 | .Fa "int state" | ||
| 187 | .Fa "int res" | ||
| 188 | .Fc | ||
| 182 | .Sh DESCRIPTION | 189 | .Sh DESCRIPTION |
| 183 | .Fn BIO_ctrl , | 190 | .Fn BIO_ctrl , |
| 184 | .Fn BIO_callback_ctrl , | 191 | .Fn BIO_callback_ctrl , |
| @@ -217,6 +224,12 @@ function pointer, which is built into the library for some standard BIO | |||
| 217 | types and can be provided with | 224 | types and can be provided with |
| 218 | .Xr BIO_meth_set_callback_ctrl 3 | 225 | .Xr BIO_meth_set_callback_ctrl 3 |
| 219 | for application-defined BIO types. | 226 | for application-defined BIO types. |
| 227 | The only | ||
| 228 | .Fa cmd | ||
| 229 | supported by | ||
| 230 | .Fn BIO_callback_ctrl | ||
| 231 | is | ||
| 232 | .Dv BIO_CTRL_SET_CALLBACK . | ||
| 220 | .Pp | 233 | .Pp |
| 221 | .Fn BIO_ptr_ctrl | 234 | .Fn BIO_ptr_ctrl |
| 222 | calls | 235 | calls |
| @@ -299,6 +312,43 @@ and | |||
| 299 | .Fn BIO_wpending | 312 | .Fn BIO_wpending |
| 300 | are macros which call | 313 | are macros which call |
| 301 | .Fn BIO_ctrl . | 314 | .Fn BIO_ctrl . |
| 315 | .Pp | ||
| 316 | .Fn BIO_set_info_callback | ||
| 317 | installs the function pointer | ||
| 318 | .Fa cb | ||
| 319 | as an info callback in | ||
| 320 | .Fa b | ||
| 321 | by calling | ||
| 322 | .Fn BIO_callback_ctrl | ||
| 323 | with a command of | ||
| 324 | .Dv BIO_CTRL_SET_CALLBACK . | ||
| 325 | Among the BIO types built into the library, only | ||
| 326 | .Xr BIO_s_connect 3 | ||
| 327 | and | ||
| 328 | .Xr BIO_f_ssl 3 | ||
| 329 | support this functionality. | ||
| 330 | Some filter BIO types forward this control call | ||
| 331 | to the next BIO in the chain instead of processing it themselves. | ||
| 332 | .Pp | ||
| 333 | .Fn BIO_get_info_callback | ||
| 334 | places the function pointer to the info callback into | ||
| 335 | .Pf * Fa cbp | ||
| 336 | if any was installed using | ||
| 337 | .Fn BIO_set_info_callback | ||
| 338 | or | ||
| 339 | .Fn BIO_callback_ctrl . | ||
| 340 | If the type of | ||
| 341 | .Fa b | ||
| 342 | supports setting an info callback but none was installed, it stores a | ||
| 343 | .Dv NULL | ||
| 344 | pointer in | ||
| 345 | .Pf * Fa cbp . | ||
| 346 | .Pp | ||
| 347 | The function type name | ||
| 348 | .Vt bio_info_cb | ||
| 349 | is a deprecated synonym for | ||
| 350 | .Vt BIO_info_cb | ||
| 351 | provided for backward compatibility with some existing application software. | ||
| 302 | .Sh RETURN VALUES | 352 | .Sh RETURN VALUES |
| 303 | The meaning of the return values of | 353 | The meaning of the return values of |
| 304 | .Fn BIO_ctrl , | 354 | .Fn BIO_ctrl , |
| @@ -319,11 +369,20 @@ In particular, it is returned if the | |||
| 319 | .Fa cmd | 369 | .Fa cmd |
| 320 | is unsupported by the type of | 370 | is unsupported by the type of |
| 321 | .Fa b . | 371 | .Fa b . |
| 322 | If a callback was installed with | 372 | .Pp |
| 323 | .Xr BIO_set_callback_ex 3 | 373 | .Fn BIO_callback_ctrl |
| 324 | or | 374 | and |
| 325 | .Xr BIO_set_callback 3 | 375 | .Fn BIO_set_info_callback |
| 326 | and returns a negative value, that value is returned. | 376 | return 1 on success, 0 if |
| 377 | .Fa b | ||
| 378 | is | ||
| 379 | .Dv NULL | ||
| 380 | or to indicate failure of a valid | ||
| 381 | .Fa cmd , | ||
| 382 | or \-2 if the | ||
| 383 | .Fa cmd | ||
| 384 | is not supported by | ||
| 385 | .Fa b . | ||
| 327 | .Pp | 386 | .Pp |
| 328 | .Fn BIO_ptr_ctrl | 387 | .Fn BIO_ptr_ctrl |
| 329 | returns | 388 | returns |
| @@ -373,6 +432,26 @@ or | |||
| 373 | and | 432 | and |
| 374 | .Fn BIO_ctrl_wpending | 433 | .Fn BIO_ctrl_wpending |
| 375 | return the amount of pending data. | 434 | return the amount of pending data. |
| 435 | .Pp | ||
| 436 | .Fn BIO_get_info_callback | ||
| 437 | returns 1 on success, including when the type of | ||
| 438 | .Fa b | ||
| 439 | supports an info callback but none is installed, | ||
| 440 | 0 if | ||
| 441 | .Fa b | ||
| 442 | is | ||
| 443 | .Dv NULL | ||
| 444 | or \-2 if the type of | ||
| 445 | .Fa b | ||
| 446 | does not support an info callback. | ||
| 447 | .Pp | ||
| 448 | If a callback was installed in | ||
| 449 | .Fa b | ||
| 450 | using | ||
| 451 | .Xr BIO_set_callback_ex 3 | ||
| 452 | or | ||
| 453 | .Xr BIO_set_callback 3 , | ||
| 454 | it can modify the return values of all these functions. | ||
| 376 | .Sh NOTES | 455 | .Sh NOTES |
| 377 | Because it can write data, | 456 | Because it can write data, |
| 378 | .Fn BIO_flush | 457 | .Fn BIO_flush |
| @@ -448,6 +527,15 @@ These functions have been available since | |||
| 448 | .Fn BIO_callback_ctrl | 527 | .Fn BIO_callback_ctrl |
| 449 | first appeared in OpenSSL 0.9.5 and has been available since | 528 | first appeared in OpenSSL 0.9.5 and has been available since |
| 450 | .Ox 2.7 . | 529 | .Ox 2.7 . |
| 530 | .Pp | ||
| 531 | .Fn bio_info_cb | ||
| 532 | first appeared with a more complicated prototype in OpenSSL 0.9.6 | ||
| 533 | and has been available since | ||
| 534 | .Ox 2.9 . | ||
| 535 | .Pp | ||
| 536 | .Fn BIO_info_cb | ||
| 537 | first appeared in OpenSSL 1.1.0h and has been available since | ||
| 538 | .Ox 6.3 . | ||
| 451 | .Sh BUGS | 539 | .Sh BUGS |
| 452 | Some of the return values are ambiguous and care should be taken. | 540 | Some of the return values are ambiguous and care should be taken. |
| 453 | In particular a return value of 0 can be returned if an operation | 541 | In particular a return value of 0 can be returned if an operation |
