113d40330Schristos=pod 213d40330Schristos 313d40330Schristos=head1 NAME 413d40330Schristos 513d40330SchristosSSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake 613d40330Schristos 713d40330Schristos=head1 SYNOPSIS 813d40330Schristos 913d40330Schristos #include <openssl/ssl.h> 1013d40330Schristos 1113d40330Schristos int SSL_accept(SSL *ssl); 1213d40330Schristos 1313d40330Schristos=head1 DESCRIPTION 1413d40330Schristos 1513d40330SchristosSSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake. 1613d40330SchristosThe communication channel must already have been set and assigned to the 1713d40330SchristosB<ssl> by setting an underlying B<BIO>. 1813d40330Schristos 1913d40330Schristos=head1 NOTES 2013d40330Schristos 2113d40330SchristosThe behaviour of SSL_accept() depends on the underlying BIO. 2213d40330Schristos 2313d40330SchristosIf the underlying BIO is B<blocking>, SSL_accept() will only return once the 2413d40330Schristoshandshake has been finished or an error occurred. 2513d40330Schristos 26f30e0929SchristosIf the underlying BIO is B<nonblocking>, SSL_accept() will also return 2713d40330Schristoswhen the underlying BIO could not satisfy the needs of SSL_accept() 2813d40330Schristosto continue the handshake, indicating the problem by the return value -1. 2913d40330SchristosIn this case a call to SSL_get_error() with the 3013d40330Schristosreturn value of SSL_accept() will yield B<SSL_ERROR_WANT_READ> or 3113d40330SchristosB<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after 3213d40330Schristostaking appropriate action to satisfy the needs of SSL_accept(). 33f30e0929SchristosThe action depends on the underlying BIO. When using a nonblocking socket, 3413d40330Schristosnothing is to be done, but select() can be used to check for the required 3513d40330Schristoscondition. When using a buffering BIO, like a BIO pair, data must be written 3613d40330Schristosinto or retrieved out of the BIO before being able to continue. 3713d40330Schristos 3813d40330Schristos=head1 RETURN VALUES 3913d40330Schristos 4013d40330SchristosThe following return values can occur: 4113d40330Schristos 4213d40330Schristos=over 4 4313d40330Schristos 4413d40330Schristos=item Z<>0 4513d40330Schristos 4613d40330SchristosThe TLS/SSL handshake was not successful but was shut down controlled and 4713d40330Schristosby the specifications of the TLS/SSL protocol. Call SSL_get_error() with the 4813d40330Schristosreturn value B<ret> to find out the reason. 4913d40330Schristos 5013d40330Schristos=item Z<>1 5113d40330Schristos 5213d40330SchristosThe TLS/SSL handshake was successfully completed, a TLS/SSL connection has been 5313d40330Schristosestablished. 5413d40330Schristos 5513d40330Schristos=item E<lt>0 5613d40330Schristos 5713d40330SchristosThe TLS/SSL handshake was not successful because a fatal error occurred either 5813d40330Schristosat the protocol level or a connection failure occurred. The shutdown was 597d004720Schristosnot clean. It can also occur if action is needed to continue the operation 60f30e0929Schristosfor nonblocking BIOs. Call SSL_get_error() with the return value B<ret> 6113d40330Schristosto find out the reason. 6213d40330Schristos 6313d40330Schristos=back 6413d40330Schristos 6513d40330Schristos=head1 SEE ALSO 6613d40330Schristos 6713d40330SchristosL<SSL_get_error(3)>, L<SSL_connect(3)>, 6813d40330SchristosL<SSL_shutdown(3)>, L<ssl(7)>, L<bio(7)>, 6913d40330SchristosL<SSL_set_connect_state(3)>, 7013d40330SchristosL<SSL_do_handshake(3)>, 7113d40330SchristosL<SSL_CTX_new(3)> 7213d40330Schristos 7313d40330Schristos=head1 COPYRIGHT 7413d40330Schristos 757d004720SchristosCopyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. 7613d40330Schristos 77*b0d17251SchristosLicensed under the Apache License 2.0 (the "License"). You may not use 7813d40330Schristosthis file except in compliance with the License. You can obtain a copy 7913d40330Schristosin the file LICENSE in the source distribution or at 8013d40330SchristosL<https://www.openssl.org/source/license.html>. 8113d40330Schristos 8213d40330Schristos=cut 83