1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimSSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake 6e71b7053SJung-uk Kim 7e71b7053SJung-uk Kim=head1 SYNOPSIS 8e71b7053SJung-uk Kim 9e71b7053SJung-uk Kim #include <openssl/ssl.h> 10e71b7053SJung-uk Kim 11e71b7053SJung-uk Kim int SSL_accept(SSL *ssl); 12e71b7053SJung-uk Kim 13e71b7053SJung-uk Kim=head1 DESCRIPTION 14e71b7053SJung-uk Kim 15e71b7053SJung-uk KimSSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake. 16e71b7053SJung-uk KimThe communication channel must already have been set and assigned to the 17e71b7053SJung-uk KimB<ssl> by setting an underlying B<BIO>. 18e71b7053SJung-uk Kim 19e71b7053SJung-uk Kim=head1 NOTES 20e71b7053SJung-uk Kim 21e71b7053SJung-uk KimThe behaviour of SSL_accept() depends on the underlying BIO. 22e71b7053SJung-uk Kim 23e71b7053SJung-uk KimIf the underlying BIO is B<blocking>, SSL_accept() will only return once the 24e71b7053SJung-uk Kimhandshake has been finished or an error occurred. 25e71b7053SJung-uk Kim 2658f35182SJung-uk KimIf the underlying BIO is B<nonblocking>, SSL_accept() will also return 27e71b7053SJung-uk Kimwhen the underlying BIO could not satisfy the needs of SSL_accept() 28e71b7053SJung-uk Kimto continue the handshake, indicating the problem by the return value -1. 29e71b7053SJung-uk KimIn this case a call to SSL_get_error() with the 30e71b7053SJung-uk Kimreturn value of SSL_accept() will yield B<SSL_ERROR_WANT_READ> or 31e71b7053SJung-uk KimB<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after 32e71b7053SJung-uk Kimtaking appropriate action to satisfy the needs of SSL_accept(). 3358f35182SJung-uk KimThe action depends on the underlying BIO. When using a nonblocking socket, 34e71b7053SJung-uk Kimnothing is to be done, but select() can be used to check for the required 35e71b7053SJung-uk Kimcondition. When using a buffering BIO, like a BIO pair, data must be written 36e71b7053SJung-uk Kiminto or retrieved out of the BIO before being able to continue. 37e71b7053SJung-uk Kim 38e71b7053SJung-uk Kim=head1 RETURN VALUES 39e71b7053SJung-uk Kim 40e71b7053SJung-uk KimThe following return values can occur: 41e71b7053SJung-uk Kim 42e71b7053SJung-uk Kim=over 4 43e71b7053SJung-uk Kim 44e71b7053SJung-uk Kim=item Z<>0 45e71b7053SJung-uk Kim 46e71b7053SJung-uk KimThe TLS/SSL handshake was not successful but was shut down controlled and 47e71b7053SJung-uk Kimby the specifications of the TLS/SSL protocol. Call SSL_get_error() with the 48e71b7053SJung-uk Kimreturn value B<ret> to find out the reason. 49e71b7053SJung-uk Kim 50e71b7053SJung-uk Kim=item Z<>1 51e71b7053SJung-uk Kim 52e71b7053SJung-uk KimThe TLS/SSL handshake was successfully completed, a TLS/SSL connection has been 53e71b7053SJung-uk Kimestablished. 54e71b7053SJung-uk Kim 55e71b7053SJung-uk Kim=item E<lt>0 56e71b7053SJung-uk Kim 57e71b7053SJung-uk KimThe TLS/SSL handshake was not successful because a fatal error occurred either 58e71b7053SJung-uk Kimat the protocol level or a connection failure occurred. The shutdown was 5917f01e99SJung-uk Kimnot clean. It can also occur if action is needed to continue the operation 6058f35182SJung-uk Kimfor nonblocking BIOs. Call SSL_get_error() with the return value B<ret> 61e71b7053SJung-uk Kimto find out the reason. 62e71b7053SJung-uk Kim 63e71b7053SJung-uk Kim=back 64e71b7053SJung-uk Kim 65e71b7053SJung-uk Kim=head1 SEE ALSO 66e71b7053SJung-uk Kim 67e71b7053SJung-uk KimL<SSL_get_error(3)>, L<SSL_connect(3)>, 68e71b7053SJung-uk KimL<SSL_shutdown(3)>, L<ssl(7)>, L<bio(7)>, 69e71b7053SJung-uk KimL<SSL_set_connect_state(3)>, 70e71b7053SJung-uk KimL<SSL_do_handshake(3)>, 71e71b7053SJung-uk KimL<SSL_CTX_new(3)> 72e71b7053SJung-uk Kim 73e71b7053SJung-uk Kim=head1 COPYRIGHT 74e71b7053SJung-uk Kim 7517f01e99SJung-uk KimCopyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. 76e71b7053SJung-uk Kim 77*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 78e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 79e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 80e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 81e71b7053SJung-uk Kim 82e71b7053SJung-uk Kim=cut 83