xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/doc/man3/SSL_clear.pod (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos=pod
2*4724848cSchristos
3*4724848cSchristos=head1 NAME
4*4724848cSchristos
5*4724848cSchristosSSL_clear - reset SSL object to allow another connection
6*4724848cSchristos
7*4724848cSchristos=head1 SYNOPSIS
8*4724848cSchristos
9*4724848cSchristos #include <openssl/ssl.h>
10*4724848cSchristos
11*4724848cSchristos int SSL_clear(SSL *ssl);
12*4724848cSchristos
13*4724848cSchristos=head1 DESCRIPTION
14*4724848cSchristos
15*4724848cSchristosReset B<ssl> to allow another connection. All settings (method, ciphers,
16*4724848cSchristosBIOs) are kept.
17*4724848cSchristos
18*4724848cSchristos=head1 NOTES
19*4724848cSchristos
20*4724848cSchristosSSL_clear is used to prepare an SSL object for a new connection. While all
21*4724848cSchristossettings are kept, a side effect is the handling of the current SSL session.
22*4724848cSchristosIf a session is still B<open>, it is considered bad and will be removed
23*4724848cSchristosfrom the session cache, as required by RFC2246. A session is considered open,
24*4724848cSchristosif L<SSL_shutdown(3)> was not called for the connection
25*4724848cSchristosor at least L<SSL_set_shutdown(3)> was used to
26*4724848cSchristosset the SSL_SENT_SHUTDOWN state.
27*4724848cSchristos
28*4724848cSchristosIf a session was closed cleanly, the session object will be kept and all
29*4724848cSchristossettings corresponding. This explicitly means, that e.g. the special method
30*4724848cSchristosused during the session will be kept for the next handshake. So if the
31*4724848cSchristossession was a TLSv1 session, a SSL client object will use a TLSv1 client
32*4724848cSchristosmethod for the next handshake and a SSL server object will use a TLSv1
33*4724848cSchristosserver method, even if TLS_*_methods were chosen on startup. This
34*4724848cSchristoswill might lead to connection failures (see L<SSL_new(3)>)
35*4724848cSchristosfor a description of the method's properties.
36*4724848cSchristos
37*4724848cSchristos=head1 WARNINGS
38*4724848cSchristos
39*4724848cSchristosSSL_clear() resets the SSL object to allow for another connection. The
40*4724848cSchristosreset operation however keeps several settings of the last sessions
41*4724848cSchristos(some of these settings were made automatically during the last
42*4724848cSchristoshandshake). It only makes sense for a new connection with the exact
43*4724848cSchristossame peer that shares these settings, and may fail if that peer
44*4724848cSchristoschanges its settings between connections. Use the sequence
45*4724848cSchristosL<SSL_get_session(3)>;
46*4724848cSchristosL<SSL_new(3)>;
47*4724848cSchristosL<SSL_set_session(3)>;
48*4724848cSchristosL<SSL_free(3)>
49*4724848cSchristosinstead to avoid such failures
50*4724848cSchristos(or simply L<SSL_free(3)>; L<SSL_new(3)>
51*4724848cSchristosif session reuse is not desired).
52*4724848cSchristos
53*4724848cSchristos=head1 RETURN VALUES
54*4724848cSchristos
55*4724848cSchristosThe following return values can occur:
56*4724848cSchristos
57*4724848cSchristos=over 4
58*4724848cSchristos
59*4724848cSchristos=item Z<>0
60*4724848cSchristos
61*4724848cSchristosThe SSL_clear() operation could not be performed. Check the error stack to
62*4724848cSchristosfind out the reason.
63*4724848cSchristos
64*4724848cSchristos=item Z<>1
65*4724848cSchristos
66*4724848cSchristosThe SSL_clear() operation was successful.
67*4724848cSchristos
68*4724848cSchristos=back
69*4724848cSchristos
70*4724848cSchristosL<SSL_new(3)>, L<SSL_free(3)>,
71*4724848cSchristosL<SSL_shutdown(3)>, L<SSL_set_shutdown(3)>,
72*4724848cSchristosL<SSL_CTX_set_options(3)>, L<ssl(7)>,
73*4724848cSchristosL<SSL_CTX_set_client_cert_cb(3)>
74*4724848cSchristos
75*4724848cSchristos=head1 COPYRIGHT
76*4724848cSchristos
77*4724848cSchristosCopyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
78*4724848cSchristos
79*4724848cSchristosLicensed under the OpenSSL license (the "License").  You may not use
80*4724848cSchristosthis file except in compliance with the License.  You can obtain a copy
81*4724848cSchristosin the file LICENSE in the source distribution or at
82*4724848cSchristosL<https://www.openssl.org/source/license.html>.
83*4724848cSchristos
84*4724848cSchristos=cut
85