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