SSL_IN_INIT(3SSL)

πŸ’– SSL_IN_INIT πŸ’–

okay bestie, so this is the OpenSSL page β€” SSL_IN_INIT(3SSL) β€” and it's basically the vibe check for your TLS handshake. it's literally just "hey, where are we in this whole getting-to-know-you process?" and honestly? obsessed. let's go. πŸ¦‹


✨ NAME ✨

SSL_in_before, SSL_in_init, SSL_is_init_finished, SSL_in_connect_init, SSL_in_accept_init, SSL_get_state β€” all of them just retrieve information about the handshake state machine. that's the whole job. no cap. πŸ’…


🌸 SYNOPSIS 🌸

#include <openssl/ssl.h>

int SSL_in_init(const SSL *s);
int SSL_in_before(const SSL *s);
int SSL_is_init_finished(const SSL *s);

int SSL_in_connect_init(SSL *s);
int SSL_in_accept_init(SSL *s);

OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl);

see how clean that is? iconic behavior only. periodt. ✨


πŸŽ€ DESCRIPTION πŸŽ€

so here's the tea, function by function πŸ«–:

  • SSL_in_init() hands you back 1 if the SSL/TLS state machine is right now processing or waiting on handshake messages. otherwise? 0. simple as.
  • SSL_in_before() gives you 1 if literally no SSL/TLS handshake has been initiated yet. otherwise 0. it's the "we haven't even said hi yet" state. 😭
  • SSL_is_init_finished() returns 1 if the SSL/TLS connection is in a state where fully protected application data can actually be transferred β€” like, you're officially in your secure era β€” and 0 otherwise.
🚨 okay important lil plot twist: in some circumstances (like when early data is being transferred) SSL_in_init(), SSL_in_before() and SSL_is_init_finished() can ALL return 0 at the same time. not me being confused by three zeros πŸ’€ that's just the documented behavior bestie.

also: s MUST NOT be NULL. like do not do that. please. πŸ™ˆ

  • SSL_in_connect_init() returns 1 if s is acting as a client and SSL_in_init() would return 1. otherwise 0.
  • SSL_in_accept_init() returns 1 if s is acting as a server and SSL_in_init() would return 1. otherwise 0.

oh and pssst β€” SSL_in_connect_init() and SSL_in_accept_init() are implemented as macros. just so u know. πŸ’…

  • SSL_get_state() returns a value telling you the current state of the handshake state machine. OSSL_HANDSHAKE_STATE is an enumerated type, and every value in it maps to one discrete state machine state. 🌈
⚠️ heads up: future versions of OpenSSL may define more states, so your applications should be ready to receive unrecognised state values. don't freak out if you see one you don't know. fr fr.

the naming format is built out of a few lil elements stacked together, like this:

protocol_ST_role_message
  • protocol is either TLS or DTLS. DTLS gets used when a state is specific to the DTLS protocol. otherwise it's TLS. 🌸
  • role is one of CR, CW, SR or SW, which stand for "client reading", "client writing", "server reading" and "server writing" respectively. iykyk. πŸ‘‘
  • message is the name of a handshake message that is being sent, has been sent, is being processed, or has been processed. multitasking queen. πŸ’–

plus, there are some special states that don't conform to that format at all β€” the main character exceptions, if you will ✨:

  • TLS_ST_BEFORE β€” No handshake messages have yet been sent or received. (the "we're literally strangers" era)
  • TLS_ST_OK β€” Handshake message sending/processing has completed. (slay, we did it πŸŽ‰)
  • TLS_ST_EARLY_DATA β€” Early data is being processed.
  • TLS_ST_PENDING_EARLY_DATA_END β€” Awaiting the end of early data processing.

πŸ’― RETURN VALUES πŸ’―

  • SSL_in_init(), SSL_in_before(), SSL_is_init_finished(), SSL_in_connect_init() and SSL_in_accept_init() return the values as indicated above. πŸ‘†
  • SSL_get_state() returns the current handshake state. that's it, that's the return. πŸŽ€

πŸ‘€ SEE ALSO πŸ‘€

go read those too, they're lowkey great. πŸ¦‹


Copyright 2017-2026 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>.

pls respect the license bestie, it's giving legally binding πŸ’œ

and that's the whole page!! πŸŽ€ this was version 4.0.3, dated 2026-09-29, brought to you by OpenSSL πŸ’– stan a secure handshake, mwah πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from