SSL_WANT(3ossl)

πŸ’… SSL_WANT(3ossl) β€” like, the OpenSSL manual, but make it make sense

okay bestie, gather round, because we're about to talk about SSL_WANT and its whole little squad: 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, and SSL_want_client_hello_cb. Yes that's a lot of names. No, you don't have to memorise them all at once. This is the OpenSSL 3ossl page and it's literally just about asking an SSL object how it's feeling. 🫢


✨ NAME ✨

so basically: 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 your little state-information girlies. They tell you what's up with 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);

like, copy-paste that header include first or nothing works, periodt. πŸ“‹


πŸ’– DESCRIPTION πŸ’–

SSL_want() hands you back state information for the SSL object ssl.

🚨 okay IMPORTANT: ssl MUST NOT be NULL. Not "shouldn't". MUST NOT. Do not pass NULL, bestie, I'm begging. πŸ’€

and then all the other SSL_want_*() calls? they're just shortcuts. little convenience besties for the possible states that SSL_want() can return. no cap.


🧠 NOTES 🧠

SSL_want() goes poking around inside the SSL object's internal state information. its return values are similar to what SSL_get_error(3) gives you β€” but here's the ✨key difference✨: SSL_get_error(3) also evaluates the error queue, whereas SSL_want() gets its results by examining an internal state flag only.

so because of that, this info must only be used for normal operation under nonblocking I/O. it's giving "happy path only" energy. error conditions 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). they're a matched set, iykyk.


πŸ‘‘ RETURN VALUES πŸ‘‘

here's the roster of return values that can currently occur for SSL_want():

  • SSL_NOTHING β€” there's no data to be written or to be read. literally nothing going on. quiet. peaceful. πŸ¦‹
  • SSL_WRITING β€” there's data sitting in the SSL buffer that must be written to the underlying BIO layer to complete the actual SSL_*() operation. a call to SSL_get_error(3) should return SSL_ERROR_WANT_WRITE. ✍️
  • SSL_READING β€” more data must be read from the underlying BIO layer to complete the actual SSL_*() operation. a call to SSL_get_error(3) should return SSL_ERROR_WANT_READ. πŸ“–
  • SSL_X509_LOOKUP β€” the operation didn't complete because an application callback set by SSL_CTX_set_client_cert_cb() has asked to be called again. a call to SSL_get_error(3) should return SSL_ERROR_WANT_X509_LOOKUP. πŸ”Ž
  • SSL_RETRY_VERIFY β€” the operation didn't complete because a certificate verification callback has asked to be called again via SSL_set_retry_verify(3). a call to SSL_get_error(3) should return SSL_ERROR_WANT_RETRY_VERIFY. πŸŽ€
  • SSL_ASYNC_PAUSED β€” an asynchronous operation partially completed and was then paused. see SSL_get_all_async_fds(3). a call to SSL_get_error(3) should return SSL_ERROR_WANT_ASYNC. ⏸️
  • SSL_ASYNC_NO_JOBS β€” the asynchronous job could not be started because there were no async jobs available in the pool (see ASYNC_init_thread(3)). a call to SSL_get_error(3) should return SSL_ERROR_WANT_ASYNC_JOB. 😭
  • SSL_CLIENT_HELLO_CB β€” the operation didn't complete because an application callback set by SSL_CTX_set_client_hello_cb() has asked to be called again. a call to SSL_get_error(3) should return SSL_ERROR_WANT_CLIENT_HELLO_CB. 🌈

and the shortcut besties β€” 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() β€” return 1 when the corresponding condition is true, or 0 otherwise. simple as that, no drama. βœ…


🧚 QUIC-SPECIFIC CONSIDERATIONS 🧚

for QUIC, these functions relate only to the TLS handshake layer. that's it, that's the whole note. stay in your lane, handshake. πŸ’…


πŸ”— SEE ALSO πŸ”—


πŸ“œ HISTORY πŸ“œ

the SSL_want_client_hello_cb() function and the SSL_CLIENT_HELLO_CB return value were added in OpenSSL 1.1.1. so if you're on something ancient, that's why it's not there, bestie. πŸ™ˆ


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, babe πŸŽ€ this was OpenSSL version 3.5.9, dated 2026-09-29, and it lives under the manual name SSL_WANT(3ossl). go forth and check your state flags responsibly, mwah πŸ’–βœ¨

πŸ“¦ where this page comes from