SSL_IN_INIT(3ossl)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ’– SSL_IN_INIT πŸ’– (the OpenSSL manual page, bestie edition)

okay so this is the page from the OpenSSL manual set, and it's all about peeking inside the handshake state machine to see what it's doing. yes, the TLS handshake has lore, and this page is the lore dump. no cap. 🌸


✨ NAME ✨

SSL_in_before, SSL_in_init, SSL_is_init_finished, SSL_in_connect_init, SSL_in_accept_init, SSL_get_state β€” these are the little detectives πŸ” that tell you stuff about the handshake state machine. honestly iconic behavior.


πŸ¦‹ 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);

like, look at them all lined up. so organized. πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

  • SSL_in_init() β€” returns 1 if the SSL/TLS state machine is currently processing or awaiting handshake messages, otherwise 0. it's in its handshake era.
  • SSL_in_before() β€” returns 1 if no SSL/TLS handshake has yet been initiated, otherwise 0. this is the pre-handshake vibe. nothing has started yet, it's just standing there looking cute.
  • SSL_is_init_finished() β€” returns 1 if the SSL/TLS connection is in a state where fully protected application data can be transferred, otherwise 0. this is the "we made it, we're so back" state. 🫢
⚠️ okay so heads up bestie: in some circumstances (such as when early data is being transferred) SSL_in_init(), SSL_in_before() and SSL_is_init_finished() can all return 0. like, all three at once. not a girlboss moment, just how it is. don't panic.
🚨 s MUST NOT be NULL. literally do not do that to me.
  • SSL_in_connect_init() β€” returns 1 if s is acting as a client and SSL_in_init() would return 1. otherwise 0. client-side handshake energy only.
  • SSL_in_accept_init() β€” returns 1 if s is acting as a server and SSL_in_init() would return 1. otherwise 0. server-side handshake energy only.
πŸ’‘ lowkey important: SSL_in_connect_init() and SSL_in_accept_init() are implemented as macros. so like, they're not real functions. it's giving "we're built different."
  • SSL_get_state() β€” returns a value indicating the current state of the handshake state machine. OSSL_HANDSHAKE_STATE is an enumerated type where each value indicates a discrete state machine state. 🎯
😭 future versions of OpenSSL may define more states, so applications should expect to receive unrecognised state values. like, just be ready for strangers. be chill about it.

the naming format is made up of a number of elements, and it goes like this:

protocol_ST_role_message

let me break that down for you, gorgeous:

  • protocol β€” one of TLS or DTLS. DTLS is used where a state is specific to the DTLS protocol. otherwise <rainbow>TLS</rainbow> is used.
  • role β€” one of CR, CW, SR or SW to indicate "client reading", "client writing", "server reading" or "server writing" respectively. cute little abbreviations, obsessed.
  • message β€” the name of a handshake message that is being or has been sent, or is being or has been processed.

πŸ’œ the special states πŸ’œ

additionally there are some special states that do not conform to the above format. they're the main characters. they are:

  • TLS_ST_BEFORE β€” no handshake messages have yet been been sent or received. (yes the original says "been been", i'm keeping it. character for character, bestie. πŸ’€)
  • TLS_ST_OK β€” handshake message sending/processing has completed. we love a finished queen.
  • 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 values as indicated above. (scroll up, i literally just told you 😌)
  • SSL_get_state() β€” returns the current handshake state.

🌟 SEE ALSO 🌟

go read those too, i believe in you. πŸ“šβœ¨


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

like fr fr, read the license, it's giving legal slay. βš–οΈπŸ’…


and that's the whole page, bestie!! shipped to you from OpenSSL 3.5.6, dated 2026-04-07 β€” that's the SSL_IN_INIT(3ossl) page, and you ate it up. periodt. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from