summaryrefslogtreecommitdiffstats
path: root/ssl/s3_enc.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-08-27 16:19:27 +0100
committerPauli <paul.dale@oracle.com>2020-08-29 17:56:20 +1000
commit7cd1420b3e53212485e5e7e53ac69929a9bc1ac3 (patch)
treec5a9b0c519123c22f4fbbedbde7dbcb2847d8bfc /ssl/s3_enc.c
parente3bf65da88f714f8721c2985f235b12a7f90d9f8 (diff)
Improve some error messages if a digest is not available
If a digest is not available we just get an "internal error" error message - which isn't very helpful for diagnosing problems. Instead we explicitly state that we couldn't find a suitable digest. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12733)
Diffstat (limited to 'ssl/s3_enc.c')
-rw-r--r--ssl/s3_enc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c
index bd668f317e..bd90e059b5 100644
--- a/ssl/s3_enc.c
+++ b/ssl/s3_enc.c
@@ -408,7 +408,12 @@ int ssl3_digest_cached_records(SSL *s, int keep)
}
md = ssl_handshake_md(s);
- if (md == NULL || !EVP_DigestInit_ex(s->s3.handshake_dgst, md, NULL)
+ if (md == NULL) {
+ SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_DIGEST_CACHED_RECORDS,
+ SSL_R_NO_SUITABLE_DIGEST_ALGORITHM);
+ return 0;
+ }
+ if (!EVP_DigestInit_ex(s->s3.handshake_dgst, md, NULL)
|| !EVP_DigestUpdate(s->s3.handshake_dgst, hdata, hdatalen)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_DIGEST_CACHED_RECORDS,
ERR_R_INTERNAL_ERROR);