SSL_clear.pod 2.6 KB

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