diff options
Diffstat (limited to 'src/lib/libcrypto/man/BIO_should_retry.3')
| -rw-r--r-- | src/lib/libcrypto/man/BIO_should_retry.3 | 301 |
1 files changed, 0 insertions, 301 deletions
diff --git a/src/lib/libcrypto/man/BIO_should_retry.3 b/src/lib/libcrypto/man/BIO_should_retry.3 deleted file mode 100644 index 9b93743516..0000000000 --- a/src/lib/libcrypto/man/BIO_should_retry.3 +++ /dev/null | |||
| @@ -1,301 +0,0 @@ | |||
| 1 | .\" $OpenBSD: BIO_should_retry.3,v 1.11 2023/04/30 14:03:47 schwarze Exp $ | ||
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | ||
| 3 | .\" selective merge up to: OpenSSL 57fd5170 May 13 11:24:11 2018 +0200 | ||
| 4 | .\" | ||
| 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>. | ||
| 23 | .\" Copyright (c) 2000, 2010, 2016 The OpenSSL Project. All rights reserved. | ||
| 24 | .\" | ||
| 25 | .\" Redistribution and use in source and binary forms, with or without | ||
| 26 | .\" modification, are permitted provided that the following conditions | ||
| 27 | .\" are met: | ||
| 28 | .\" | ||
| 29 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 30 | .\" notice, this list of conditions and the following disclaimer. | ||
| 31 | .\" | ||
| 32 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 33 | .\" notice, this list of conditions and the following disclaimer in | ||
| 34 | .\" the documentation and/or other materials provided with the | ||
| 35 | .\" distribution. | ||
| 36 | .\" | ||
| 37 | .\" 3. All advertising materials mentioning features or use of this | ||
| 38 | .\" software must display the following acknowledgment: | ||
| 39 | .\" "This product includes software developed by the OpenSSL Project | ||
| 40 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 41 | .\" | ||
| 42 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 43 | .\" endorse or promote products derived from this software without | ||
| 44 | .\" prior written permission. For written permission, please contact | ||
| 45 | .\" openssl-core@openssl.org. | ||
| 46 | .\" | ||
| 47 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 48 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 49 | .\" permission of the OpenSSL Project. | ||
| 50 | .\" | ||
| 51 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 52 | .\" acknowledgment: | ||
| 53 | .\" "This product includes software developed by the OpenSSL Project | ||
| 54 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 55 | .\" | ||
| 56 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 57 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 58 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 59 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 60 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 61 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 62 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 63 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 64 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 65 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 68 | .\" | ||
| 69 | .Dd $Mdocdate: April 30 2023 $ | ||
| 70 | .Dt BIO_SHOULD_RETRY 3 | ||
| 71 | .Os | ||
| 72 | .Sh NAME | ||
| 73 | .Nm BIO_should_read , | ||
| 74 | .Nm BIO_should_write , | ||
| 75 | .Nm BIO_should_io_special , | ||
| 76 | .Nm BIO_retry_type , | ||
| 77 | .Nm BIO_should_retry , | ||
| 78 | .Nm BIO_get_retry_BIO , | ||
| 79 | .Nm BIO_get_retry_reason , | ||
| 80 | .Nm BIO_set_retry_reason | ||
| 81 | .Nd BIO retry functions | ||
| 82 | .Sh SYNOPSIS | ||
| 83 | .In openssl/bio.h | ||
| 84 | .Ft int | ||
| 85 | .Fo BIO_should_read | ||
| 86 | .Fa "BIO *b" | ||
| 87 | .Fc | ||
| 88 | .Ft int | ||
| 89 | .Fo BIO_should_write | ||
| 90 | .Fa "BIO *b" | ||
| 91 | .Fc | ||
| 92 | .Ft int | ||
| 93 | .Fo BIO_should_io_special | ||
| 94 | .Fa "BIO *b" | ||
| 95 | .Fc | ||
| 96 | .Ft int | ||
| 97 | .Fo BIO_retry_type | ||
| 98 | .Fa "BIO *b" | ||
| 99 | .Fc | ||
| 100 | .Ft int | ||
| 101 | .Fo BIO_should_retry | ||
| 102 | .Fa "BIO *b" | ||
| 103 | .Fc | ||
| 104 | .Fd #define BIO_FLAGS_READ 0x01 | ||
| 105 | .Fd #define BIO_FLAGS_WRITE 0x02 | ||
| 106 | .Fd #define BIO_FLAGS_IO_SPECIAL 0x04 | ||
| 107 | .Fd #define BIO_FLAGS_RWS \e | ||
| 108 | .Fd \& (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) | ||
| 109 | .Fd #define BIO_FLAGS_SHOULD_RETRY 0x08 | ||
| 110 | .Ft BIO * | ||
| 111 | .Fo BIO_get_retry_BIO | ||
| 112 | .Fa "BIO *bio" | ||
| 113 | .Fa "int *reason" | ||
| 114 | .Fc | ||
| 115 | .Ft int | ||
| 116 | .Fo BIO_get_retry_reason | ||
| 117 | .Fa "BIO *bio" | ||
| 118 | .Fc | ||
| 119 | .Ft void | ||
| 120 | .Fo BIO_set_retry_reason | ||
| 121 | .Fa "BIO *bio" | ||
| 122 | .Fa "int reason" | ||
| 123 | .Fc | ||
| 124 | .Sh DESCRIPTION | ||
| 125 | These functions determine why a BIO is not able to read or write data. | ||
| 126 | They will typically be called after a failed | ||
| 127 | .Xr BIO_read 3 | ||
| 128 | or | ||
| 129 | .Xr BIO_write 3 | ||
| 130 | call. | ||
| 131 | .Pp | ||
| 132 | .Fn BIO_should_retry | ||
| 133 | returns 1 if the call that produced this condition should be retried | ||
| 134 | at a later time, or 0 if an error occurred. | ||
| 135 | .Pp | ||
| 136 | .Fn BIO_should_read | ||
| 137 | returns 1 if the cause of the retry condition is that a BIO needs | ||
| 138 | to read data, or 0 otherwise. | ||
| 139 | .Pp | ||
| 140 | .Fn BIO_should_write | ||
| 141 | returns 1 if the cause of the retry condition is that a BIO needs | ||
| 142 | to write data, or 0 otherwise. | ||
| 143 | .Pp | ||
| 144 | .Fn BIO_should_io_special | ||
| 145 | returns 1 if some special condition (i.e. a reason other than reading | ||
| 146 | or writing) is the cause of the retry condition, or 0 otherwise. | ||
| 147 | .Pp | ||
| 148 | .Fn BIO_retry_type | ||
| 149 | returns the bitwise OR of one or more of the flags | ||
| 150 | .Dv BIO_FLAGS_READ , | ||
| 151 | .Dv BIO_FLAGS_WRITE , | ||
| 152 | and | ||
| 153 | .Dv BIO_FLAGS_IO_SPECIAL | ||
| 154 | representing the cause of the current retry condition, | ||
| 155 | or 0 if there is no retry condition. | ||
| 156 | Current BIO types only set one of the flags at a time. | ||
| 157 | .Pp | ||
| 158 | .Fn BIO_get_retry_BIO | ||
| 159 | determines the precise reason for the special condition. | ||
| 160 | It walks the BIO chain starting at | ||
| 161 | .Fa bio | ||
| 162 | and returns the BIO that caused this condition. | ||
| 163 | If there is no special condition, | ||
| 164 | .Fa bio | ||
| 165 | itself is returned. | ||
| 166 | If | ||
| 167 | .Fa reason | ||
| 168 | is not a | ||
| 169 | .Dv NULL | ||
| 170 | pointer, | ||
| 171 | .Pf * Fa reason | ||
| 172 | is set to one of the following reason codes: | ||
| 173 | .Bl -tag -width 1n -offset 3n | ||
| 174 | .It 0 | ||
| 175 | There is no special condition. | ||
| 176 | .It Dv BIO_RR_ACCEPT | ||
| 177 | .Xr accept 2 | ||
| 178 | would have blocked. | ||
| 179 | This can occur for BIOs created from | ||
| 180 | .Xr BIO_s_accept 3 | ||
| 181 | or | ||
| 182 | .Xr BIO_f_ssl 3 . | ||
| 183 | .It Dv BIO_RR_CONNECT | ||
| 184 | .Xr connect 2 | ||
| 185 | would have blocked. | ||
| 186 | This can occur for BIOs created from | ||
| 187 | .Xr BIO_s_connect 3 | ||
| 188 | or | ||
| 189 | .Xr BIO_f_ssl 3 . | ||
| 190 | .It Dv BIO_RR_SSL_X509_LOOKUP | ||
| 191 | An application callback set by | ||
| 192 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
| 193 | has asked to be called again. | ||
| 194 | This can occur for BIOs created from | ||
| 195 | .Xr BIO_f_ssl 3 . | ||
| 196 | .El | ||
| 197 | .Pp | ||
| 198 | .Fn BIO_get_retry_reason | ||
| 199 | returns one of the above reason codes for a special condition that occurred in | ||
| 200 | .Fa bio . | ||
| 201 | It does not walk the chain and returns 0 if no special condition occurred in | ||
| 202 | .Fa bio | ||
| 203 | itself. | ||
| 204 | .Pp | ||
| 205 | .Fn BIO_set_retry_reason | ||
| 206 | sets the retry reason for a special condition for the given | ||
| 207 | .Fa bio . | ||
| 208 | It is intended to be called by functions implementing a BIO type | ||
| 209 | rather than by functions merely using BIOs. | ||
| 210 | .Pp | ||
| 211 | .Fn BIO_should_retry , | ||
| 212 | .Fn BIO_should_read , | ||
| 213 | .Fn BIO_should_write , | ||
| 214 | .Fn BIO_should_io_special , | ||
| 215 | and | ||
| 216 | .Fn BIO_retry_type | ||
| 217 | are implemented as macros. | ||
| 218 | .Pp | ||
| 219 | If | ||
| 220 | .Fn BIO_should_retry | ||
| 221 | returns false, then the precise "error condition" depends on | ||
| 222 | the BIO type that caused it and the return code of the BIO operation. | ||
| 223 | For example if a call to | ||
| 224 | .Xr BIO_read 3 | ||
| 225 | on a socket BIO returns 0 and | ||
| 226 | .Fn BIO_should_retry | ||
| 227 | is false, then the cause will be that the connection closed. | ||
| 228 | A similar condition on a file BIO will mean that it has reached EOF. | ||
| 229 | Some BIO types may place additional information on the error queue. | ||
| 230 | For more details see the individual BIO type manual pages. | ||
| 231 | .Pp | ||
| 232 | If the underlying I/O structure is in a blocking mode, | ||
| 233 | almost all current BIO types will not request a retry, | ||
| 234 | because the underlying I/O calls will not. | ||
| 235 | If the application knows that the BIO type will never | ||
| 236 | signal a retry then it need not call | ||
| 237 | .Fn BIO_should_retry | ||
| 238 | after a failed BIO I/O call. | ||
| 239 | This is typically done with file BIOs. | ||
| 240 | .Pp | ||
| 241 | SSL BIOs are the only current exception to this rule: | ||
| 242 | they can request a retry even if the underlying I/O structure | ||
| 243 | is blocking, if a handshake occurs during a call to | ||
| 244 | .Xr BIO_read 3 . | ||
| 245 | An application can retry the failed call immediately | ||
| 246 | or avoid this situation by setting | ||
| 247 | .Dv SSL_MODE_AUTO_RETRY | ||
| 248 | on the underlying SSL structure. | ||
| 249 | .Pp | ||
| 250 | While an application may retry a failed non-blocking call immediately, | ||
| 251 | this is likely to be very inefficient because the call will fail | ||
| 252 | repeatedly until data can be processed or is available. | ||
| 253 | An application will normally wait until the necessary condition | ||
| 254 | is satisfied. | ||
| 255 | How this is done depends on the underlying I/O structure. | ||
| 256 | .Pp | ||
| 257 | For example if the cause is ultimately a socket and | ||
| 258 | .Fn BIO_should_read | ||
| 259 | is true then a call to | ||
| 260 | .Xr select 2 | ||
| 261 | may be made to wait until data is available | ||
| 262 | and then retry the BIO operation. | ||
| 263 | By combining the retry conditions of several non-blocking BIOs in a single | ||
| 264 | .Xr select 2 | ||
| 265 | call it is possible to service several BIOs in a single thread, | ||
| 266 | though the performance may be poor if SSL BIOs are present because | ||
| 267 | long delays can occur during the initial handshake process. | ||
| 268 | .Pp | ||
| 269 | It is possible for a BIO to block indefinitely if the underlying I/O | ||
| 270 | structure cannot process or return any data. | ||
| 271 | This depends on the behaviour of the platforms I/O functions. | ||
| 272 | This is often not desirable: one solution is to use non-blocking I/O | ||
| 273 | and use a timeout on the | ||
| 274 | .Xr select 2 | ||
| 275 | (or equivalent) call. | ||
| 276 | .Sh SEE ALSO | ||
| 277 | .Xr BIO_new 3 , | ||
| 278 | .Xr BIO_read 3 | ||
| 279 | .Sh HISTORY | ||
| 280 | .Fn BIO_should_read , | ||
| 281 | .Fn BIO_should_write , | ||
| 282 | .Fn BIO_retry_type , | ||
| 283 | and | ||
| 284 | .Fn BIO_should_retry | ||
| 285 | first appeared in SSLeay 0.6.0. | ||
| 286 | .Fn BIO_should_io_special , | ||
| 287 | .Fn BIO_get_retry_BIO , | ||
| 288 | and | ||
| 289 | .Fn BIO_get_retry_reason | ||
| 290 | first appeared in SSLeay 0.8.0. | ||
| 291 | All these functions have been available since | ||
| 292 | .Ox 2.4 . | ||
| 293 | .Pp | ||
| 294 | .Fn BIO_set_retry_reason | ||
| 295 | first appeared in OpenSSL 1.1.0 and has been available since | ||
| 296 | .Ox 7.1 . | ||
| 297 | .Sh BUGS | ||
| 298 | The OpenSSL ASN.1 functions cannot gracefully deal with non-blocking I/O: | ||
| 299 | they cannot retry after a partial read or write. | ||
| 300 | This is usually worked around by only passing the relevant data to ASN.1 | ||
| 301 | functions when the entire structure can be read or written. | ||
