SSL_set_session.pod 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. =pod
  2. =head1 NAME
  3. SSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. int SSL_set_session(SSL *ssl, SSL_SESSION *session);
  7. =head1 DESCRIPTION
  8. SSL_set_session() sets B<session> to be used when the TLS/SSL connection
  9. is to be established. SSL_set_session() is only useful for TLS/SSL clients.
  10. When the session is set, the reference count of B<session> is incremented
  11. by 1. If the session is not reused, the reference count is decremented
  12. again during SSL_connect(). Whether the session was reused can be queried
  13. with the L<SSL_session_reused(3)> call.
  14. If there is already a session set inside B<ssl> (because it was set with
  15. SSL_set_session() before or because the same B<ssl> was already used for
  16. a connection), SSL_SESSION_free() will be called for that session. If that old
  17. session is still B<open>, it is considered bad and will be removed from the
  18. session cache (if used). A session is considered open, if L<SSL_shutdown(3)> was
  19. not called for the connection (or at least L<SSL_set_shutdown(3)> was used to
  20. set the SSL_SENT_SHUTDOWN state).
  21. =head1 NOTES
  22. SSL_SESSION objects keep internal link information about the session cache
  23. list, when being inserted into one SSL_CTX object's session cache.
  24. One SSL_SESSION object, regardless of its reference count, must therefore
  25. only be used with one SSL_CTX object (and the SSL objects created
  26. from this SSL_CTX object).
  27. =head1 RETURN VALUES
  28. The following return values can occur:
  29. =over 4
  30. =item Z<>0
  31. The operation failed; check the error stack to find out the reason.
  32. =item Z<>1
  33. The operation succeeded.
  34. =back
  35. =head1 SEE ALSO
  36. L<ssl(7)>, L<SSL_SESSION_free(3)>,
  37. L<SSL_get_session(3)>,
  38. L<SSL_session_reused(3)>,
  39. L<SSL_CTX_set_session_cache_mode(3)>
  40. =head1 COPYRIGHT
  41. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  42. Licensed under the Apache License 2.0 (the "License"). You may not use
  43. this file except in compliance with the License. You can obtain a copy
  44. in the file LICENSE in the source distribution or at
  45. L<https://www.openssl.org/source/license.html>.
  46. =cut