SSL_ACCEPT(3ossl)
π SSL_ACCEPT (3ossl) β¨
okay bestie, so this is the SSL_accept page from the OpenSSL manual β sitting pretty in section 3ossl β and it's basically the "wait for the client to text first" function. let's get into it π«Ά
πΈ NAME πΈ
SSL_accept β wait for a TLS/SSL client to initiate a TLS/SSL handshake π
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
int SSL_accept(SSL *ssl);
that's it. one function. one argument. iconic minimalism π
π¦ DESCRIPTION π¦
so SSL_accept() literally just sits there and waits for a TLS/SSL client to initiate the TLS/SSL handshake. like, it's giving "i'm not texting first, you text first" energy. π±β¨
but β and this is important, no cap β the communication channel must already have been set and assigned to the ssl by setting an underlying BIO. so like, you can't just call it on vibes. the plumbing is already there, bestie. π§
π NOTES π
okay so the behaviour of SSL_accept() depends on the underlying BIO. this is the part where i need you to focus π§
- if the underlying
BIOis blocking,SSL_accept()will only return once the handshake has been finished or an error occurred. so it's the friend who stays on the phone till the convo's actually done. one return, that's it. β³ - if the underlying
BIOis nonblocking,SSL_accept()will also return when the underlyingBIOcould not satisfy the needs ofSSL_accept()to continue the handshake β indicating the problem by the return value-1. π In this case a call toSSL_get_error()with the return value ofSSL_accept()will yieldSSL_ERROR_WANT_READorSSL_ERROR_WANT_WRITE.
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. so like, you literally just wait and check. lowkey chill. β - when using a buffering
BIO, like aBIOpair, data must be written into or retrieved out of theBIObefore being able to continue. so you gotta feed it or empty it, bestie β it's hungry. π
π RETURN VALUES π
the following return values can occur β and yes, every single one matters, don't skip π
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. slay!! π this is the one you want. main character return value fr fr.<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 nonblockingBIOs. callSSL_get_error()with the return valueretto find out the reason.
heads up bestie:<0isn't always a doomed situation β it can also pop up on nonblockingBIOs when you just need to do more stuff and try again. checkSSL_get_error()before you panic. π
π SEE ALSO π
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)
go read them, they're all linked into this whole handshake saga π₯
π 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 version 3.5.0, dated 2026-09-25, straight from the OpenSSL crew β go forth and handshake responsibly πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms