summaryrefslogtreecommitdiffstats
path: root/ssl/t1_enc.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2013-12-14 13:55:48 +0000
committerDr. Stephen Henson <steve@openssl.org>2013-12-18 13:26:10 +0000
commit0294b2be5f4c11e60620c0018674ff0e17b14238 (patch)
treec142a5421d1c829539854d097551bed703cd552e /ssl/t1_enc.c
parentf1068a1ab726f477ad57783d0d488d4d55f87ded (diff)
Check EVP errors for handshake digests.
Partial mitigation of PR#3200
Diffstat (limited to 'ssl/t1_enc.c')
-rw-r--r--ssl/t1_enc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c
index 809ad2ee1e..72015f5aad 100644
--- a/ssl/t1_enc.c
+++ b/ssl/t1_enc.c
@@ -915,18 +915,19 @@ int tls1_final_finish_mac(SSL *s,
if (mask & ssl_get_algorithm2(s))
{
int hashsize = EVP_MD_size(md);
- if (hashsize < 0 || hashsize > (int)(sizeof buf - (size_t)(q-buf)))
+ EVP_MD_CTX *hdgst = s->s3->handshake_dgst[idx];
+ if (!hdgst || hashsize < 0 || hashsize > (int)(sizeof buf - (size_t)(q-buf)))
{
/* internal error: 'buf' is too small for this cipersuite! */
err = 1;
}
else
{
- EVP_MD_CTX_copy_ex(&ctx,s->s3->handshake_dgst[idx]);
- EVP_DigestFinal_ex(&ctx,q,&i);
- if (i != (unsigned int)hashsize) /* can't really happen */
+ if (!EVP_MD_CTX_copy_ex(&ctx, hdgst) ||
+ !EVP_DigestFinal_ex(&ctx,q,&i) ||
+ (i != (unsigned int)hashsize))
err = 1;
- q+=i;
+ q+=hashsize;
}
}
}