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