Blame doc/man3/SSL_SESSION_free.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
SSL_SESSION_new,
Packit c4476c
SSL_SESSION_dup,
Packit c4476c
SSL_SESSION_up_ref,
Packit c4476c
SSL_SESSION_free - create, free and manage SSL_SESSION structures
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/ssl.h>
Packit c4476c
Packit c4476c
 SSL_SESSION *SSL_SESSION_new(void);
Packit c4476c
 SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src);
Packit c4476c
 int SSL_SESSION_up_ref(SSL_SESSION *ses);
Packit c4476c
 void SSL_SESSION_free(SSL_SESSION *session);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
SSL_SESSION_new() creates a new SSL_SESSION structure and returns a pointer to
Packit c4476c
it.
Packit c4476c
Packit c4476c
SSL_SESSION_dup() copies the contents of the SSL_SESSION structure in B<src>
Packit c4476c
and returns a pointer to it.
Packit c4476c
Packit c4476c
SSL_SESSION_up_ref() increments the reference count on the given SSL_SESSION
Packit c4476c
structure.
Packit c4476c
Packit c4476c
SSL_SESSION_free() decrements the reference count of B<session> and removes
Packit c4476c
the B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated
Packit c4476c
memory, if the reference count has reached 0.
Packit c4476c
If B<session> is NULL nothing is done.
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
SSL_SESSION objects are allocated, when a TLS/SSL handshake operation
Packit c4476c
is successfully completed. Depending on the settings, see
Packit c4476c
L<SSL_CTX_set_session_cache_mode(3)>,
Packit c4476c
the SSL_SESSION objects are internally referenced by the SSL_CTX and
Packit c4476c
linked into its session cache. SSL objects may be using the SSL_SESSION object;
Packit c4476c
as a session may be reused, several SSL objects may be using one SSL_SESSION
Packit c4476c
object at the same time. It is therefore crucial to keep the reference
Packit c4476c
count (usage information) correct and not delete a SSL_SESSION object
Packit c4476c
that is still used, as this may lead to program failures due to
Packit c4476c
dangling pointers. These failures may also appear delayed, e.g.
Packit c4476c
when an SSL_SESSION object was completely freed as the reference count
Packit c4476c
incorrectly became 0, but it is still referenced in the internal
Packit c4476c
session cache and the cache list is processed during a
Packit c4476c
L<SSL_CTX_flush_sessions(3)> operation.
Packit c4476c
Packit c4476c
SSL_SESSION_free() must only be called for SSL_SESSION objects, for
Packit c4476c
which the reference count was explicitly incremented (e.g.
Packit c4476c
by calling SSL_get1_session(), see L<SSL_get_session(3)>)
Packit c4476c
or when the SSL_SESSION object was generated outside a TLS handshake
Packit c4476c
operation, e.g. by using L<d2i_SSL_SESSION(3)>.
Packit c4476c
It must not be called on other SSL_SESSION objects, as this would cause
Packit c4476c
incorrect reference counts and therefore program failures.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
SSL_SESSION_new returns a pointer to the newly allocated SSL_SESSION structure
Packit c4476c
or NULL on error.
Packit c4476c
Packit c4476c
SSL_SESSION_up_ref returns 1 on success or 0 on error.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<ssl(7)>, L<SSL_get_session(3)>,
Packit c4476c
L<SSL_CTX_set_session_cache_mode(3)>,
Packit c4476c
L<SSL_CTX_flush_sessions(3)>,
Packit c4476c
L<d2i_SSL_SESSION(3)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
The SSL_SESSION_dup() function was added in OpenSSL 1.1.1.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut