diff options
author | Matt Caswell <matt@openssl.org> | 2017-07-18 11:18:31 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2017-07-18 17:35:34 +0100 |
commit | 59ff3f07dc88bca5cec1b28c651c4d398ffd7126 (patch) | |
tree | 208e4f7d58fde7904a942df0a1d7db177bb505e2 /ssl/ssl_lib.c | |
parent | 00848ea842f911dac4e10bb39a08bb4b6de9e66a (diff) |
Fix SSL_clear() in TLSv1.3
SSL_clear() does not reset the SSL_METHOD if a session already exists in
the SSL object. However, TLSv1.3 does not have an externally visible
version fixed method (only an internal one). The state machine assumes
that we are always starting from a version flexible method for TLSv1.3.
The simplest solution is to just fix SSL_clear() to always reset the method
if it is using the internal TLSv1.3 version fixed method.
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/3954)
Diffstat (limited to 'ssl/ssl_lib.c')
-rw-r--r-- | ssl/ssl_lib.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index cef8e41c6f..d02e2816b4 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -566,10 +566,12 @@ int SSL_clear(SSL *s) /* * Check to see if we were changed into a different method, if so, revert - * back if we are not doing session-id reuse. + * back. We always do this in TLSv1.3. Below that we only do it if we are + * not doing session-id reuse. */ - if (!ossl_statem_get_in_handshake(s) && (s->session == NULL) - && (s->method != s->ctx->method)) { + if (s->method != s->ctx->method + && (SSL_IS_TLS13(s) + || (!ossl_statem_get_in_handshake(s) && s->session == NULL))) { s->method->ssl_free(s); s->method = s->ctx->method; if (!s->method->ssl_new(s)) |