SSL_GET_ALL_ASYNC_FDS(3ossl)

πŸ’– SSL_GET_ALL_ASYNC_FDS πŸ’–

okay bestie, this one is SSL_GET_ALL_ASYNC_FDS(3ossl) β€” the 3ossl is just the manual section, slay. it's all about managing asynchronous operations in OpenSSL. the trio of girlies we're covering: SSL_waiting_for_async, SSL_get_all_async_fds, and SSL_get_changed_async_fds. ✨


✨ SYNOPSIS ✨

like, here's the receipts:

#include <openssl/async.h>
#include <openssl/ssl.h>

int SSL_waiting_for_async(SSL *s);
int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fd, size_t *numfds);
int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, size_t *numaddfds,
                              OSSL_ASYNC_FD *delfd, size_t *numdelfds);

πŸ¦‹ DESCRIPTION πŸ¦‹

SSL_waiting_for_async() β€” it's giving detective energy πŸ”. it tells you whether an SSL connection is currently waiting for asynchronous operations to complete (peep the SSL_MODE_ASYNC mode in SSL_CTX_set_mode(3), iykyk).

SSL_get_all_async_fds() β€” returns a list of file descriptors that you can hand to select() or poll() to figure out whether the current asynchronous operation has completed or not. a completed operation will make data show up as "read ready" on the file descriptor β€” and no cap, you should NOT actually read any data from the file descriptor, it's just a vibe check. 🫢

fr fr, only call this if the SSL object is currently waiting for asynchronous work to complete β€” i.e. you already got SSL_ERROR_WANT_ASYNC (see SSL_get_error(3)). don't be calling it out of pocket.

typically the list will only contain one file descriptor. but β€” plot twist β€” if multiple asynchronous capable engines are in use, then more than one is possible. πŸ’…

the number of file descriptors returned gets stored in *numfds, and the file descriptors themselves live in *fds. the fds parameter may be NULL, in which case no file descriptors are returned but *numfds is still populated. it is the caller's responsibility to ensure sufficient memory is allocated at *fds, so typically this function is called twice β€” once with a NULL fds parameter and once without. two-step queen behavior, we love a methodical moment. 😌

SSL_get_changed_async_fds() β€” returns a list of the asynchronous file descriptors that have been added and a list that have been deleted since the last SSL_ERROR_WANT_ASYNC was received (or since the SSL object was created, if no SSL_ERROR_WANT_ASYNC has been received). similar to SSL_get_all_async_fds(), it is the caller's responsibility to ensure that *addfd and *delfd have sufficient memory allocated, although they may be NULL. the number of added fds and the number of deleted fds are stored in *numaddfds and *numdelfds respectively. the diff, bestie. we're tracking the diff. πŸ“Š


🌈 RETURN VALUES 🌈

  • SSL_waiting_for_async() returns 1 if the current SSL operation is waiting for an async operation to complete, and 0 otherwise.
  • SSL_get_all_async_fds() and SSL_get_changed_async_fds() return 1 on success or 0 on error.

πŸŽ€ NOTES πŸŽ€

on Windows platforms the <openssl/async.h> header is dependent on some of the types customarily made available by including <windows.h>. the application developer is likely to require control over when the latter is included β€” commonly as one of the first included headers. therefore, it is defined as an application developer's responsibility to include <windows.h> prior to <openssl/async.h>. not me handing you the order of operations, but like, the order matters. πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

ssl(7), SSL_get_error(3), SSL_CTX_set_mode(3)


⭐ HISTORY ⭐

the SSL_waiting_for_async(), SSL_get_all_async_fds() and SSL_get_changed_async_fds() functions were added in OpenSSL 1.1.0. glow up complete. ✨


Copyright 2016-2021 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 🧚 β€” this was SSL_GET_ALL_ASYNC_FDS(3ossl) from OpenSSL 3.5.9, dated 2026-09-29. periodt. πŸ’…πŸŒΈ

πŸ“¦ where this page comes from