SSL_set_session.pod 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.
  17. This is also the case when B<session> is a NULL pointer. If that old
  18. session is still B<open>, it is considered bad and will be removed from the
  19. session cache (if used). A session is considered open, if L<SSL_shutdown(3)> was
  20. not called for the connection (or at least L<SSL_set_shutdown(3)> was used to
  21. set the SSL_SENT_SHUTDOWN state).
  22. =head1 NOTES
  23. SSL_SESSION objects keep internal link information about the session cache
  24. list, when being inserted into one SSL_CTX object's session cache.
  25. One SSL_SESSION object, regardless of its reference count, must therefore
  26. only be used with one SSL_CTX object (and the SSL objects created
  27. from this SSL_CTX object).
  28. =head1 RETURN VALUES
  29. The following return values can occur:
  30. =over 4
  31. =item Z<>0
  32. The operation failed; check the error stack to find out the reason.
  33. =item Z<>1
  34. The operation succeeded.
  35. =back
  36. =head1 SEE ALSO
  37. L<ssl(7)>, L<SSL_SESSION_free(3)>,
  38. L<SSL_get_session(3)>,
  39. L<SSL_session_reused(3)>,
  40. L<SSL_CTX_set_session_cache_mode(3)>
  41. =head1 COPYRIGHT
  42. Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
  43. Licensed under the Apache License 2.0 (the "License"). You may not use
  44. this file except in compliance with the License. You can obtain a copy
  45. in the file LICENSE in the source distribution or at
  46. L<https://www.openssl.org/source/license.html>.
  47. =cut