1SSL_CLEAR(3) OpenSSL SSL_CLEAR(3)
2
3
4
6 SSL_clear - reset SSL object to allow another connection
7
9 #include <openssl/ssl.h>
10
11 int SSL_clear(SSL *ssl);
12
14 Reset ssl to allow another connection. All settings (method, ciphers,
15 BIOs) are kept.
16
18 SSL_clear is used to prepare an SSL object for a new connection. While
19 all settings are kept, a side effect is the handling of the current SSL
20 session. If a session is still open, it is considered bad and will be
21 removed from the session cache, as required by RFC2246. A session is
22 considered open, if SSL_shutdown(3) was not called for the connection
23 or at least SSL_set_shutdown(3) was used to set the SSL_SENT_SHUTDOWN
24 state.
25
26 If a session was closed cleanly, the session object will be kept and
27 all settings corresponding. This explicitly means, that e.g. the
28 special method used during the session will be kept for the next
29 handshake. So if the session was a TLSv1 session, a SSL client object
30 will use a TLSv1 client method for the next handshake and a SSL server
31 object will use a TLSv1 server method, even if TLS_*_methods were
32 chosen on startup. This will might lead to connection failures (see
33 SSL_new(3)) for a description of the method's properties.
34
36 SSL_clear() resets the SSL object to allow for another connection. The
37 reset operation however keeps several settings of the last sessions
38 (some of these settings were made automatically during the last
39 handshake). It only makes sense for a new connection with the exact
40 same peer that shares these settings, and may fail if that peer changes
41 its settings between connections. Use the sequence SSL_get_session(3);
42 SSL_new(3); SSL_set_session(3); SSL_free(3) instead to avoid such
43 failures (or simply SSL_free(3); SSL_new(3) if session reuse is not
44 desired).
45
47 The following return values can occur:
48
49 0 The SSL_clear() operation could not be performed. Check the error
50 stack to find out the reason.
51
52 1 The SSL_clear() operation was successful.
53
54 SSL_new(3), SSL_free(3), SSL_shutdown(3), SSL_set_shutdown(3),
55 SSL_CTX_set_options(3), ssl(7), SSL_CTX_set_client_cert_cb(3)
56
58 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
59
60 Licensed under the OpenSSL license (the "License"). You may not use
61 this file except in compliance with the License. You can obtain a copy
62 in the file LICENSE in the source distribution or at
63 <https://www.openssl.org/source/license.html>.
64
65
66
671.1.1q 2022-07-21 SSL_CLEAR(3)