SSL_GET_ALL_ASYNC_FDS(3ossl)

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

πŸ’… SSL_GET_ALL_ASYNC_FDS(3ossl) β€” like, the async-fd management page, bestie

okay so this is the 3ossl manual page for SSL_waiting_for_async, SSL_get_all_async_fds and SSL_get_changed_async_fds, and honestly? it's giving "async operations but make it a to-do list" energy. stay with me, it's not scary 🫢


✨ NAME ✨

SSL_waiting_for_async, SSL_get_all_async_fds, SSL_get_changed_async_fds β€” manage asynchronous operations πŸ’«


🌸 SYNOPSIS 🌸

#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);

copy these exactly, no cap. the compiler is not your friend if you freestyle the signatures πŸ’€


πŸ¦‹ DESCRIPTION πŸ¦‹

the vibe check: SSL_waiting_for_async()

SSL_waiting_for_async() determines whether an SSL connection is currently waiting for asynchronous operations to complete β€” and like, that's the SSL_MODE_ASYNC mode in SSL_CTX_set_mode(3), iykyk. basically: is your connection in its waiting era or not 😭

SSL_get_all_async_fds() β€” the fd list drop πŸ‘‘

SSL_get_all_async_fds() returns a list of file descriptor which can be used in a call to select() or poll() to determine whether the current asynchronous operation has completed or not. so you hand these fds to select()/poll() and let them do the watching, periodt.

a completed operation will result in data appearing as "read ready" on the file descriptor β€” and no actual data should be read from the file descriptor ⚠️ like, it's signalling, not snacking. do not read it. hands off.

this function should only be called if the SSL object is currently waiting for asynchronous work to complete β€” i.e. SSL_ERROR_WANT_ASYNC has been received, see SSL_get_error(3). typically the list will only contain one file descriptor. however, if multiple asynchronous capable engines are in use then more than one is possible.

the number of file descriptors returned is stored in *numfds and the file descriptors themselves are in *fds. the fds parameter may be NULL, in which case no file descriptors are returned, but *numfds is still populated. and here's the part everyone forgets: 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. classic "first ask how many, then ask for the goods" two-step πŸ’…

SSL_get_changed_async_fds() β€” the delta report 🌈

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). it's the what's-new / what's-gone update πŸŽ€

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. two lists, two counters, one very organised bestie 🧚


⭐ RETURN VALUES ⭐

  • SSL_waiting_for_async() β€” returns 1 if the current SSL operation is waiting for an async operation to complete, and 0 otherwise. simple. iconic.
  • SSL_get_all_async_fds() and SSL_get_changed_async_fds() β€” return 1 on success or 0 on error. always check, bestie, fr fr πŸ™ˆ

πŸ“ 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> πŸ’€

⚠️ order matters here, like genuinely. <windows.h> first, then <openssl/async.h>. don't come crying to me when it doesn't compile 😭

πŸ’œ SEE ALSO πŸ’œ

ssl(7), SSL_get_error(3), SSL_CTX_set_mode(3) β€” go read those next, they're literally the lore 🫢


πŸ”₯ 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. so they've been serving since day one, periodt ✨


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 rewrite is living in version 3.5.0, dated 2026-09-25, and yeah β€” it's still the SSL_GET_ALL_ASYNC_FDS(3ossl) of our hearts. go forth and select() responsibly πŸ’–

πŸ“¦ where this page comes from