SSL_WANT(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

🌸 NAME 🌸

okay so welcome to SSL_WANT(3), bestie β€” this is the Library Functions Manual page for the little crew of functions that obtain state information about a TLS/SSL I/O operation. The squad is:

  • SSL_want, SSL_want_nothing, SSL_want_read, SSL_want_write, SSL_want_x509_lookup β€” obtain state information about a TLS/SSL I/O operation. yes, all of them, and they’re all about that state-info life. πŸ’…

✨ SYNOPSIS ✨

library β€œlibssl” libcrypto #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);

πŸ’… DESCRIPTION πŸ’…

okay so SSL_want() returns state information for the SSL object ssl. that’s the main character of this whole page. ✨

The other SSL_want_*() calls are shortcuts for the possible states returned by SSL_want(). lowkey just convenience wrappers, highkey the same info. 🫢

SSL_want() examines the internal state information of the SSL object. Its return values are similar to those of SSL_get_error(3). but bestie, the way it gets them is different: unlike SSL_get_error(3), which also evaluates the error queue, the results are obtained by examining an internal state flag only. so the information must therefore only be used for normal operation under non-blocking I/O. πŸ¦‹

Error conditions are not handled and must be treated using SSL_get_error(3). do not try to make SSL_want() do error-queue detective work, because it will not. πŸ™ˆ

The result returned by SSL_want() should always be consistent with the result of SSL_get_error(3). periodt. consistency is the moment. πŸ’–

πŸ”₯ RETURN VALUES πŸ”₯

The following return values can currently occur for SSL_want():

  • SSL_NOTHING β€” there is no data to be written or to be read. literally nothing on the I/O agenda. 😌
  • SSL_WRITING β€” there are data in the SSL buffer that must be written to the underlying BIO layer in order to complete the actual SSL_*() operation. A call to SSL_get_error(3) should return SSL_ERROR_WANT_WRITE. it’s giving β€œwrite me to the BIO layer so we can finish” energy. ✍️
  • SSL_READING β€” more data must be read from the underlying BIO layer in order to complete the actual SSL_*() operation. A call to SSL_get_error(3) should return SSL_ERROR_WANT_READ. read era, no cap. πŸ“–
  • SSL_X509_LOOKUP β€” the operation did not complete because an application callback set by SSL_CTX_set_client_cert_cb(3) has asked to be called again. A call to SSL_get_error(3) should return SSL_ERROR_WANT_X509_LOOKUP. callback said β€œrun me back,” and honestly? iconic. πŸ”

SSL_want_nothing(), SSL_want_read(), SSL_want_write(), and SSL_want_x509_lookup() return 1 when the corresponding condition is true or 0 otherwise. simple as that. πŸ’―

πŸ¦‹ SEE ALSO πŸ¦‹

Go be nosy, bestie: err(3), ssl(3), SSL_get_error(3). all the related lore is right there. πŸ“š

πŸŽ€ HISTORY πŸŽ€

history lesson but make it cute: SSL_want(), SSL_want_nothing(), SSL_want_read(), and SSL_want_write() first appeared in SSLeay 0.5.2. SSL_want_x509_lookup() first appeared in SSLeay 0.6.0. These functions have been available since OpenBSD 2.4. so they’ve been around for a minute. ⭐

mwah πŸ’‹ β€” this page comes from Debian, dated June 8, 2025. now go handle your non-blocking I/O, bestie 🫢✨

πŸ“¦ where this page comes from