168651Skris=pod 268651Skris 368651Skris=head1 NAME 468651Skris 568651SkrisSSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake 668651Skris 768651Skris=head1 SYNOPSIS 868651Skris 968651Skris #include <openssl/ssl.h> 1068651Skris 1168651Skris int SSL_accept(SSL *ssl); 1268651Skris 1368651Skris=head1 DESCRIPTION 1468651Skris 1568651SkrisSSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake. 1668651SkrisThe communication channel must already have been set and assigned to the 1768651SkrisB<ssl> by setting an underlying B<BIO>. 1868651Skris 1968651Skris=head1 NOTES 2068651Skris 2168651SkrisThe behaviour of SSL_accept() depends on the underlying BIO. 2268651Skris 2368651SkrisIf the underlying BIO is B<blocking>, SSL_accept() will only return once the 2468651Skrishandshake has been finished or an error occurred, except for SGC (Server 2568651SkrisGated Cryptography). For SGC, SSL_accept() may return with -1, but 2668651SkrisSSL_get_error() will yield B<SSL_ERROR_WANT_READ/WRITE> and SSL_accept() 2768651Skrisshould be called again. 2868651Skris 2968651SkrisIf the underlying BIO is B<non-blocking>, SSL_accept() will also return 3068651Skriswhen the underlying BIO could not satisfy the needs of SSL_accept() 31120631Snectarto continue the handshake, indicating the problem by the return value -1. 32120631SnectarIn this case a call to SSL_get_error() with the 3368651Skrisreturn value of SSL_accept() will yield B<SSL_ERROR_WANT_READ> or 3468651SkrisB<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after 3568651Skristaking appropriate action to satisfy the needs of SSL_accept(). 3668651SkrisThe action depends on the underlying BIO. When using a non-blocking socket, 3768651Skrisnothing is to be done, but select() can be used to check for the required 3868651Skriscondition. When using a buffering BIO, like a BIO pair, data must be written 3968651Skrisinto or retrieved out of the BIO before being able to continue. 4068651Skris 4168651Skris=head1 RETURN VALUES 4268651Skris 4368651SkrisThe following return values can occur: 4468651Skris 4568651Skris=over 4 4668651Skris 47264331Sjkim=item Z<>0 4868651Skris 4968651SkrisThe TLS/SSL handshake was not successful but was shut down controlled and 5068651Skrisby the specifications of the TLS/SSL protocol. Call SSL_get_error() with the 5168651Skrisreturn value B<ret> to find out the reason. 5268651Skris 53264331Sjkim=item Z<>1 54264331Sjkim 55264331SjkimThe TLS/SSL handshake was successfully completed, a TLS/SSL connection has been 56264331Sjkimestablished. 57264331Sjkim 5872613Skris=item E<lt>0 5968651Skris 6068651SkrisThe TLS/SSL handshake was not successful because a fatal error occurred either 6168651Skrisat the protocol level or a connection failure occurred. The shutdown was 6268651Skrisnot clean. It can also occur of action is need to continue the operation 6368651Skrisfor non-blocking BIOs. Call SSL_get_error() with the return value B<ret> 6468651Skristo find out the reason. 6568651Skris 6668651Skris=back 6768651Skris 6868651Skris=head1 SEE ALSO 6968651Skris 7068651SkrisL<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, 7176866SkrisL<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, 7276866SkrisL<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, 73100936SnectarL<SSL_do_handshake(3)|SSL_do_handshake(3)>, 7476866SkrisL<SSL_CTX_new(3)|SSL_CTX_new(3)> 7568651Skris 7668651Skris=cut 77