SSL_SESSION_free.pod 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. =pod
  2. =head1 NAME
  3. SSL_SESSION_new,
  4. SSL_SESSION_dup,
  5. SSL_SESSION_up_ref,
  6. SSL_SESSION_free - create, free and manage SSL_SESSION structures
  7. =head1 SYNOPSIS
  8. #include <openssl/ssl.h>
  9. SSL_SESSION *SSL_SESSION_new(void);
  10. SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src);
  11. int SSL_SESSION_up_ref(SSL_SESSION *ses);
  12. void SSL_SESSION_free(SSL_SESSION *session);
  13. =head1 DESCRIPTION
  14. SSL_SESSION_new() creates a new SSL_SESSION structure and returns a pointer to
  15. it.
  16. SSL_SESSION_dup() copies the contents of the SSL_SESSION structure in B<src>
  17. and returns a pointer to it.
  18. SSL_SESSION_up_ref() increments the reference count on the given SSL_SESSION
  19. structure.
  20. SSL_SESSION_free() decrements the reference count of B<session> and removes
  21. the B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated
  22. memory, if the reference count has reached 0.
  23. If B<session> is NULL nothing is done.
  24. =head1 NOTES
  25. SSL_SESSION objects are allocated, when a TLS/SSL handshake operation
  26. is successfully completed. Depending on the settings, see
  27. L<SSL_CTX_set_session_cache_mode(3)>,
  28. the SSL_SESSION objects are internally referenced by the SSL_CTX and
  29. linked into its session cache. SSL objects may be using the SSL_SESSION object;
  30. as a session may be reused, several SSL objects may be using one SSL_SESSION
  31. object at the same time. It is therefore crucial to keep the reference
  32. count (usage information) correct and not delete a SSL_SESSION object
  33. that is still used, as this may lead to program failures due to
  34. dangling pointers. These failures may also appear delayed, e.g.
  35. when an SSL_SESSION object was completely freed as the reference count
  36. incorrectly became 0, but it is still referenced in the internal
  37. session cache and the cache list is processed during a
  38. L<SSL_CTX_flush_sessions(3)> operation.
  39. SSL_SESSION_free() must only be called for SSL_SESSION objects, for
  40. which the reference count was explicitly incremented (e.g.
  41. by calling SSL_get1_session(), see L<SSL_get_session(3)>)
  42. or when the SSL_SESSION object was generated outside a TLS handshake
  43. operation, e.g. by using L<d2i_SSL_SESSION(3)>.
  44. It must not be called on other SSL_SESSION objects, as this would cause
  45. incorrect reference counts and therefore program failures.
  46. =head1 RETURN VALUES
  47. SSL_SESSION_new returns a pointer to the newly allocated SSL_SESSION structure
  48. or NULL on error.
  49. SSL_SESSION_up_ref returns 1 on success or 0 on error.
  50. =head1 SEE ALSO
  51. L<ssl(7)>, L<SSL_get_session(3)>,
  52. L<SSL_CTX_set_session_cache_mode(3)>,
  53. L<SSL_CTX_flush_sessions(3)>,
  54. L<d2i_SSL_SESSION(3)>
  55. =head1 HISTORY
  56. SSL_SESSION_dup() was added in OpenSSL 1.1.1.
  57. =head1 COPYRIGHT
  58. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  59. Licensed under the OpenSSL license (the "License"). You may not use
  60. this file except in compliance with the License. You can obtain a copy
  61. in the file LICENSE in the source distribution or at
  62. L<https://www.openssl.org/source/license.html>.
  63. =cut