xref: /freebsd/crypto/openssl/doc/man3/SSL_want.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5*b077aed3SPierre ProncherySSL_want, SSL_want_nothing, SSL_want_read, SSL_want_write,
6*b077aed3SPierre ProncherySSL_want_x509_lookup, SSL_want_retry_verify, SSL_want_async, SSL_want_async_job,
7*b077aed3SPierre ProncherySSL_want_client_hello_cb - obtain state information TLS/SSL I/O operation
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim=head1 SYNOPSIS
10e71b7053SJung-uk Kim
11e71b7053SJung-uk Kim #include <openssl/ssl.h>
12e71b7053SJung-uk Kim
13e71b7053SJung-uk Kim int SSL_want(const SSL *ssl);
14e71b7053SJung-uk Kim int SSL_want_nothing(const SSL *ssl);
15e71b7053SJung-uk Kim int SSL_want_read(const SSL *ssl);
16e71b7053SJung-uk Kim int SSL_want_write(const SSL *ssl);
17e71b7053SJung-uk Kim int SSL_want_x509_lookup(const SSL *ssl);
18*b077aed3SPierre Pronchery int SSL_want_retry_verify(const SSL *ssl);
19e71b7053SJung-uk Kim int SSL_want_async(const SSL *ssl);
20e71b7053SJung-uk Kim int SSL_want_async_job(const SSL *ssl);
21e71b7053SJung-uk Kim int SSL_want_client_hello_cb(const SSL *ssl);
22e71b7053SJung-uk Kim
23e71b7053SJung-uk Kim=head1 DESCRIPTION
24e71b7053SJung-uk Kim
25e71b7053SJung-uk KimSSL_want() returns state information for the SSL object B<ssl>.
26e71b7053SJung-uk Kim
27e71b7053SJung-uk KimThe other SSL_want_*() calls are shortcuts for the possible states returned
28e71b7053SJung-uk Kimby SSL_want().
29e71b7053SJung-uk Kim
30e71b7053SJung-uk Kim=head1 NOTES
31e71b7053SJung-uk Kim
32e71b7053SJung-uk KimSSL_want() examines the internal state information of the SSL object. Its
33e71b7053SJung-uk Kimreturn values are similar to that of L<SSL_get_error(3)>.
34e71b7053SJung-uk KimUnlike L<SSL_get_error(3)>, which also evaluates the
35e71b7053SJung-uk Kimerror queue, the results are obtained by examining an internal state flag
36e71b7053SJung-uk Kimonly. The information must therefore only be used for normal operation under
3758f35182SJung-uk Kimnonblocking I/O. Error conditions are not handled and must be treated
38e71b7053SJung-uk Kimusing L<SSL_get_error(3)>.
39e71b7053SJung-uk Kim
40e71b7053SJung-uk KimThe result returned by SSL_want() should always be consistent with
41e71b7053SJung-uk Kimthe result of L<SSL_get_error(3)>.
42e71b7053SJung-uk Kim
43e71b7053SJung-uk Kim=head1 RETURN VALUES
44e71b7053SJung-uk Kim
45e71b7053SJung-uk KimThe following return values can currently occur for SSL_want():
46e71b7053SJung-uk Kim
47e71b7053SJung-uk Kim=over 4
48e71b7053SJung-uk Kim
49e71b7053SJung-uk Kim=item SSL_NOTHING
50e71b7053SJung-uk Kim
51e71b7053SJung-uk KimThere is no data to be written or to be read.
52e71b7053SJung-uk Kim
53e71b7053SJung-uk Kim=item SSL_WRITING
54e71b7053SJung-uk Kim
55e71b7053SJung-uk KimThere are data in the SSL buffer that must be written to the underlying
56e71b7053SJung-uk KimB<BIO> layer in order to complete the actual SSL_*() operation.
57*b077aed3SPierre ProncheryA call to L<SSL_get_error(3)> should return B<SSL_ERROR_WANT_WRITE>.
58e71b7053SJung-uk Kim
59e71b7053SJung-uk Kim=item SSL_READING
60e71b7053SJung-uk Kim
61e71b7053SJung-uk KimMore data must be read from the underlying B<BIO> layer in order to
62e71b7053SJung-uk Kimcomplete the actual SSL_*() operation.
63*b077aed3SPierre ProncheryA call to L<SSL_get_error(3)> should return B<SSL_ERROR_WANT_READ>.
64e71b7053SJung-uk Kim
65e71b7053SJung-uk Kim=item SSL_X509_LOOKUP
66e71b7053SJung-uk Kim
67e71b7053SJung-uk KimThe operation did not complete because an application callback set by
68e71b7053SJung-uk KimSSL_CTX_set_client_cert_cb() has asked to be called again.
69*b077aed3SPierre ProncheryA call to L<SSL_get_error(3)> should return B<SSL_ERROR_WANT_X509_LOOKUP>.
70*b077aed3SPierre Pronchery
71*b077aed3SPierre Pronchery=item SSL_RETRY_VERIFY
72*b077aed3SPierre Pronchery
73*b077aed3SPierre ProncheryThe operation did not complete because a certificate verification callback
74*b077aed3SPierre Proncheryhas asked to be called again via L<SSL_set_retry_verify(3)>.
75*b077aed3SPierre ProncheryA call to L<SSL_get_error(3)> should return B<SSL_ERROR_WANT_RETRY_VERIFY>.
76e71b7053SJung-uk Kim
77e71b7053SJung-uk Kim=item SSL_ASYNC_PAUSED
78e71b7053SJung-uk Kim
79e71b7053SJung-uk KimAn asynchronous operation partially completed and was then paused. See
80e71b7053SJung-uk KimL<SSL_get_all_async_fds(3)>. A call to L<SSL_get_error(3)> should return
81*b077aed3SPierre ProncheryB<SSL_ERROR_WANT_ASYNC>.
82e71b7053SJung-uk Kim
83e71b7053SJung-uk Kim=item SSL_ASYNC_NO_JOBS
84e71b7053SJung-uk Kim
85e71b7053SJung-uk KimThe asynchronous job could not be started because there were no async jobs
86e71b7053SJung-uk Kimavailable in the pool (see ASYNC_init_thread(3)). A call to L<SSL_get_error(3)>
87*b077aed3SPierre Proncheryshould return B<SSL_ERROR_WANT_ASYNC_JOB>.
88e71b7053SJung-uk Kim
89e71b7053SJung-uk Kim=item SSL_CLIENT_HELLO_CB
90e71b7053SJung-uk Kim
91e71b7053SJung-uk KimThe operation did not complete because an application callback set by
92e71b7053SJung-uk KimSSL_CTX_set_client_hello_cb() has asked to be called again.
93*b077aed3SPierre ProncheryA call to L<SSL_get_error(3)> should return B<SSL_ERROR_WANT_CLIENT_HELLO_CB>.
94e71b7053SJung-uk Kim
95e71b7053SJung-uk Kim=back
96e71b7053SJung-uk Kim
97*b077aed3SPierre ProncherySSL_want_nothing(), SSL_want_read(), SSL_want_write(),
98*b077aed3SPierre ProncherySSL_want_x509_lookup(), SSL_want_retry_verify(),
99*b077aed3SPierre ProncherySSL_want_async(), SSL_want_async_job(), and SSL_want_client_hello_cb()
100*b077aed3SPierre Proncheryreturn 1 when the corresponding condition is true or 0 otherwise.
101e71b7053SJung-uk Kim
102e71b7053SJung-uk Kim=head1 SEE ALSO
103e71b7053SJung-uk Kim
104e71b7053SJung-uk KimL<ssl(7)>, L<SSL_get_error(3)>
105e71b7053SJung-uk Kim
106e71b7053SJung-uk Kim=head1 HISTORY
107e71b7053SJung-uk Kim
1086935a639SJung-uk KimThe SSL_want_client_hello_cb() function and the SSL_CLIENT_HELLO_CB return value
1096935a639SJung-uk Kimwere added in OpenSSL 1.1.1.
110e71b7053SJung-uk Kim
111e71b7053SJung-uk Kim=head1 COPYRIGHT
112e71b7053SJung-uk Kim
113*b077aed3SPierre ProncheryCopyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.
114e71b7053SJung-uk Kim
115*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
116e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
117e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
118e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
119e71b7053SJung-uk Kim
120e71b7053SJung-uk Kim=cut
121