| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "SSL_HANDLE_EVENTS 3SSL" |
| 58 |
.TH SSL_HANDLE_EVENTS 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
SSL_handle_events \- advance asynchronous state machine and perform network I/O |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
.Vb 1 |
| 68 |
\& #include <openssl/ssl.h> |
| 69 |
\& |
| 70 |
\& int SSL_handle_events(SSL *ssl); |
| 71 |
.Ve |
| 72 |
.SH DESCRIPTION |
| 73 |
.IX Header "DESCRIPTION" |
| 74 |
\&\fBSSL_handle_events()\fR performs any internal processing which is due on an SSL object. The |
| 75 |
exact operations performed by \fBSSL_handle_events()\fR vary depending on what kind of protocol |
| 76 |
is being used with the given SSL object. For example, \fBSSL_handle_events()\fR may handle |
| 77 |
timeout events which have become due, or may attempt, to the extent currently |
| 78 |
possible, to perform network I/O operations on one of the BIOs underlying the |
| 79 |
SSL object. |
| 80 |
.PP |
| 81 |
The primary use case for \fBSSL_handle_events()\fR is to allow an application which uses |
| 82 |
OpenSSL in nonblocking mode to give OpenSSL an opportunity to handle timer |
| 83 |
events, or to respond to the availability of new data to be read from an |
| 84 |
underlying BIO, or to respond to the opportunity to write pending data to an |
| 85 |
underlying BIO. |
| 86 |
.PP |
| 87 |
\&\fBSSL_handle_events()\fR can be used only with the following types of SSL object: |
| 88 |
.IP "DTLS SSL objects" 4 |
| 89 |
.IX Item "DTLS SSL objects" |
| 90 |
Using \fBSSL_handle_events()\fR on an SSL object being used with a DTLS method allows timeout |
| 91 |
events to be handled properly. This is equivalent to a call to |
| 92 |
\&\fBDTLSv1_handle_timeout\fR\|(3). Since \fBSSL_handle_events()\fR handles a superset of the use |
| 93 |
cases of \fBDTLSv1_handle_timeout\fR\|(3), it should be preferred for new |
| 94 |
applications which do not require support for OpenSSL 3.1 or older. |
| 95 |
.Sp |
| 96 |
When using DTLS, an application must call \fBSSL_handle_events()\fR as indicated by |
| 97 |
calls to \fBSSL_get_event_timeout\fR\|(3); event handling is not performed |
| 98 |
automatically by calls to other SSL functions such as \fBSSL_read\fR\|(3) or |
| 99 |
\&\fBSSL_write\fR\|(3). Note that this is different to QUIC which also performs event |
| 100 |
handling implicitly; see below. |
| 101 |
.IP "QUIC connection SSL objects" 4 |
| 102 |
.IX Item "QUIC connection SSL objects" |
| 103 |
Using \fBSSL_handle_events()\fR on an SSL object which represents a QUIC connection allows |
| 104 |
timeout events to be handled properly, as well as incoming network data to be |
| 105 |
processed, and queued outgoing network data to be written, if the underlying BIO |
| 106 |
has the capacity to accept it. |
| 107 |
.Sp |
| 108 |
Ordinarily, when an application uses an SSL object in blocking mode, it does not |
| 109 |
need to call \fBSSL_handle_events()\fR because OpenSSL performs ticking internally on an |
| 110 |
automatic basis. However, if an application uses a QUIC connection in |
| 111 |
nonblocking mode, it must at a minimum ensure that \fBSSL_handle_events()\fR is called |
| 112 |
periodically to allow timeout events to be handled. An application can find out |
| 113 |
when it next needs to call \fBSSL_handle_events()\fR for this purpose (if at all) by calling |
| 114 |
\&\fBSSL_get_event_timeout\fR\|(3). |
| 115 |
.Sp |
| 116 |
Calling \fBSSL_handle_events()\fR on a QUIC connection SSL object being used in blocking mode |
| 117 |
is not necessary unless no I/O calls (such as \fBSSL_read\fR\|(3) or \fBSSL_write\fR\|(3)) |
| 118 |
will be made to the object for a substantial period of time. So long as at least |
| 119 |
one call to the SSL object is blocking, no such call is needed. However, |
| 120 |
\&\fBSSL_handle_events()\fR may optionally be used on a QUIC connection object if desired. |
| 121 |
.Sp |
| 122 |
With the thread-assisted mode of operation \fBOSSL_QUIC_client_thread_method\fR\|(3) |
| 123 |
it is unnecessary to call \fBSSL_handle_events()\fR as the assist thread handles the QUIC |
| 124 |
connection events. |
| 125 |
.PP |
| 126 |
Calling \fBSSL_handle_events()\fR on any other kind of SSL object is a no-op. This is |
| 127 |
considered a success case. |
| 128 |
.PP |
| 129 |
Note that \fBSSL_handle_events()\fR supersedes the older \fBDTLSv1_handle_timeout\fR\|(3) function |
| 130 |
for all use cases. |
| 131 |
.SH "RETURN VALUES" |
| 132 |
.IX Header "RETURN VALUES" |
| 133 |
Returns 1 on success and 0 on failure. |
| 134 |
.SH "SEE ALSO" |
| 135 |
.IX Header "SEE ALSO" |
| 136 |
\&\fBSSL_get_event_timeout\fR\|(3), \fBDTLSv1_handle_timeout\fR\|(3), \fBssl\fR\|(7) |
| 137 |
.SH HISTORY |
| 138 |
.IX Header "HISTORY" |
| 139 |
The \fBSSL_handle_events()\fR function was added in OpenSSL 3.2. |
| 140 |
.SH COPYRIGHT |
| 141 |
.IX Header "COPYRIGHT" |
| 142 |
Copyright 2023 The OpenSSL Project Authors. All Rights Reserved. |
| 143 |
.PP |
| 144 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 145 |
this file except in compliance with the License. You can obtain a copy |
| 146 |
in the file LICENSE in the source distribution or at |
| 147 |
<https://www.openssl.org/source/license.html>. |