1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Fixed issue with session id's in the future

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@224 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich 2012-02-25 08:07:12 +00:00
parent 5fcb19810a
commit c0074b3044

View File

@ -1667,8 +1667,10 @@ SSL_SESSION *ssl_session_update(int max_sessions, SSL_SESSION *ssl_sessions[],
{ {
if (ssl_sessions[i]) if (ssl_sessions[i])
{ {
/* kill off any expired sessions */ /* kill off any expired sessions (including those in
if (tm > ssl_sessions[i]->conn_time + SSL_EXPIRY_TIME) the future) */
if ((tm > ssl_sessions[i]->conn_time + SSL_EXPIRY_TIME) ||
(tm < ssl_sessions[i]->conn_time))
{ {
session_free(ssl_sessions, i); session_free(ssl_sessions, i);
continue; continue;
@ -1712,13 +1714,9 @@ SSL_SESSION *ssl_session_update(int max_sessions, SSL_SESSION *ssl_sessions[],
} }
/* ok, we've used up all of our sessions. So blow the oldest session away */ /* ok, we've used up all of our sessions. So blow the oldest session away */
if (oldest_sess != NULL) oldest_sess->conn_time = tm;
{ memset(oldest_sess->session_id, 0, sizeof(SSL_SESSION_ID_SIZE));
oldest_sess->conn_time = tm; memset(oldest_sess->master_secret, 0, sizeof(SSL_SECRET_SIZE));
memset(oldest_sess->session_id, 0, sizeof(SSL_SESSION_ID_SIZE));
memset(oldest_sess->master_secret, 0, sizeof(SSL_SECRET_SIZE));
}
SSL_CTX_UNLOCK(ssl->ssl_ctx->mutex); SSL_CTX_UNLOCK(ssl->ssl_ctx->mutex);
return oldest_sess; return oldest_sess;
} }