xref: /openssl/doc/man3/SSL_in_init.pod (revision 5d632274)
1=pod
2
3=head1 NAME
4
5SSL_in_before,
6SSL_in_init,
7SSL_is_init_finished,
8SSL_in_connect_init,
9SSL_in_accept_init,
10SSL_get_state
11- retrieve information about the handshake state machine
12
13=head1 SYNOPSIS
14
15 #include <openssl/ssl.h>
16
17 int SSL_in_init(const SSL *s);
18 int SSL_in_before(const SSL *s);
19 int SSL_is_init_finished(const SSL *s);
20
21 int SSL_in_connect_init(SSL *s);
22 int SSL_in_accept_init(SSL *s);
23
24 OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl);
25
26=head1 DESCRIPTION
27
28SSL_in_init() returns 1 if the SSL/TLS state machine is currently processing or
29awaiting handshake messages, or 0 otherwise.
30
31SSL_in_before() returns 1 if no SSL/TLS handshake has yet been initiated, or 0
32otherwise.
33
34SSL_is_init_finished() returns 1 if the SSL/TLS connection is in a state where
35fully protected application data can be transferred or 0 otherwise.
36
37Note that in some circumstances (such as when early data is being transferred)
38SSL_in_init(), SSL_in_before() and SSL_is_init_finished() can all return 0.
39
40B<s> B<MUST NOT> be NULL.
41
42SSL_in_connect_init() returns 1 if B<s> is acting as a client and SSL_in_init()
43would return 1, or 0 otherwise.
44
45SSL_in_accept_init() returns 1 if B<s> is acting as a server and SSL_in_init()
46would return 1, or 0 otherwise.
47
48SSL_in_connect_init() and SSL_in_accept_init() are implemented as macros.
49
50SSL_get_state() returns a value indicating the current state of the handshake
51state machine. OSSL_HANDSHAKE_STATE is an enumerated type where each value
52indicates a discrete state machine state. Note that future versions of OpenSSL
53may define more states so applications should expect to receive unrecognised
54state values. The naming format is made up of a number of elements as follows:
55
56B<protocol>_ST_B<role>_B<message>
57
58B<protocol> is one of TLS or DTLS. DTLS is used where a state is specific to the
59DTLS protocol. Otherwise TLS is used.
60
61B<role> is one of CR, CW, SR or SW to indicate "client reading",
62"client writing", "server reading" or "server writing" respectively.
63
64B<message> is the name of a handshake message that is being or has been sent, or
65is being or has been processed.
66
67Additionally there are some special states that do not conform to the above
68format. These are:
69
70=over 4
71
72=item TLS_ST_BEFORE
73
74No handshake messages have yet been been sent or received.
75
76=item TLS_ST_OK
77
78Handshake message sending/processing has completed.
79
80=item TLS_ST_EARLY_DATA
81
82Early data is being processed
83
84=item TLS_ST_PENDING_EARLY_DATA_END
85
86Awaiting the end of early data processing
87
88=back
89
90=head1 RETURN VALUES
91
92SSL_in_init(), SSL_in_before(), SSL_is_init_finished(), SSL_in_connect_init()
93and SSL_in_accept_init() return values as indicated above.
94
95SSL_get_state() returns the current handshake state.
96
97
98=head1 SEE ALSO
99
100L<ssl(7)>,
101L<SSL_read_early_data(3)>
102
103=head1 COPYRIGHT
104
105Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
106
107Licensed under the Apache License 2.0 (the "License").  You may not use
108this file except in compliance with the License.  You can obtain a copy
109in the file LICENSE in the source distribution or at
110L<https://www.openssl.org/source/license.html>.
111
112=cut
113