diff options
author | Matt Caswell <matt@openssl.org> | 2018-06-26 18:07:56 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-07-03 09:44:46 +0100 |
commit | 4cb004573a28fe5f8f8d95dc9407e0fe9df6f14c (patch) | |
tree | 807d2d70bf1ac0cd222936d35d2fb757dcf27c13 /ssl/statem | |
parent | 1f1563216d6827e1dc8212795344c82e0f5d5933 (diff) |
Remove TLSv1.3 tickets from the client cache as we use them
Tickets are supposed to be single use so we remove them from the cache on
use.
Fixes #6377
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/6601)
Diffstat (limited to 'ssl/statem')
-rw-r--r-- | ssl/statem/statem_clnt.c | 1 | ||||
-rw-r--r-- | ssl/statem/statem_lib.c | 19 |
2 files changed, 15 insertions, 5 deletions
diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index 26be9cb6b8..88c343761f 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -2682,6 +2682,7 @@ MSG_PROCESS_RETURN tls_process_new_session_ticket(SSL *s, PACKET *pkt) goto err; } s->session->session_id_length = sess_len; + s->session->not_resumable = 0; /* This is a standalone message in TLSv1.3, so there is no more to read */ if (SSL_IS_TLS13(s)) { diff --git a/ssl/statem/statem_lib.c b/ssl/statem/statem_lib.c index 91d304e2b4..61fc3caa1c 100644 --- a/ssl/statem/statem_lib.c +++ b/ssl/statem/statem_lib.c @@ -1068,12 +1068,21 @@ WORK_STATE tls_finish_handshake(SSL *s, WORK_STATE wst, int clearbufs, int stop) dtls1_start_timer(s); } } else { - /* - * In TLSv1.3 we update the cache as part of processing the - * NewSessionTicket - */ - if (!SSL_IS_TLS13(s)) + if (SSL_IS_TLS13(s)) { + /* + * We encourage applications to only use TLSv1.3 tickets once, + * so we remove this one from the cache. + */ + if ((s->session_ctx->session_cache_mode + & SSL_SESS_CACHE_CLIENT) != 0) + SSL_CTX_remove_session(s->session_ctx, s->session); + } else { + /* + * In TLSv1.3 we update the cache as part of processing the + * NewSessionTicket + */ ssl_update_cache(s, SSL_SESS_CACHE_CLIENT); + } if (s->hit) CRYPTO_atomic_add(&s->session_ctx->stats.sess_hit, 1, &discard, s->session_ctx->lock); |