]> granicus.if.org Git - openssl/commitdiff
The ssl3_digest_cached_records() function does not handle errors properly
authorMatt Caswell <matt@openssl.org>
Thu, 26 May 2016 14:45:14 +0000 (15:45 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 26 May 2016 15:13:08 +0000 (16:13 +0100)
The ssl3_digest_cached_records() function was failing to handle errors
that might be returned from EVP_DigestSignInit() and
EVP_DigestSignUpdate().

RT#4180

Reviewed-by: Stephen Henson <steve@openssl.org>
ssl/s3_enc.c

index 47a0ec9fe04b18934cb80db91d52fb57539ab686..b9fc0c7049264b058f0c5ae43449c3280e49c808 100644 (file)
@@ -624,8 +624,12 @@ int ssl3_digest_cached_records(SSL *s)
                                      EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
             }
 #endif
-            EVP_DigestInit_ex(s->s3->handshake_dgst[i], md, NULL);
-            EVP_DigestUpdate(s->s3->handshake_dgst[i], hdata, hdatalen);
+            if (!EVP_DigestInit_ex(s->s3->handshake_dgst[i], md, NULL)
+                || !EVP_DigestUpdate(s->s3->handshake_dgst[i], hdata,
+                                     hdatalen)) {
+                SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, ERR_R_INTERNAL_ERROR);
+                return 0;
+            }
         } else {
             s->s3->handshake_dgst[i] = NULL;
         }