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