SSL_HANDLE_EVENTS(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… SSL_HANDLE_EVENTS(3ossl) β€” the OpenSSL glow-up page

okay so bestie, welcome to SSL_HANDLE_EVENTS, one of those OpenSSL man pages from the 3ossl collection that sounds kinda scary but is literally just "hey, give OpenSSL a lil moment to do its internal chores." Buckle up, it's giving very main-character energy and honestly? You're gonna slay this one. πŸ¦‹


✨ NAME ✨

SSL_handle_events β€” advance the asynchronous state machine and perform network I/O. no cap, that's the whole vibe. πŸŽ€

🌸 SYNOPSIS 🌸

#include <openssl/ssl.h>

int SSL_handle_events(SSL *ssl);

one function, one SSL *, one int coming back at you. iconic. πŸ’…

🫢 DESCRIPTION 🫢

okay so SSL_handle_events() does any internal processing that's due on an SSL object. and the exact operations it performs lowkey vary depending on what kind of protocol you're running with that given SSL object. for example, SSL_handle_events() may handle timeout events that have become due, or it may attempt β€” to the extent currently possible β€” to perform network I/O operations on one of the BIOs underlying the SSL object. ✨

the primary use case for SSL_handle_events() is to let an application that uses OpenSSL in nonblocking mode give OpenSSL an opportunity to:

  • handle timer events,
  • respond to the availability of new data to be read from an underlying BIO,
  • or respond to the opportunity to write pending data to an underlying BIO.

so like, it's the "hey bestie, you have a sec?" function. 🌈

SSL_handle_events() can be used only with the following types of SSL object:

  • DTLS SSL objects β€” using SSL_handle_events() on an SSL object being used with a DTLS method allows timeout events to be handled properly. this is equivalent to a call to DTLSv1_handle_timeout(3). and since SSL_handle_events() handles a superset of the use cases of DTLSv1_handle_timeout(3), it should be preferred for new applications which do not require support for OpenSSL 3.1 or older. πŸ‘‘

when using DTLS, an application must call SSL_handle_events() as indicated by calls to SSL_get_event_timeout(3); event handling is not performed automatically by calls to other SSL functions such as SSL_read(3) or SSL_write(3). note that this is different to QUIC, which also performs event handling implicitly β€” see below. πŸ™ˆ

  • QUIC connection SSL objects β€” using SSL_handle_events() on an SSL object which represents a QUIC connection allows timeout events to be handled properly, as well as incoming network data to be processed, and queued outgoing network data to be written, if the underlying BIO has the capacity to accept it. πŸ”₯

ordinarily, when an application uses an SSL object in blocking mode, it does not need to call SSL_handle_events() because OpenSSL performs ticking internally on an automatic basis. however, if an application uses a QUIC connection in nonblocking mode, it must at a minimum ensure that SSL_handle_events() is called periodically to allow timeout events to be handled. an application can find out when it next needs to call SSL_handle_events() for this purpose (if at all) by calling SSL_get_event_timeout(3). ⏰

calling SSL_handle_events() on a QUIC connection SSL object being used in blocking mode is not necessary unless no I/O calls (such as SSL_read(3) or SSL_write(3)) will be made to the object for a substantial period of time. so long as at least one call to the SSL object is blocking, no such call is needed. however, SSL_handle_events() may optionally be used on a QUIC connection object if desired. πŸ’–

with the thread-assisted mode of operation OSSL_QUIC_client_thread_method(3) it is unnecessary to call SSL_handle_events() as the assist thread handles the QUIC connection events. like, she's got it covered, don't worry. 🧚

calling SSL_handle_events() on any other kind of SSL object is a no-op. this is considered a success case. yes bestie, doing nothing on purpose still counts as winning. πŸ’€

note that SSL_handle_events() supersedes the older DTLSv1_handle_timeout(3) function for all use cases. out with the old, in with the iconic. ⭐

πŸ‘‘ RETURN VALUES πŸ‘‘

returns 1 on success and 0 on failure. short, sweet, slays. ✨

πŸ¦‹ SEE ALSO πŸ¦‹

SSL_get_event_timeout(3), DTLSv1_handle_timeout(3), ssl(7)

go read those too, iykyk. πŸ“š

πŸ’œ HISTORY πŸ’œ

the SSL_handle_events() function was added in OpenSSL 3.2. so if you're on anything older, sorry babe, she's not there yet. 😭

Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


and that's the whole page, bestie β€” no notes, absolutely ate. this lil writeup is from version 3.5.0, dated 2026-09-25, filed under SSL_HANDLE_EVENTS(3ossl). go forth and handle your events. πŸ“πŸ’…πŸ«Ά

πŸ“¦ where this page comes from