SSL_CTX_add_session.pod 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_add_session, SSL_CTX_remove_session - manipulate session cache
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c);
  7. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
  8. =head1 DESCRIPTION
  9. SSL_CTX_add_session() adds the session B<c> to the context B<ctx>. The
  10. reference count for session B<c> is incremented by 1. If a session with
  11. the same session id already exists, the old session is removed by calling
  12. L<SSL_SESSION_free(3)>.
  13. SSL_CTX_remove_session() removes the session B<c> from the context B<ctx> and
  14. marks it as non-resumable. L<SSL_SESSION_free(3)> is called once for B<c>.
  15. =head1 NOTES
  16. When adding a new session to the internal session cache, it is examined
  17. whether a session with the same session id already exists. In this case
  18. it is assumed that both sessions are identical. If the same session is
  19. stored in a different SSL_SESSION object, The old session is
  20. removed and replaced by the new session. If the session is actually
  21. identical (the SSL_SESSION object is identical), SSL_CTX_add_session()
  22. is a no-op, and the return value is 0.
  23. If a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE
  24. flag then the internal cache will not be populated automatically by new
  25. sessions negotiated by the SSL/TLS implementation, even though the internal
  26. cache will be searched automatically for session-resume requests (the
  27. latter can be suppressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the
  28. application can use SSL_CTX_add_session() directly to have full control
  29. over the sessions that can be resumed if desired.
  30. =head1 RETURN VALUES
  31. The following values are returned by all functions:
  32. =over 4
  33. =item Z<>0
  34. The operation failed. In case of the add operation, it was tried to add
  35. the same (identical) session twice. In case of the remove operation, the
  36. session was not found in the cache.
  37. =item Z<>1
  38. The operation succeeded.
  39. =back
  40. =head1 SEE ALSO
  41. L<ssl(7)>,
  42. L<SSL_CTX_set_session_cache_mode(3)>,
  43. L<SSL_SESSION_free(3)>
  44. =head1 COPYRIGHT
  45. Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
  46. Licensed under the OpenSSL license (the "License"). You may not use
  47. this file except in compliance with the License. You can obtain a copy
  48. in the file LICENSE in the source distribution or at
  49. L<https://www.openssl.org/source/license.html>.
  50. =cut