SSL_SET_ASYNC_CALLBACK(3SSL)
π SSL_SET_ASYNC_CALLBACK π
okay bestie, this is the <openssl/ssl.h> page about async operations β the SSL_SET_ASYNC_CALLBACK(3SSL) situation, part of the OpenSSL fam. if your crypto provider does things β¨laterβ¨ and needs to ping you when it's done, this is the page, iykyk π¦
β¨ NAME β¨
SSL_CTX_set_async_callback, SSL_CTX_set_async_callback_arg, SSL_set_async_callback, SSL_set_async_callback_arg, SSL_get_async_status, SSL_async_callback_fn β literally the whole squad for managing asynchronous operations π
π SYNOPSIS π
#include <openssl/ssl.h>
typedef int (*SSL_async_callback_fn)(SSL *s, void *arg);
int SSL_CTX_set_async_callback(SSL_CTX *ctx, SSL_async_callback_fn callback);
int SSL_CTX_set_async_callback_arg(SSL_CTX *ctx, void *arg);
int SSL_set_async_callback(SSL *s, SSL_async_callback_fn callback);
int SSL_set_async_callback_arg(SSL *s, void *arg);
int SSL_get_async_status(SSL *s, int *status);
π DESCRIPTION π
so here's the tea, function by function π
SSL_CTX_set_async_callback()β sets an asynchronous callback function. every singleSSLobject born from thisSSL_CTXinherits that callback, no cap. and if a provider supports the callback mechanism, it gets called automatically whenSSL_MODE_ASYNChas been set and the provider finishes a cryptography operation β that's how it tells your app "hey bestie, come resume the paused work flow" π«ΆSSL_CTX_set_async_callback_arg()β sets the callback argument. that's it, that's the job πSSL_set_async_callback()β lets an application set a callback on an asynchronousSSLobject, so when a provider wraps up a cryptography operation, the callback fires to notify the application to resume the paused work flow β¨SSL_set_async_callback_arg()β sets an argument for theSSLobject for when that callback above gets called πSSL_get_async_status()β returns the provider status. this one is basically the provider-to-application hotline. during anSSLsession, cryptographic operations get dispatched to a provider, and the provider status is so useful for an app to know whether the operation was successfully dispatched. if the provider doesn't support this extra callback method,ASYNC_STATUS_UNSUPPORTEDcomes back at you. for the whole description of every status value, go peek atASYNC_WAIT_CTX_set_status()π
πΈ an example, because visuals help πΈ
so like, the above functions in action would be:
- the application sets the async callback and callback data on an
SSLconnection by callingSSL_set_async_callback(). - the application sets
SSL_MODE_ASYNCand makes an asynchronousSSLcall. - OpenSSL submits the asynchronous request to the provider. if a retry occurs at this point, then the status within the
ASYNC_WAIT_CTXwould be set and the async callback function would be called (goto Step 7). - the OpenSSL provider pauses the current job and returns, so the application can keep processing other connections in the meantime β¨ multitasking queen.
- at a future point in time (probably via a polling mechanism or via an interrupt), the provider will become aware that the asynchronous request has finished processing.
- the provider will call the application's callback, passing the callback data as a parameter.
- the callback function should then run. note: it is a requirement that the callback function is small and nonblocking, because it will be run in the context of a polling mechanism or an interrupt. so likeβ¦ keep it tiny, bestie π
- it is the application's responsibility, via the callback function, to schedule recalling the OpenSSL asynchronous function and to continue processing.
- the callback function has the option to check the status returned via
SSL_get_async_status()to determine whether a retry happened instead of the request being submitted β which lets you do different processing if required. flexible π
π₯ RETURN VALUES π₯
SSL_CTX_set_async_callback(), SSL_set_async_callback(), SSL_CTX_set_async_callback_arg(), SSL_CTX_set_async_callback_arg() and SSL_get_async_status() return 1 on success or 0 on error. that's the whole vibe check: 1 slay, 0 not slay π
π¦ SEE ALSO π¦
π HISTORY π
SSL_CTX_set_async_callback(), SSL_CTX_set_async_callback_arg(), SSL_set_async_callback(), SSL_set_async_callback_arg() and SSL_get_async_status() were first added to OpenSSL 3.0. little baby functions, all grown up now π₯Ή
π COPYRIGHT π
Copyright 2019-2025 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 a wrap, bestie π this was OpenSSL 4.0.3, dated 2026-09-29 β SSL_SET_ASYNC_CALLBACK(3SSL), signing off πβ¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms