xref: /freebsd/crypto/openssl/doc/man3/SSL_in_init.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
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
40SSL_in_connect_init() returns 1 if B<s> is acting as a client and SSL_in_init()
41would return 1, or 0 otherwise.
42
43SSL_in_accept_init() returns 1 if B<s> is acting as a server and SSL_in_init()
44would return 1, or 0 otherwise.
45
46SSL_in_connect_init() and SSL_in_accept_init() are implemented as macros.
47
48SSL_get_state() returns a value indicating the current state of the handshake
49state machine. OSSL_HANDSHAKE_STATE is an enumerated type where each value
50indicates a discrete state machine state. Note that future versions of OpenSSL
51may define more states so applications should expect to receive unrecognised
52state values. The naming format is made up of a number of elements as follows:
53
54B<protocol>_ST_B<role>_B<message>
55
56B<protocol> is one of TLS or DTLS. DTLS is used where a state is specific to the
57DTLS protocol. Otherwise TLS is used.
58
59B<role> is one of CR, CW, SR or SW to indicate "client reading",
60"client writing", "server reading" or "server writing" respectively.
61
62B<message> is the name of a handshake message that is being or has been sent, or
63is being or has been processed.
64
65Additionally there are some special states that do not conform to the above
66format. These are:
67
68=over 4
69
70=item TLS_ST_BEFORE
71
72No handshake messages have yet been been sent or received.
73
74=item TLS_ST_OK
75
76Handshake message sending/processing has completed.
77
78=item TLS_ST_EARLY_DATA
79
80Early data is being processed
81
82=item TLS_ST_PENDING_EARLY_DATA_END
83
84Awaiting the end of early data processing
85
86=back
87
88=head1 RETURN VALUES
89
90SSL_in_init(), SSL_in_before(), SSL_is_init_finished(), SSL_in_connect_init()
91and SSL_in_accept_init() return values as indicated above.
92
93SSL_get_state() returns the current handshake state.
94
95
96=head1 SEE ALSO
97
98L<ssl(7)>,
99L<SSL_read_early_data(3)>
100
101=head1 COPYRIGHT
102
103Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
104
105Licensed under the Apache License 2.0 (the "License").  You may not use
106this file except in compliance with the License.  You can obtain a copy
107in the file LICENSE in the source distribution or at
108L<https://www.openssl.org/source/license.html>.
109
110=cut
111