
#use wml::openssl-macros area=docs page=SSL_clear

<title>Documents, SSL_clear(3)</title>

<h1>SSL_clear(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#NOTES">NOTES</A>
	<LI><A HREF="#WARNINGS">WARNINGS</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
SSL_clear - reset SSL object to allow another connection

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/ssl.h&gt;
</PRE>
<PRE> int SSL_clear(SSL *ssl);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
Reset <STRONG>ssl</STRONG> to allow another connection. All settings (method, ciphers, BIOs) are kept.

</P>
<P>
<HR>
<H1><A NAME="NOTES">NOTES</A></H1>
<P>
SSL_clear is used to prepare an SSL object for a new connection. While all
settings are kept, a side effect is the handling of the current SSL
session. If a session is still <STRONG>open</STRONG>, it is considered bad and will be removed from the session cache, as
required by RFC2246. A session is considered open, if <A HREF="../ssl/SSL_shutdown.html#">SSL_shutdown(3)</A> was not called for the connection or at least <A HREF="../ssl/SSL_set_shutdown.html#">SSL_set_shutdown(3)</A> was used to set the SSL_SENT_SHUTDOWN state.

</P>
<P>
If a session was closed cleanly, the session object will be kept and all
settings corresponding. This explicitly means, that e.g. the special method
used during the session will be kept for the next handshake. So if the
session was a TLSv1 session, a SSL client object will use a TLSv1 client
method for the next handshake and a SSL server object will use a TLSv1
server method, even if SSLv23_*_methods were chosen on startup. This will
might lead to connection failures (see <A HREF="../ssl/SSL_new.html#">SSL_new(3)</A>) for a description of the method's properties.

</P>
<P>
<HR>
<H1><A NAME="WARNINGS">WARNINGS</A></H1>
<P>
<CODE>SSL_clear()</CODE> 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 when opening a new session (or reusing an
old one) with the same peer that shares these settings.
<CODE>SSL_clear()</CODE> is not a short form for the sequence
<A HREF="../ssl/SSL_free.html#">SSL_free(3)</A>; <A HREF="../ssl/SSL_new.html#">SSL_new(3)</A>; .

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
The following return values can occur:

</P>
<DL>
<DT><STRONG><A NAME="item_0">0</A></STRONG><DD>
<P>
The <CODE>SSL_clear()</CODE> operation could not be performed. Check the
error stack to find out the reason.

</P>
<DT><STRONG><A NAME="item_1">1</A></STRONG><DD>
<P>
The <CODE>SSL_clear()</CODE> operation was successful.

</P>
</DL>
<P>
<A HREF="../ssl/SSL_new.html#">SSL_new(3)</A>, <A HREF="../ssl/SSL_free.html#">SSL_free(3)</A>,
<A HREF="../ssl/SSL_shutdown.html#">SSL_shutdown(3)</A>, <A HREF="../ssl/SSL_set_shutdown.html#">SSL_set_shutdown(3)</A>,
<A HREF="../ssl/SSL_CTX_set_options.html#">SSL_CTX_set_options(3)</A>, <A HREF="../ssl/ssl.html#">ssl(3)</A>,
<A HREF="../ssl/SSL_CTX_set_client_cert_cb.html#">SSL_CTX_set_client_cert_cb(3)</A>



</P>
:}

