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