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