SSL_ACCEPT(3ossl)
π SSL_ACCEPT(3ossl) β bestie's guide to waiting for the client to show up π
okay so this is the SSL_accept page from the OpenSSL manual, and honestly? it's giving "I'll wait for you to text first" energy, except the text is a TLS/SSL handshake and the vibe is extremely serious. let's go π¦
β¨ NAME β¨
SSL_accept β literally just: wait for a TLS/SSL client to initiate a TLS/SSL handshake. that's the whole job. she waits. she's patient. she's booked and busy being patient. π
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
int SSL_accept(SSL *ssl);
one function, one pointer, no cap. include the header, call the thing. π
π«Ά DESCRIPTION π«Ά
SSL_accept() sits there and waits for a TLS/SSL client to initiate the TLS/SSL handshake. think of it like holding the door open for someone who hasn't walked up yet β very demure, very mindful.
but here's the tea β: the communication channel must already have been set and assigned to the ssl by setting an underlying BIO. like, you cannot just show up with an empty ssl and expect her to work. no BIO, no handshake, no slay. the underlying BIO is the whole prerequisite, periodt.
π§ NOTES π§
the way that SSL_accept() behaves is entirely dependent on the underlying BIO. it's giving "I match your energy" β lowkey true and highkey important.
- If the underlying BIO is blocking β
SSL_accept()will only return once the handshake has been finished or an error occurred. that's it. she commits. she stays until it's done or it's over. π - If the underlying BIO is nonblocking β
SSL_accept()will also return when the underlying BIO could not satisfy the needs ofSSL_accept()to continue the handshake, and she'll indicate the problem by the return value-1. in that case, a call toSSL_get_error()with the return value ofSSL_accept()will yieldSSL_ERROR_WANT_READorSSL_ERROR_WANT_WRITE.
so what do you do?? the calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_accept(). the action depends on the underlying BIO:
- when using a nonblocking socket, nothing is to be done, but
select()can be used to check for the required condition. β¨ - when using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue. π₯π€
not me reminding you that "repeat the call" is not optional, bestie. she said what she said. π₯
π RETURN VALUES π
here's the vibe check on what she hands back to you:
0β the TLS/SSL handshake was not successful, but was shut down controlled and by the specifications of the TLS/SSL protocol. callSSL_get_error()with the return valueretto find out the reason. π1β the TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established. ATE. iconic. we love to see it. π<0β the TLS/SSL handshake was not successful because a fatal error occurred either at the protocol level or a connection failure occurred. the shutdown was not clean. it can also occur if action is needed to continue the operation for nonblocking BIOs. callSSL_get_error()with the return valueretto find out the reason. π©
π SEE ALSO π
go read these next, iykyk:
SSL_get_error(3)SSL_connect(3)SSL_shutdown(3)ssl(7)bio(7)SSL_set_connect_state(3)SSL_do_handshake(3)SSL_CTX_new(3)
π COPYRIGHT π
Copyright 2000-2020 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 was OpenSSL 3.5.9, dated 2026-09-29, and yes she really is called SSL_ACCEPT(3ossl) β main character energy, no notes. mwah πβ¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms