SSL_CLEAR(3ossl)
π
SSL_CLEAR(3ossl) β reset SSL object to allow another connection β¨
okay so bestie, this is an OpenSSL page, and it's honestly giving βclean slate but with receiptsβ energy. Let's get into it π«Ά
π NAME π
SSL_clear β reset SSL object to allow another connection
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
int SSL_clear(SSL *ssl);
πΈ DESCRIPTION πΈ
Reset ssl to allow another connection. All settings β the method, ciphers, and BIOs β are kept. no cap, they stay π
π§ NOTES π§
SSL_clear is used to prepare an SSL object for a new connection. While all settings are kept, there is a side effect: it handles the current SSL session. If a session is still open, it is considered bad and will be removed from the session cache, as required by RFC2246. A session is considered open if SSL_shutdown(3) was not called for the connection, or if at least SSL_set_shutdown(3) was used to set the SSL_SENT_SHUTDOWN state.
If a session was closed cleanly, the session object will be kept, and all settings corresponding to it will be kept too. This explicitly means that, for example, the special method used during the session will be kept for the next handshake. So if the session was a TLSv1 session, an SSL client object will use a TLSv1 client method for the next handshake, and an SSL server object will use a TLSv1 server method, even if TLS_*_methods were chosen on startup. This will might lead to connection failures β see SSL_new(3) for a description of the method's properties π
This function is not supported on QUIC SSL objects and returns failure if called on such an object.
β οΈ WARNINGS β οΈ
SSL_clear() resets the SSL object to allow for another connection. The reset operation, however, keeps several settings of the last sessions β some of these settings were made automatically during the last handshake. It only makes sense for a new connection with the exact same peer that shares these settings, and may fail if that peer changes its settings between connections. Use the sequence SSL_get_session(3); SSL_new(3); SSL_set_session(3); SSL_free(3) instead to avoid such failures β or simply SSL_free(3); SSL_new(3) if session reuse is not desired. bestie, that's the safe route π
π RETURN VALUES π
The following return values can occur:
0β TheSSL_clear()operation could not be performed. Check the error stack to find out the reason.1β TheSSL_clear()operation was successful.
π SEE ALSO π
SSL_new(3)SSL_free(3)SSL_shutdown(3)SSL_set_shutdown(3)SSL_CTX_set_options(3)ssl(7)SSL_CTX_set_client_cert_cb(3)
π COPYRIGHT π
Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
signed off from OpenSSL 3.5.0, dated 2026-09-25 β periodt, go clear that SSL object responsibly πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms