diff options
author | Matt Caswell <matt@openssl.org> | 2016-06-22 14:37:57 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-07-18 14:30:14 +0100 |
commit | 149c2ef5ec64f246de978c5c917405dafc6983dc (patch) | |
tree | fda70f2359140cc342a96e724527d2f8229a8479 /ssl | |
parent | 672f3337c36d932bf214edf0a1a65fd069142282 (diff) |
Make sure we call ssl3_digest_cached_records() when necessary
Having received a ClientKeyExchange message instead of a Certificate we
know that we are not going to receive a CertificateVerify message. This
means we can free up the handshake_buffer. However we better call
ssl3_digest_cached_records() instead of just freeing it up, otherwise we
later try and use it anyway and a core dump results. This could happen,
for example, in SSLv3 where we send a CertificateRequest but the client
sends no Certificate message at all. This is valid in SSLv3 (in TLS
clients are required to send an empty Certificate message).
Found using the BoringSSL test suite.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/statem/statem_srvr.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c index c011523228..477af27108 100644 --- a/ssl/statem/statem_srvr.c +++ b/ssl/statem/statem_srvr.c @@ -2587,17 +2587,16 @@ WORK_STATE tls_post_process_client_key_exchange(SSL *s, WORK_STATE wst) } #endif - if (s->statem.no_cert_verify) { - /* No certificate verify so we no longer need the handshake_buffer */ - BIO_free(s->s3->handshake_buffer); - s->s3->handshake_buffer = NULL; + if (s->statem.no_cert_verify || !s->session->peer) { + /* No certificate verify or no peer certificate so we no longer need the + * handshake_buffer + */ + if (!ssl3_digest_cached_records(s, 0)) { + ossl_statem_set_error(s); + return WORK_ERROR; + } return WORK_FINISHED_CONTINUE; } else { - if (!s->session->peer) { - /* No peer certificate so we no longer need the handshake_buffer */ - BIO_free(s->s3->handshake_buffer); - return WORK_FINISHED_CONTINUE; - } if (!s->s3->handshake_buffer) { SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); |