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