diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/BIO_new.3 | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/BIO_s_datagram.3 | 572 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 |
3 files changed, 577 insertions, 3 deletions
diff --git a/src/lib/libcrypto/man/BIO_new.3 b/src/lib/libcrypto/man/BIO_new.3 index 6c357054b9..f958149973 100644 --- a/src/lib/libcrypto/man/BIO_new.3 +++ b/src/lib/libcrypto/man/BIO_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_new.3,v 1.25 2022/12/22 21:05:48 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_new.3,v 1.26 2022/12/23 15:59:34 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000 | 3 | .\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000 |
| 4 | .\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100 | 4 | .\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100 |
| @@ -52,7 +52,7 @@ | |||
| 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 54 | .\" | 54 | .\" |
| 55 | .Dd $Mdocdate: December 22 2022 $ | 55 | .Dd $Mdocdate: December 23 2022 $ |
| 56 | .Dt BIO_NEW 3 | 56 | .Dt BIO_NEW 3 |
| 57 | .Os | 57 | .Os |
| 58 | .Sh NAME | 58 | .Sh NAME |
| @@ -250,6 +250,7 @@ Create a memory BIO: | |||
| 250 | .Xr BIO_s_accept 3 , | 250 | .Xr BIO_s_accept 3 , |
| 251 | .Xr BIO_s_bio 3 , | 251 | .Xr BIO_s_bio 3 , |
| 252 | .Xr BIO_s_connect 3 , | 252 | .Xr BIO_s_connect 3 , |
| 253 | .Xr BIO_s_datagram 3 , | ||
| 253 | .Xr BIO_s_fd 3 , | 254 | .Xr BIO_s_fd 3 , |
| 254 | .Xr BIO_s_file 3 , | 255 | .Xr BIO_s_file 3 , |
| 255 | .Xr BIO_s_mem 3 , | 256 | .Xr BIO_s_mem 3 , |
diff --git a/src/lib/libcrypto/man/BIO_s_datagram.3 b/src/lib/libcrypto/man/BIO_s_datagram.3 new file mode 100644 index 0000000000..bef3c564fc --- /dev/null +++ b/src/lib/libcrypto/man/BIO_s_datagram.3 | |||
| @@ -0,0 +1,572 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_datagram.3,v 1.1 2022/12/23 15:59:34 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: December 23 2022 $ | ||
| 18 | .Dt BIO_S_DATAGRAM 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm BIO_s_datagram , | ||
| 22 | .Nm BIO_new_dgram , | ||
| 23 | .Nm BIO_dgram_set_peer , | ||
| 24 | .Nm BIO_ctrl_dgram_connect , | ||
| 25 | .Nm BIO_dgram_get_peer , | ||
| 26 | .Nm BIO_ctrl_set_connected , | ||
| 27 | .Nm BIO_dgram_recv_timedout , | ||
| 28 | .Nm BIO_dgram_send_timedout , | ||
| 29 | .Nm BIO_dgram_non_fatal_error | ||
| 30 | .Nd datagram socket BIO | ||
| 31 | .Sh SYNOPSIS | ||
| 32 | .In openssl/bio.h | ||
| 33 | .Ft const BIO_METHOD * | ||
| 34 | .Fn BIO_s_datagram void | ||
| 35 | .Ft BIO * | ||
| 36 | .Fo BIO_new_dgram | ||
| 37 | .Fa "int fd" | ||
| 38 | .Fa "int close_flag" | ||
| 39 | .Fc | ||
| 40 | .Ft int | ||
| 41 | .Fo BIO_dgram_set_peer | ||
| 42 | .Fa "BIO *b" | ||
| 43 | .Fa "struct sockaddr *sa" | ||
| 44 | .Fc | ||
| 45 | .Ft int | ||
| 46 | .Fo BIO_ctrl_dgram_connect | ||
| 47 | .Fa "BIO *b" | ||
| 48 | .Fa "struct sockaddr *sa" | ||
| 49 | .Fc | ||
| 50 | .Ft int | ||
| 51 | .Fo BIO_dgram_get_peer | ||
| 52 | .Fa "BIO *b" | ||
| 53 | .Fa "struct sockaddr *sa" | ||
| 54 | .Fc | ||
| 55 | .Ft int | ||
| 56 | .Fo BIO_ctrl_set_connected | ||
| 57 | .Fa "BIO *b" | ||
| 58 | .Fa "long argl" | ||
| 59 | .Fa "struct sockaddr *sa" | ||
| 60 | .Fc | ||
| 61 | .Ft int | ||
| 62 | .Fn BIO_dgram_recv_timedout "BIO *b" | ||
| 63 | .Ft int | ||
| 64 | .Fn BIO_dgram_send_timedout "BIO *b" | ||
| 65 | .Ft int | ||
| 66 | .Fn BIO_dgram_non_fatal_error "int errnum" | ||
| 67 | .Sh DESCRIPTION | ||
| 68 | .Fn BIO_s_datagram | ||
| 69 | returns the datagram socket BIO method. | ||
| 70 | The usual application is to transmit data using the IPv4 or IPv6 | ||
| 71 | .Xr udp 4 | ||
| 72 | protocol. | ||
| 73 | .Pp | ||
| 74 | When called on a datagram socket BIO object, | ||
| 75 | .Xr BIO_method_type 3 | ||
| 76 | returns the constant | ||
| 77 | .Dv BIO_TYPE_DGRAM | ||
| 78 | and | ||
| 79 | .Xr BIO_method_name 3 | ||
| 80 | returns a pointer to the static string | ||
| 81 | .Qq datagram socket . | ||
| 82 | .Ss Constructors and destructors | ||
| 83 | .Xr BIO_new 3 | ||
| 84 | allocates a new datagram socket BIO object and initializes all its data | ||
| 85 | to zero, including the datagram socket file descriptor, the peer address, | ||
| 86 | the init flag that can be retrieved with | ||
| 87 | .Xr BIO_get_init 3 , | ||
| 88 | the connected flag, the MTU, and all timeout and error information. | ||
| 89 | The reference count and the close flag are set to 1. | ||
| 90 | .Pp | ||
| 91 | .Fn BIO_new_dgram | ||
| 92 | allocates and initializes a new datagram socket BIO object with | ||
| 93 | .Xr BIO_new 3 , | ||
| 94 | sets the datagram socket file descriptor and the close flag | ||
| 95 | according to its arguments, and sets the init flag to 1. | ||
| 96 | .Pp | ||
| 97 | If the reference count reaches 0 in | ||
| 98 | .Xr BIO_free 3 | ||
| 99 | and the close and init flags are set, | ||
| 100 | .Xr shutdown 2 | ||
| 101 | and | ||
| 102 | .Xr close 2 | ||
| 103 | are called on the datagram socket file descriptor before freeing the | ||
| 104 | storage used by the BIO object. | ||
| 105 | .Pp | ||
| 106 | When a chain containing a datagram socket BIO is copied with | ||
| 107 | .Xr BIO_dup_chain 3 , | ||
| 108 | the datagram socket file descriptor, the init flag, the close flag, | ||
| 109 | the flags accessible with | ||
| 110 | .Xr BIO_test_flags 3 , | ||
| 111 | and any data that was set with | ||
| 112 | .Xr BIO_set_ex_data 3 | ||
| 113 | are automatically copied from the original BIO object to the new one, | ||
| 114 | but the peer address, the connected flag, the MTU and all timeout and | ||
| 115 | error information are not copied but instead initialized to zero. | ||
| 116 | .Ss Initialization and configuration | ||
| 117 | If the close flag is set in | ||
| 118 | .Fa b , | ||
| 119 | .Xr BIO_set_fd 3 | ||
| 120 | clears all flags that are set in | ||
| 121 | .Fa b | ||
| 122 | and if the init flag was set, it calls | ||
| 123 | .Xr shutdown 2 | ||
| 124 | and | ||
| 125 | .Xr close 2 | ||
| 126 | on the previously assigned file descriptor. | ||
| 127 | In any case, | ||
| 128 | .Xr BIO_set_fd 3 | ||
| 129 | then sets the new file descriptor and the new close flag according to | ||
| 130 | its arguments and sets the init flag to 1. | ||
| 131 | .Pp | ||
| 132 | If the init flag is set in | ||
| 133 | .Fa b , | ||
| 134 | .Xr BIO_get_fd 3 | ||
| 135 | returns its datagram socket file descriptor, and unless the | ||
| 136 | .Fa c | ||
| 137 | argument is a | ||
| 138 | .Dv NULL | ||
| 139 | pointer, it also stores the file descriptor in | ||
| 140 | .Pf * Fa c . | ||
| 141 | If the init flag is not set, | ||
| 142 | .Xr BIO_get_fd 3 | ||
| 143 | fails and returns \-1. | ||
| 144 | .Pp | ||
| 145 | .Xr BIO_set_close 3 | ||
| 146 | sets the close flag in | ||
| 147 | .Fa b | ||
| 148 | to the | ||
| 149 | .Fa flag | ||
| 150 | argument. | ||
| 151 | .Xr BIO_get_close 3 | ||
| 152 | returns the value of the close flag from | ||
| 153 | .Fa b . | ||
| 154 | .Pp | ||
| 155 | For datagram socket BIO objects, | ||
| 156 | the shutdown flag is the same flag as the close flag. | ||
| 157 | Consequently, | ||
| 158 | .Xr BIO_set_shutdown 3 | ||
| 159 | has the same effect as | ||
| 160 | .Xr BIO_set_close 3 | ||
| 161 | and | ||
| 162 | .Xr BIO_get_shutdown 3 | ||
| 163 | has the same effect as | ||
| 164 | .Xr BIO_get_close 3 . | ||
| 165 | .Pp | ||
| 166 | .Fn BIO_dgram_set_peer | ||
| 167 | copies | ||
| 168 | .Fa sa | ||
| 169 | as the peer address into | ||
| 170 | .Fa b . | ||
| 171 | .Pp | ||
| 172 | .Fn BIO_ctrl_dgram_connect | ||
| 173 | does exactly the same as | ||
| 174 | .Fn BIO_dgram_set_peer . | ||
| 175 | Its name is even more misleading than the name of | ||
| 176 | .Fn BIO_ctrl_set_connected . | ||
| 177 | In addition to what is said there, | ||
| 178 | .Fn BIO_ctrl_dgram_connect | ||
| 179 | does not even set the connected flag in | ||
| 180 | .Fa b . | ||
| 181 | .Pp | ||
| 182 | .Fn BIO_dgram_get_peer | ||
| 183 | copies the peer address from | ||
| 184 | .Fa b | ||
| 185 | to | ||
| 186 | .Pf * Fa sa . | ||
| 187 | Before calling this function, the caller has to make sure | ||
| 188 | that the peer address is indeed set in | ||
| 189 | .Fa b | ||
| 190 | and that sufficient memory is available starting at | ||
| 191 | .Fa sa | ||
| 192 | to copy a complete | ||
| 193 | .Vt struct sockaddr , | ||
| 194 | .Vt struct sockaddr_in , | ||
| 195 | or | ||
| 196 | .Vt struct sockaddr_in6 | ||
| 197 | to that place, depending on which address family | ||
| 198 | .Fa b | ||
| 199 | is currently used for. | ||
| 200 | .Pp | ||
| 201 | Unless | ||
| 202 | .Fa sa | ||
| 203 | is | ||
| 204 | .Dv NULL , | ||
| 205 | .Fn BIO_ctrl_set_connected | ||
| 206 | sets the connected flag in | ||
| 207 | .Fa b | ||
| 208 | and copies | ||
| 209 | .Fa sa | ||
| 210 | as the peer address into | ||
| 211 | .Fa b . | ||
| 212 | If | ||
| 213 | .Fa sa | ||
| 214 | is | ||
| 215 | .Dv NULL , | ||
| 216 | .Fn BIO_ctrl_set_connected | ||
| 217 | clears the connected flag and the peer address in | ||
| 218 | .Fa b . | ||
| 219 | Considering that communication using a datagram protocol is connectionless, | ||
| 220 | the name of this function is misleading. | ||
| 221 | It is neither establishing or terminating a connection nor changing | ||
| 222 | anything with respect to the state of the datagram socket, but merely | ||
| 223 | modifying some purely informational data in the wrapping BIO object. | ||
| 224 | The additional | ||
| 225 | .Fa argl | ||
| 226 | argument is passed through to the callbacks documented in | ||
| 227 | .Xr BIO_set_callback 3 | ||
| 228 | if any such callbacks are installed, but it is otherwise ignored. | ||
| 229 | .Pp | ||
| 230 | .Xr BIO_ctrl 3 | ||
| 231 | with a | ||
| 232 | .Fa cmd | ||
| 233 | of | ||
| 234 | .Dv BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT | ||
| 235 | interprets the | ||
| 236 | .Fa parg | ||
| 237 | argument as a pointer to a | ||
| 238 | .Vt struct timeval | ||
| 239 | and sets the read timeout to the specified absolute UTC time. | ||
| 240 | .Pp | ||
| 241 | .Xr BIO_ctrl 3 | ||
| 242 | with a | ||
| 243 | .Fa cmd | ||
| 244 | of | ||
| 245 | .Dv BIO_CTRL_DGRAM_SET_RECV_TIMEOUT , | ||
| 246 | .Dv BIO_CTRL_DGRAM_GET_RECV_TIMEOUT , | ||
| 247 | .Dv BIO_CTRL_DGRAM_SET_SEND_TIMEOUT , | ||
| 248 | or | ||
| 249 | .Dv BIO_CTRL_DGRAM_GET_SEND_TIMEOUT | ||
| 250 | interprets the | ||
| 251 | .Fa parg | ||
| 252 | argument as a pointer to a | ||
| 253 | .Vt struct timeval | ||
| 254 | and calls | ||
| 255 | .Xr setsockopt 2 | ||
| 256 | or | ||
| 257 | .Xr getsockopt 2 | ||
| 258 | on the datagram socket file descriptor of | ||
| 259 | .Fa b | ||
| 260 | with an argument of | ||
| 261 | .Dv SO_RCVTIMEO | ||
| 262 | or | ||
| 263 | .Dv SO_SNDTIMEO , | ||
| 264 | respectively. | ||
| 265 | .Dv BIO_CTRL_DGRAM_SET_RECV_TIMEOUT | ||
| 266 | and | ||
| 267 | .Dv BIO_CTRL_DGRAM_SET_SEND_TIMEOUT | ||
| 268 | return 1 on succcess, | ||
| 269 | .Dv BIO_CTRL_DGRAM_GET_RECV_TIMEOUT | ||
| 270 | and | ||
| 271 | .Dv BIO_CTRL_DGRAM_GET_SEND_TIMEOUT | ||
| 272 | the number of bytes written to | ||
| 273 | .Pf * Fa parg . | ||
| 274 | All four return \-1 on failure. | ||
| 275 | Remember that | ||
| 276 | .Xr BIO_read 3 | ||
| 277 | may actually use a shorter timeout when | ||
| 278 | .Dv BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT | ||
| 279 | is in effect. | ||
| 280 | .Pp | ||
| 281 | .Xr BIO_ctrl 3 | ||
| 282 | with a | ||
| 283 | .Fa cmd | ||
| 284 | of | ||
| 285 | .Dv BIO_CTRL_DGRAM_GET_FALLBACK_MTU | ||
| 286 | returns 1232 if the peer address is an IPv6 address that is not IPv4 mapped | ||
| 287 | or 548 otherwise. | ||
| 288 | Making sure that a peer address is set before issuing this command | ||
| 289 | is the responsibility of the caller. | ||
| 290 | .Pp | ||
| 291 | .Xr BIO_ctrl 3 | ||
| 292 | with a | ||
| 293 | .Fa cmd | ||
| 294 | of | ||
| 295 | .Dv BIO_CTRL_DGRAM_SET_MTU | ||
| 296 | sets the MTU attribute of | ||
| 297 | .Fa b | ||
| 298 | to the value of the | ||
| 299 | .Fa larg | ||
| 300 | argument and also returns that argument. | ||
| 301 | .Xr BIO_ctrl 3 | ||
| 302 | with a | ||
| 303 | .Fa cmd | ||
| 304 | of | ||
| 305 | .Dv BIO_CTRL_DGRAM_GET_MTU | ||
| 306 | returns the MTU attribute of | ||
| 307 | .Fa b | ||
| 308 | or 0 if it was not set. | ||
| 309 | .Pp | ||
| 310 | .Xr BIO_ctrl 3 | ||
| 311 | with a | ||
| 312 | .Fa cmd | ||
| 313 | of | ||
| 314 | .Dv BIO_CTRL_DGRAM_MTU_EXCEEDED | ||
| 315 | returns 1 if the most recent non-fatal failure of | ||
| 316 | .Xr BIO_read 3 | ||
| 317 | or | ||
| 318 | .Xr BIO_write 3 | ||
| 319 | was caused by | ||
| 320 | .Er EMSGSIZE | ||
| 321 | or 0 otherwise. | ||
| 322 | This command also clears the | ||
| 323 | .Xr errno 2 | ||
| 324 | value that was saved internally for this particular purpose, so that | ||
| 325 | issuing the same command again will return 0 until the next | ||
| 326 | .Er EMSGSIZE | ||
| 327 | failure occurs. | ||
| 328 | .Pp | ||
| 329 | .Fn BIO_dgram_recv_timedout | ||
| 330 | and | ||
| 331 | .Fn BIO_dgram_send_timedout | ||
| 332 | check whether the most recent non-fatal failure of | ||
| 333 | .Xr BIO_read 3 | ||
| 334 | or | ||
| 335 | .Xr BIO_write 3 | ||
| 336 | was caused by | ||
| 337 | .Er EAGAIN . | ||
| 338 | Despite having different names, both functions do exactly the same, | ||
| 339 | and both inspect the most recent non-fatal I/O failure, no matter | ||
| 340 | whether it occurred during a receive or send operation. | ||
| 341 | Both functions also clear the | ||
| 342 | .Xr errno 2 | ||
| 343 | value that was saved internally for this particular purpose, | ||
| 344 | so that calling these functions again will return 0 until the next | ||
| 345 | .Er EAGAIN | ||
| 346 | failure occurs. | ||
| 347 | .Pp | ||
| 348 | Datagram socket BIOs do not support | ||
| 349 | .Xr BIO_eof 3 , | ||
| 350 | .Xr BIO_get_mem_data 3 , | ||
| 351 | .Xr BIO_pending 3 , | ||
| 352 | .Xr BIO_reset 3 , | ||
| 353 | .Xr BIO_seek 3 , | ||
| 354 | .Xr BIO_tell 3 , | ||
| 355 | and | ||
| 356 | .Xr BIO_wpending 3 , | ||
| 357 | and attempting any such operation results in failure | ||
| 358 | and returns a value of 0. | ||
| 359 | .Pp | ||
| 360 | Control commands correspond to accessor functions as follows: | ||
| 361 | .Pp | ||
| 362 | .Bl -tag -width BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP -compact | ||
| 363 | .It Dv BIO_C_GET_FD | ||
| 364 | .Xr BIO_get_fd 3 | ||
| 365 | .It Dv BIO_C_SET_FD | ||
| 366 | .Xr BIO_set_fd 3 | ||
| 367 | .It Dv BIO_CTRL_DGRAM_CONNECT | ||
| 368 | .Fn BIO_ctrl_dgram_connect Pq deprecated | ||
| 369 | .It Dv BIO_CTRL_DGRAM_GET_PEER | ||
| 370 | .Fn BIO_dgram_get_peer | ||
| 371 | .It BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP | ||
| 372 | .Fn BIO_dgram_recv_timedout | ||
| 373 | .It BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP | ||
| 374 | .Fn BIO_dgram_send_timedout | ||
| 375 | .It Dv BIO_CTRL_DGRAM_SET_CONNECTED | ||
| 376 | .Fn BIO_ctrl_set_connected | ||
| 377 | .It Dv BIO_CTRL_DGRAM_SET_PEER | ||
| 378 | .Fn BIO_dgram_set_peer | ||
| 379 | .It Dv BIO_CTRL_GET_CLOSE | ||
| 380 | .Xr BIO_get_close 3 | ||
| 381 | .It Dv BIO_CTRL_SET_CLOSE | ||
| 382 | .Xr BIO_set_close 3 | ||
| 383 | .El | ||
| 384 | .\" OpenBSD does not appear to support | ||
| 385 | .\" BIO_CTRL_DGRAM_MTU_DISCOVER and BIO_CTRL_DGRAM_QUERY_MTU. | ||
| 386 | .Ss Input and output operations | ||
| 387 | .Xr BIO_read 3 | ||
| 388 | attempts to read up to | ||
| 389 | .Fa len | ||
| 390 | bytes into | ||
| 391 | .Fa buf | ||
| 392 | from the datagram socket file descriptor using | ||
| 393 | .Xr recvfrom 2 . | ||
| 394 | If a read timeout is set, | ||
| 395 | .Xr setsockopt 2 | ||
| 396 | is used with an argument of | ||
| 397 | .Dv SO_RCVTIMEO | ||
| 398 | to temporarily shorten the timeout on the datagram socket during the | ||
| 399 | .Xr recvfrom 2 | ||
| 400 | call such that it returns before the read timeout expires. | ||
| 401 | .Pp | ||
| 402 | If | ||
| 403 | .Xr recvfrom 2 | ||
| 404 | succeeds and the connected flag is not yet set, | ||
| 405 | .Xr BIO_read 3 | ||
| 406 | also copies the peer address received from | ||
| 407 | .Xr recvfrom 2 | ||
| 408 | into | ||
| 409 | .Fa b . | ||
| 410 | .Pp | ||
| 411 | If | ||
| 412 | .Xr recvfrom 2 | ||
| 413 | is attempted, | ||
| 414 | .Xr BIO_read 3 | ||
| 415 | clears the flags | ||
| 416 | .Dv BIO_FLAGS_WRITE | ||
| 417 | and | ||
| 418 | .Dv BIO_FLAGS_IO_SPECIAL | ||
| 419 | in | ||
| 420 | .Fa b | ||
| 421 | and clears or sets the flags | ||
| 422 | .Dv BIO_FLAGS_READ | ||
| 423 | and | ||
| 424 | .Dv BIO_FLAGS_SHOULD_RETRY | ||
| 425 | as appropriate. | ||
| 426 | .Pp | ||
| 427 | If the connected flag is set in | ||
| 428 | .Fa b , | ||
| 429 | .Xr BIO_write 3 | ||
| 430 | attempts to | ||
| 431 | .Xr write 2 | ||
| 432 | .Fa len | ||
| 433 | bytes from | ||
| 434 | .Fa buf | ||
| 435 | to the datagram socket file descriptor. | ||
| 436 | If the connected flag is not set, it attempts to transmit | ||
| 437 | .Fa len | ||
| 438 | bytes from | ||
| 439 | .Fa buf | ||
| 440 | to the peer using | ||
| 441 | .Xr sendto 2 . | ||
| 442 | .Pp | ||
| 443 | If | ||
| 444 | .Xr write 2 | ||
| 445 | or | ||
| 446 | .Xr sendto 2 | ||
| 447 | is attempted, | ||
| 448 | .Xr BIO_write 3 | ||
| 449 | clears the flags | ||
| 450 | .Dv BIO_FLAGS_READ | ||
| 451 | and | ||
| 452 | .Dv BIO_FLAGS_IO_SPECIAL | ||
| 453 | in | ||
| 454 | .Fa b | ||
| 455 | and clears or sets the flags | ||
| 456 | .Dv BIO_FLAGS_WRITE | ||
| 457 | and | ||
| 458 | .Dv BIO_FLAGS_SHOULD_RETRY | ||
| 459 | as appropriate. | ||
| 460 | .Pp | ||
| 461 | The effect of | ||
| 462 | .Xr BIO_puts 3 | ||
| 463 | is similar to the effect of | ||
| 464 | .Xr BIO_write 3 | ||
| 465 | with a | ||
| 466 | .Fa len | ||
| 467 | argument of | ||
| 468 | .Fn strlen string . | ||
| 469 | .Pp | ||
| 470 | Datagram socket BIOs do not support | ||
| 471 | .Xr BIO_gets 3 . | ||
| 472 | Calling this function fails and returns \-2. | ||
| 473 | .Pp | ||
| 474 | .Xr BIO_flush 3 | ||
| 475 | has no effect on a datagram socket BIO. | ||
| 476 | It always succeeds and returns 1. | ||
| 477 | .Sh RETURN VALUES | ||
| 478 | .Fn BIO_s_datagram | ||
| 479 | returns the datagram socket BIO method. | ||
| 480 | .Pp | ||
| 481 | .Fn BIO_new_dgram | ||
| 482 | returns a newly allocated datagram socket BIO object or | ||
| 483 | .Dv NULL | ||
| 484 | on failure. | ||
| 485 | .Pp | ||
| 486 | .Fn BIO_dgram_set_peer , | ||
| 487 | .Fn BIO_ctrl_dgram_connect , | ||
| 488 | and | ||
| 489 | .Fn BIO_ctrl_set_connected | ||
| 490 | return 1 on success or a value less than or equal to zero on failure. | ||
| 491 | They can only fail if | ||
| 492 | .Fa b | ||
| 493 | is not a datagram socket BIO object. | ||
| 494 | .Pp | ||
| 495 | .Fn BIO_dgram_get_peer | ||
| 496 | returns the number of bytes copied to | ||
| 497 | .Fa sa | ||
| 498 | or a value less than or equal to zero on failure. | ||
| 499 | It can only fail if | ||
| 500 | .Fa b | ||
| 501 | is not a datagram socket BIO object. | ||
| 502 | .Pp | ||
| 503 | .Fn BIO_dgram_recv_timedout | ||
| 504 | and | ||
| 505 | .Fn BIO_dgram_send_timedout | ||
| 506 | return 1 if the most recent non-fatal I/O error was caused by | ||
| 507 | .Er EAGAIN | ||
| 508 | or 0 otherwise. | ||
| 509 | .Pp | ||
| 510 | .Fn BIO_dgram_non_fatal_error | ||
| 511 | returns 1 if | ||
| 512 | .Fa errnum | ||
| 513 | is | ||
| 514 | .Er EAGAIN , | ||
| 515 | .Er EALREADY , | ||
| 516 | .Er EINPROGRESS , | ||
| 517 | or | ||
| 518 | .Er EINTR | ||
| 519 | or 0 otherwise, even if | ||
| 520 | .Fa errnum | ||
| 521 | is 0. | ||
| 522 | .Sh SEE ALSO | ||
| 523 | .Xr close 2 , | ||
| 524 | .Xr getsockopt 2 , | ||
| 525 | .Xr recvfrom 2 , | ||
| 526 | .Xr sendto 2 , | ||
| 527 | .Xr shutdown 2 , | ||
| 528 | .Xr BIO_ctrl 3 , | ||
| 529 | .Xr BIO_get_init 3 , | ||
| 530 | .Xr BIO_new 3 , | ||
| 531 | .Xr BIO_read 3 , | ||
| 532 | .Xr BIO_s_connect 3 , | ||
| 533 | .Xr BIO_set_fd 3 , | ||
| 534 | .Xr BIO_should_retry 3 , | ||
| 535 | .Xr udp 4 | ||
| 536 | .Sh HISTORY | ||
| 537 | .Fn BIO_s_datagram , | ||
| 538 | .Fn BIO_new_dgram , | ||
| 539 | .Fn BIO_dgram_set_peer , | ||
| 540 | .Fn BIO_ctrl_dgram_connect , | ||
| 541 | .Fn BIO_ctrl_set_connected , | ||
| 542 | .Fn BIO_dgram_recv_timedout , | ||
| 543 | .Fn BIO_dgram_send_timedout , | ||
| 544 | and | ||
| 545 | .Fn BIO_dgram_non_fatal_error | ||
| 546 | first appeared in OpenSSL 0.9.8 and have been available since | ||
| 547 | .Ox 4.5 . | ||
| 548 | .Pp | ||
| 549 | .Fn BIO_dgram_get_peer | ||
| 550 | first appeared in OpenSSL 0.9.8m and has been available since | ||
| 551 | .Ox 4.9 . | ||
| 552 | .Sh BUGS | ||
| 553 | If | ||
| 554 | .Xr getsockopt 2 | ||
| 555 | or | ||
| 556 | .Xr setsockopt 2 | ||
| 557 | fails during | ||
| 558 | .Xr BIO_read 3 , | ||
| 559 | the library prints an error message to standard error output | ||
| 560 | but otherwise ignores the problem, thus possibly using unintended | ||
| 561 | timeout values. | ||
| 562 | .Pp | ||
| 563 | .Xr BIO_read 3 | ||
| 564 | and | ||
| 565 | .Xr BIO_write 3 | ||
| 566 | may clear the global variable | ||
| 567 | .Xr errno 2 | ||
| 568 | before attempting the | ||
| 569 | .Xr recvfrom 2 | ||
| 570 | or | ||
| 571 | .Xr sendto 2 | ||
| 572 | system call but may not clear it if they fail before reaching this point. | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index b67ae786de..f18336625d 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.241 2022/12/22 21:05:48 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.242 2022/12/23 15:59:34 schwarze Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
| 4 | 4 | ||
| @@ -58,6 +58,7 @@ MAN= \ | |||
| 58 | BIO_s_accept.3 \ | 58 | BIO_s_accept.3 \ |
| 59 | BIO_s_bio.3 \ | 59 | BIO_s_bio.3 \ |
| 60 | BIO_s_connect.3 \ | 60 | BIO_s_connect.3 \ |
| 61 | BIO_s_datagram.3 \ | ||
| 61 | BIO_s_fd.3 \ | 62 | BIO_s_fd.3 \ |
| 62 | BIO_s_file.3 \ | 63 | BIO_s_file.3 \ |
| 63 | BIO_s_mem.3 \ | 64 | BIO_s_mem.3 \ |
