SSL_IN_INIT(3ossl)
π SSL_IN_INIT β bestie, let's read the handshake's mind π
okay so this is the SSL_IN_INIT(3ossl) page from the OpenSSL manual set, and it's genuinely just a lil vibe check on the handshake state machine. Six functions, one enum, zero drama. 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 these are here to hand you info about the handshake state machine. that's it. that's the whole job. π
β¨ 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);
β¨ DESCRIPTION β¨
SSL_in_init() hands you back 1 if the SSL/TLS state machine is, like, currently busy processing handshake messages or just sitting there awaiting them. otherwise? 0. no in-between, she's a binary icon. π
SSL_in_before() gives you 1 if literally no SSL/TLS handshake has been kicked off yet. otherwise 0.
SSL_is_init_finished() returns 1 when the SSL/TLS connection is in a state where fully protected application data can actually be transferred. otherwise 0.
ok this next bit is important so pay attention bestie: in some circumstances (like when early data is being transferred)SSL_in_init(),SSL_in_before()andSSL_is_init_finished()can all return0. yes, all three. zero. it's giving "none of the above". don't come for me, that's just what the page says. π
also: s MUST NOT be NULL. do not do that. π«Ά
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.
fun fact: SSL_in_connect_init() and SSL_in_accept_init() are implemented as macros. iykyk. β¨
πΈ SSL_get_state() and the state enum πΈ
SSL_get_state() returns a value telling you the current state of the handshake state machine. OSSL_HANDSHAKE_STATE is an enumerated type where each value = one discrete state machine state. π
heads up though: future versions of OpenSSL may define more states, so applications should expect to receive unrecognised state values. don't be weird about it when you see one. π
the naming format is made up of a bunch of elements, like this:
protocol_ST_role_message
let's break it down, bestie:
protocolis eitherTLSorDTLS.DTLSshows up where a state is specific to the DTLS protocol. otherwise it'sTLS.roleis one ofCR,CW,SRorSW, meaning "client reading", "client writing", "server reading" or "server writing" respectively. cute, right? πmessageis 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 are:
TLS_ST_BEFOREβ no handshake messages have yet been sent or received.TLS_ST_OKβ handshake message sending/processing has completed. slay.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 promise it's all there)
SSL_get_state() returns the current handshake state. π
β¨ SEE ALSO β¨
β¨ COPYRIGHT β¨
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>.
and that's the whole page, bestie π this was OpenSSL 3.5.9, dated 2026-09-29, from the SSL_IN_INIT(3ossl) manual. go forth and vibe check your handshakes responsibly. 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