1*10e00d17Sschwarze.\" $OpenBSD: SSL_CTX_set_timeout.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ 2c04b070fSschwarze.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 3f1a3c524Sschwarze.\" 4c04b070fSschwarze.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 5c04b070fSschwarze.\" Copyright (c) 2001 The OpenSSL Project. All rights reserved. 6f1a3c524Sschwarze.\" 7c04b070fSschwarze.\" Redistribution and use in source and binary forms, with or without 8c04b070fSschwarze.\" modification, are permitted provided that the following conditions 9c04b070fSschwarze.\" are met: 10c04b070fSschwarze.\" 11c04b070fSschwarze.\" 1. Redistributions of source code must retain the above copyright 12c04b070fSschwarze.\" notice, this list of conditions and the following disclaimer. 13c04b070fSschwarze.\" 14c04b070fSschwarze.\" 2. Redistributions in binary form must reproduce the above copyright 15c04b070fSschwarze.\" notice, this list of conditions and the following disclaimer in 16c04b070fSschwarze.\" the documentation and/or other materials provided with the 17c04b070fSschwarze.\" distribution. 18c04b070fSschwarze.\" 19c04b070fSschwarze.\" 3. All advertising materials mentioning features or use of this 20c04b070fSschwarze.\" software must display the following acknowledgment: 21c04b070fSschwarze.\" "This product includes software developed by the OpenSSL Project 22c04b070fSschwarze.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 23c04b070fSschwarze.\" 24c04b070fSschwarze.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 25c04b070fSschwarze.\" endorse or promote products derived from this software without 26c04b070fSschwarze.\" prior written permission. For written permission, please contact 27c04b070fSschwarze.\" openssl-core@openssl.org. 28c04b070fSschwarze.\" 29c04b070fSschwarze.\" 5. Products derived from this software may not be called "OpenSSL" 30c04b070fSschwarze.\" nor may "OpenSSL" appear in their names without prior written 31c04b070fSschwarze.\" permission of the OpenSSL Project. 32c04b070fSschwarze.\" 33c04b070fSschwarze.\" 6. Redistributions of any form whatsoever must retain the following 34c04b070fSschwarze.\" acknowledgment: 35c04b070fSschwarze.\" "This product includes software developed by the OpenSSL Project 36c04b070fSschwarze.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 37c04b070fSschwarze.\" 38c04b070fSschwarze.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 39c04b070fSschwarze.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40c04b070fSschwarze.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 41c04b070fSschwarze.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 42c04b070fSschwarze.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 43c04b070fSschwarze.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 44c04b070fSschwarze.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 45c04b070fSschwarze.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 46c04b070fSschwarze.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 47c04b070fSschwarze.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 48c04b070fSschwarze.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49c04b070fSschwarze.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50c04b070fSschwarze.\" 51*10e00d17Sschwarze.Dd $Mdocdate: March 27 2018 $ 52f1a3c524Sschwarze.Dt SSL_CTX_SET_TIMEOUT 3 53f1a3c524Sschwarze.Os 54f1a3c524Sschwarze.Sh NAME 55f1a3c524Sschwarze.Nm SSL_CTX_set_timeout , 56f1a3c524Sschwarze.Nm SSL_CTX_get_timeout 57f1a3c524Sschwarze.Nd manipulate timeout values for session caching 58f1a3c524Sschwarze.Sh SYNOPSIS 59f1a3c524Sschwarze.In openssl/ssl.h 60f1a3c524Sschwarze.Ft long 61f1a3c524Sschwarze.Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" 62f1a3c524Sschwarze.Ft long 63f1a3c524Sschwarze.Fn SSL_CTX_get_timeout "SSL_CTX *ctx" 64f1a3c524Sschwarze.Sh DESCRIPTION 65f1a3c524Sschwarze.Fn SSL_CTX_set_timeout 66f1a3c524Sschwarzesets the timeout for newly created sessions for 67f1a3c524Sschwarze.Fa ctx 68f1a3c524Sschwarzeto 69f1a3c524Sschwarze.Fa t . 70f1a3c524SschwarzeThe timeout value 71f1a3c524Sschwarze.Fa t 72f1a3c524Sschwarzemust be given in seconds. 73f1a3c524Sschwarze.Pp 74f1a3c524Sschwarze.Fn SSL_CTX_get_timeout 75f1a3c524Sschwarzereturns the currently set timeout value for 76f1a3c524Sschwarze.Fa ctx . 77c04b070fSschwarze.Pp 78f1a3c524SschwarzeWhenever a new session is created, it is assigned a maximum lifetime. 79f1a3c524SschwarzeThis lifetime is specified by storing the creation time of the session and the 80f1a3c524Sschwarzetimeout value valid at this time. 81f1a3c524SschwarzeIf the actual time is later than creation time plus timeout, 82f1a3c524Sschwarzethe session is not reused. 83f1a3c524Sschwarze.Pp 84f1a3c524SschwarzeDue to this realization, all sessions behave according to the timeout value 85f1a3c524Sschwarzevalid at the time of the session negotiation. 86f1a3c524SschwarzeChanges of the timeout value do not affect already established sessions. 87f1a3c524Sschwarze.Pp 88f1a3c524SschwarzeThe expiration time of a single session can be modified using the 89f1a3c524Sschwarze.Xr SSL_SESSION_get_time 3 90f1a3c524Sschwarzefamily of functions. 91f1a3c524Sschwarze.Pp 92f1a3c524SschwarzeExpired sessions are removed from the internal session cache, whenever 93f1a3c524Sschwarze.Xr SSL_CTX_flush_sessions 3 94f1a3c524Sschwarzeis called, either directly by the application or automatically (see 95f1a3c524Sschwarze.Xr SSL_CTX_set_session_cache_mode 3 ) . 96f1a3c524Sschwarze.Pp 97f1a3c524SschwarzeThe default value for session timeout is decided on a per-protocol basis; see 98f1a3c524Sschwarze.Xr SSL_get_default_timeout 3 . 99f1a3c524SschwarzeAll currently supported protocols have the same default timeout value of 300 100f1a3c524Sschwarzeseconds. 101f1a3c524Sschwarze.Sh RETURN VALUES 102f1a3c524Sschwarze.Fn SSL_CTX_set_timeout 103f1a3c524Sschwarzereturns the previously set timeout value. 104f1a3c524Sschwarze.Pp 105f1a3c524Sschwarze.Fn SSL_CTX_get_timeout 106f1a3c524Sschwarzereturns the currently set timeout value. 107f1a3c524Sschwarze.Sh SEE ALSO 108f1a3c524Sschwarze.Xr ssl 3 , 109f1a3c524Sschwarze.Xr SSL_CTX_flush_sessions 3 , 110f1a3c524Sschwarze.Xr SSL_CTX_set_session_cache_mode 3 , 111f1a3c524Sschwarze.Xr SSL_get_default_timeout 3 , 112f1a3c524Sschwarze.Xr SSL_SESSION_get_time 3 1138fba1ec8Sschwarze.Sh HISTORY 1148fba1ec8Sschwarze.Fn SSL_CTX_set_timeout 1158fba1ec8Sschwarzeand 1168fba1ec8Sschwarze.Fn SSL_CTX_get_timeout 117*10e00d17Sschwarzefirst appeared in SSLeay 0.6.1 and have been available since 1188fba1ec8Sschwarze.Ox 2.4 . 119