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