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