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