SSL_ACCEPT(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… 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 BIO is 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 BIO is nonblocking, SSL_accept() will also return when the underlying BIO could not satisfy the needs of SSL_accept() to continue the handshake β€” indicating the problem by the return value -1. 😭 In this case a call to SSL_get_error() with the return value of SSL_accept() will yield SSL_ERROR_WANT_READ or SSL_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 a BIO pair, data must be written into or retrieved out of the BIO before 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. call SSL_get_error() with the return value ret to 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 nonblocking BIOs. call SSL_get_error() with the return value ret to find out the reason.
heads up bestie: <0 isn't always a doomed situation β€” it can also pop up on nonblocking BIOs when you just need to do more stuff and try again. check SSL_get_error() before you panic. πŸ™ˆ

πŸ’œ SEE ALSO πŸ’œ

go read them, they're all linked into this whole handshake saga πŸ”₯


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