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