xref: /minix3/crypto/external/bsd/openssl/dist/doc/ssl/SSL_clear.pod (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1ebfedea0SLionel Sambuc=pod
2ebfedea0SLionel Sambuc
3ebfedea0SLionel Sambuc=head1 NAME
4ebfedea0SLionel Sambuc
5ebfedea0SLionel SambucSSL_clear - reset SSL object to allow another connection
6ebfedea0SLionel Sambuc
7ebfedea0SLionel Sambuc=head1 SYNOPSIS
8ebfedea0SLionel Sambuc
9ebfedea0SLionel Sambuc #include <openssl/ssl.h>
10ebfedea0SLionel Sambuc
11ebfedea0SLionel Sambuc int SSL_clear(SSL *ssl);
12ebfedea0SLionel Sambuc
13ebfedea0SLionel Sambuc=head1 DESCRIPTION
14ebfedea0SLionel Sambuc
15ebfedea0SLionel SambucReset B<ssl> to allow another connection. All settings (method, ciphers,
16ebfedea0SLionel SambucBIOs) are kept.
17ebfedea0SLionel Sambuc
18ebfedea0SLionel Sambuc=head1 NOTES
19ebfedea0SLionel Sambuc
20ebfedea0SLionel SambucSSL_clear is used to prepare an SSL object for a new connection. While all
21ebfedea0SLionel Sambucsettings are kept, a side effect is the handling of the current SSL session.
22ebfedea0SLionel SambucIf a session is still B<open>, it is considered bad and will be removed
23ebfedea0SLionel Sambucfrom the session cache, as required by RFC2246. A session is considered open,
24ebfedea0SLionel Sambucif L<SSL_shutdown(3)|SSL_shutdown(3)> was not called for the connection
25ebfedea0SLionel Sambucor at least L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> was used to
26ebfedea0SLionel Sambucset the SSL_SENT_SHUTDOWN state.
27ebfedea0SLionel Sambuc
28ebfedea0SLionel SambucIf a session was closed cleanly, the session object will be kept and all
29ebfedea0SLionel Sambucsettings corresponding. This explicitly means, that e.g. the special method
30ebfedea0SLionel Sambucused during the session will be kept for the next handshake. So if the
31ebfedea0SLionel Sambucsession was a TLSv1 session, a SSL client object will use a TLSv1 client
32ebfedea0SLionel Sambucmethod for the next handshake and a SSL server object will use a TLSv1
33ebfedea0SLionel Sambucserver method, even if SSLv23_*_methods were chosen on startup. This
34ebfedea0SLionel Sambucwill might lead to connection failures (see L<SSL_new(3)|SSL_new(3)>)
35ebfedea0SLionel Sambucfor a description of the method's properties.
36ebfedea0SLionel Sambuc
37ebfedea0SLionel Sambuc=head1 WARNINGS
38ebfedea0SLionel Sambuc
39ebfedea0SLionel SambucSSL_clear() resets the SSL object to allow for another connection. The
40ebfedea0SLionel Sambucreset operation however keeps several settings of the last sessions
41ebfedea0SLionel Sambuc(some of these settings were made automatically during the last
42ebfedea0SLionel Sambuchandshake). It only makes sense for a new connection with the exact
43ebfedea0SLionel Sambucsame peer that shares these settings, and may fail if that peer
44ebfedea0SLionel Sambucchanges its settings between connections. Use the sequence
45ebfedea0SLionel SambucL<SSL_get_session(3)|SSL_get_session(3)>;
46ebfedea0SLionel SambucL<SSL_new(3)|SSL_new(3)>;
47ebfedea0SLionel SambucL<SSL_set_session(3)|SSL_set_session(3)>;
48ebfedea0SLionel SambucL<SSL_free(3)|SSL_free(3)>
49ebfedea0SLionel Sambucinstead to avoid such failures
50ebfedea0SLionel Sambuc(or simply L<SSL_free(3)|SSL_free(3)>; L<SSL_new(3)|SSL_new(3)>
51ebfedea0SLionel Sambucif session reuse is not desired).
52ebfedea0SLionel Sambuc
53ebfedea0SLionel Sambuc=head1 RETURN VALUES
54ebfedea0SLionel Sambuc
55ebfedea0SLionel SambucThe following return values can occur:
56ebfedea0SLionel Sambuc
57ebfedea0SLionel Sambuc=over 4
58ebfedea0SLionel Sambuc
59*0a6a1f1dSLionel Sambuc=item Z<>0
60ebfedea0SLionel Sambuc
61ebfedea0SLionel SambucThe SSL_clear() operation could not be performed. Check the error stack to
62ebfedea0SLionel Sambucfind out the reason.
63ebfedea0SLionel Sambuc
64*0a6a1f1dSLionel Sambuc=item Z<>1
65ebfedea0SLionel Sambuc
66ebfedea0SLionel SambucThe SSL_clear() operation was successful.
67ebfedea0SLionel Sambuc
68ebfedea0SLionel Sambuc=back
69ebfedea0SLionel Sambuc
70ebfedea0SLionel SambucL<SSL_new(3)|SSL_new(3)>, L<SSL_free(3)|SSL_free(3)>,
71ebfedea0SLionel SambucL<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>,
72ebfedea0SLionel SambucL<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, L<ssl(3)|ssl(3)>,
73ebfedea0SLionel SambucL<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>
74ebfedea0SLionel Sambuc
75ebfedea0SLionel Sambuc=cut
76