SSL_WANT(3ossl)
π SSL_WANT(3ossl) β the vibe check your TLS connection needed β¨
okay bestie, so this is the SSL_WANT(3ossl) page from the OpenSSL fam, and it's genuinely so useful β it's literally how you find out what your TLS/SSL I/O operation is waiting on. no cap, if you're doing nonblocking I/O you're gonna be obsessed with this one π«Ά
πΈ NAME πΈ
SSL_want, SSL_want_nothing, SSL_want_read, SSL_want_write, SSL_want_x509_lookup, SSL_want_retry_verify, SSL_want_async, SSL_want_async_job, SSL_want_client_hello_cb β these are the girlies that get you state information about a TLS/SSL I/O operation π
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
int SSL_want(const SSL *ssl);
int SSL_want_nothing(const SSL *ssl);
int SSL_want_read(const SSL *ssl);
int SSL_want_write(const SSL *ssl);
int SSL_want_x509_lookup(const SSL *ssl);
int SSL_want_retry_verify(const SSL *ssl);
int SSL_want_async(const SSL *ssl);
int SSL_want_async_job(const SSL *ssl);
int SSL_want_client_hello_cb(const SSL *ssl);
π¦ DESCRIPTION π¦
So SSL_want() hands you the state information for the SSL object ssl. and listen β ssl MUST NOT be NULL. like, at all. don't do that to her π
The other SSL_want_*() calls? total shortcuts, bestie. each one is just a cute little shortcut for one of the possible states that SSL_want() can return β¨
π NOTES π
SSL_want() peeks at the internal state information of the SSL object. the return values are similar to what you'd get from SSL_get_error(3). but β and this is the important part β unlike SSL_get_error(3), which also evaluates the error queue, SSL_want() gets its results by examining an internal state flag only. so the info is only meant to be used for normal operation under nonblocking I/O, periodt π
error conditions? not her job. those are not handled here and must be treated using SSL_get_error(3).
and the result returned by SSL_want() should always be consistent with the result of SSL_get_error(3). always bestie, no exceptions π
π RETURN VALUES π
so here's the roster of return values that can currently occur for SSL_want() β get into it:
SSL_NOTHINGβ there is no data to be written or to be read. a whole lotta nothing, but make it valid πSSL_WRITINGβ there are data in the SSL buffer that must be written to the underlying BIO layer in order to complete the actualSSL_*()operation. a call toSSL_get_error(3)should returnSSL_ERROR_WANT_WRITE.SSL_READINGβ more data must be read from the underlying BIO layer in order to complete the actualSSL_*()operation. a call toSSL_get_error(3)should returnSSL_ERROR_WANT_READ.SSL_X509_LOOKUPβ the operation did not complete because an application callback set bySSL_CTX_set_client_cert_cb()has asked to be called again. a call toSSL_get_error(3)should returnSSL_ERROR_WANT_X509_LOOKUP.SSL_RETRY_VERIFYβ the operation did not complete because a certificate verification callback has asked to be called again viaSSL_set_retry_verify(3). a call toSSL_get_error(3)should returnSSL_ERROR_WANT_RETRY_VERIFY.SSL_ASYNC_PAUSEDβ an asynchronous operation partially completed and was then paused. seeSSL_get_all_async_fds(3). a call toSSL_get_error(3)should returnSSL_ERROR_WANT_ASYNC.SSL_ASYNC_NO_JOBSβ the asynchronous job could not be started because there were no async jobs available in the pool (seeASYNC_init_thread(3)). a call toSSL_get_error(3)should returnSSL_ERROR_WANT_ASYNC_JOB.SSL_CLIENT_HELLO_CBβ the operation did not complete because an application callback set bySSL_CTX_set_client_hello_cb()has asked to be called again. a call toSSL_get_error(3)should returnSSL_ERROR_WANT_CLIENT_HELLO_CB.
and for the shortcut squad β SSL_want_nothing(), SSL_want_read(), SSL_want_write(), SSL_want_x509_lookup(), SSL_want_retry_verify(), SSL_want_async(), SSL_want_async_job(), and SSL_want_client_hello_cb() β they return 1 when the corresponding condition is true, or 0 otherwise. iconic, simple, love that for them π
π QUIC-SPECIFIC CONSIDERATIONS π
for QUIC, these functions relate only to the TLS handshake layer. that's it, that's the whole note, but it matters so don't skip it β¨
π₯ SEE ALSO π₯
ssl(7), SSL_get_error(3) β go read these next, they're the supporting cast and they ate π
β HISTORY β
the SSL_want_client_hello_cb() function and the SSL_CLIENT_HELLO_CB return value were added in OpenSSL 1.1.1. a lil throwback moment π
π COPYRIGHT π
Copyright 2001-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!! this one's from OpenSSL 3.5.6, dated 2026-04-07, filed under SSL_WANT(3ossl) β go forth and check your state flags responsibly π
πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms