xref: /minix3/crypto/external/bsd/openssl/dist/doc/ssl/SSL_accept.pod (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1ebfedea0SLionel Sambuc=pod
2ebfedea0SLionel Sambuc
3ebfedea0SLionel Sambuc=head1 NAME
4ebfedea0SLionel Sambuc
5ebfedea0SLionel SambucSSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake
6ebfedea0SLionel Sambuc
7ebfedea0SLionel Sambuc=head1 SYNOPSIS
8ebfedea0SLionel Sambuc
9ebfedea0SLionel Sambuc #include <openssl/ssl.h>
10ebfedea0SLionel Sambuc
11ebfedea0SLionel Sambuc int SSL_accept(SSL *ssl);
12ebfedea0SLionel Sambuc
13ebfedea0SLionel Sambuc=head1 DESCRIPTION
14ebfedea0SLionel Sambuc
15ebfedea0SLionel SambucSSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake.
16ebfedea0SLionel SambucThe communication channel must already have been set and assigned to the
17ebfedea0SLionel SambucB<ssl> by setting an underlying B<BIO>.
18ebfedea0SLionel Sambuc
19ebfedea0SLionel Sambuc=head1 NOTES
20ebfedea0SLionel Sambuc
21ebfedea0SLionel SambucThe behaviour of SSL_accept() depends on the underlying BIO.
22ebfedea0SLionel Sambuc
23ebfedea0SLionel SambucIf the underlying BIO is B<blocking>, SSL_accept() will only return once the
24ebfedea0SLionel Sambuchandshake has been finished or an error occurred, except for SGC (Server
25ebfedea0SLionel SambucGated Cryptography). For SGC, SSL_accept() may return with -1, but
26ebfedea0SLionel SambucSSL_get_error() will yield B<SSL_ERROR_WANT_READ/WRITE> and SSL_accept()
27ebfedea0SLionel Sambucshould be called again.
28ebfedea0SLionel Sambuc
29ebfedea0SLionel SambucIf the underlying BIO is B<non-blocking>, SSL_accept() will also return
30ebfedea0SLionel Sambucwhen the underlying BIO could not satisfy the needs of SSL_accept()
31ebfedea0SLionel Sambucto continue the handshake, indicating the problem by the return value -1.
32ebfedea0SLionel SambucIn this case a call to SSL_get_error() with the
33ebfedea0SLionel Sambucreturn value of SSL_accept() will yield B<SSL_ERROR_WANT_READ> or
34ebfedea0SLionel SambucB<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after
35ebfedea0SLionel Sambuctaking appropriate action to satisfy the needs of SSL_accept().
36ebfedea0SLionel SambucThe action depends on the underlying BIO. When using a non-blocking socket,
37ebfedea0SLionel Sambucnothing is to be done, but select() can be used to check for the required
38ebfedea0SLionel Sambuccondition. When using a buffering BIO, like a BIO pair, data must be written
39ebfedea0SLionel Sambucinto or retrieved out of the BIO before being able to continue.
40ebfedea0SLionel Sambuc
41ebfedea0SLionel Sambuc=head1 RETURN VALUES
42ebfedea0SLionel Sambuc
43ebfedea0SLionel SambucThe following return values can occur:
44ebfedea0SLionel Sambuc
45ebfedea0SLionel Sambuc=over 4
46ebfedea0SLionel Sambuc
47*0a6a1f1dSLionel Sambuc=item Z<>0
48ebfedea0SLionel Sambuc
49ebfedea0SLionel SambucThe TLS/SSL handshake was not successful but was shut down controlled and
50ebfedea0SLionel Sambucby the specifications of the TLS/SSL protocol. Call SSL_get_error() with the
51ebfedea0SLionel Sambucreturn value B<ret> to find out the reason.
52ebfedea0SLionel Sambuc
53*0a6a1f1dSLionel Sambuc=item Z<>1
54*0a6a1f1dSLionel Sambuc
55*0a6a1f1dSLionel SambucThe TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
56*0a6a1f1dSLionel Sambucestablished.
57*0a6a1f1dSLionel Sambuc
58ebfedea0SLionel Sambuc=item E<lt>0
59ebfedea0SLionel Sambuc
60ebfedea0SLionel SambucThe TLS/SSL handshake was not successful because a fatal error occurred either
61ebfedea0SLionel Sambucat the protocol level or a connection failure occurred. The shutdown was
62ebfedea0SLionel Sambucnot clean. It can also occur of action is need to continue the operation
63ebfedea0SLionel Sambucfor non-blocking BIOs. Call SSL_get_error() with the return value B<ret>
64ebfedea0SLionel Sambucto find out the reason.
65ebfedea0SLionel Sambuc
66ebfedea0SLionel Sambuc=back
67ebfedea0SLionel Sambuc
68ebfedea0SLionel Sambuc=head1 SEE ALSO
69ebfedea0SLionel Sambuc
70ebfedea0SLionel SambucL<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>,
71ebfedea0SLionel SambucL<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>,
72ebfedea0SLionel SambucL<SSL_set_connect_state(3)|SSL_set_connect_state(3)>,
73ebfedea0SLionel SambucL<SSL_do_handshake(3)|SSL_do_handshake(3)>,
74ebfedea0SLionel SambucL<SSL_CTX_new(3)|SSL_CTX_new(3)>
75ebfedea0SLionel Sambuc
76ebfedea0SLionel Sambuc=cut
77