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 back1if the SSL/TLS state machine is right now processing or waiting on handshake messages. otherwise?0. simple as.SSL_in_before()gives you1if literally no SSL/TLS handshake has been initiated yet. otherwise0. it's the "we haven't even said hi yet" state. πSSL_is_init_finished()returns1if 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 β and0otherwise.
π¨ okay important lil plot twist: in some circumstances (like when early data is being transferred)SSL_in_init(),SSL_in_before()andSSL_is_init_finished()can ALL return0at 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()returns1ifsis acting as a client andSSL_in_init()would return1. otherwise0.SSL_in_accept_init()returns1ifsis acting as a server andSSL_in_init()would return1. otherwise0.
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_STATEis 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
protocolis eitherTLSorDTLS.DTLSgets used when a state is specific to the DTLS protocol. otherwise it'sTLS. πΈroleis one ofCR,CW,SRorSW, which stand for "client reading", "client writing", "server reading" and "server writing" respectively. iykyk. πmessageis 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()andSSL_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 π
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
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms