summaryrefslogtreecommitdiff
path: root/src/lib/libssl/t1_enc.c
diff options
context:
space:
mode:
authordoug <>2014-12-15 00:46:53 +0000
committerdoug <>2014-12-15 00:46:53 +0000
commit5ff3741c44f372895206f59414df34e2dcd5eaa0 (patch)
treea755a6603462bb1b649e3f343d73dd0e1c3b34c5 /src/lib/libssl/t1_enc.c
parent02216b57a0ccb0dd187f3ea646c6ae40e827d3ae (diff)
downloadopenbsd-5ff3741c44f372895206f59414df34e2dcd5eaa0.tar.gz
openbsd-5ff3741c44f372895206f59414df34e2dcd5eaa0.tar.bz2
openbsd-5ff3741c44f372895206f59414df34e2dcd5eaa0.zip
Add error handling for EVP_DigestInit_ex().
A few EVP_DigestInit_ex() calls were left alone since reporting an error would change the public API. Changed internal ssl3_cbc_digest_record() to return a value due to the above change. It will also now set md_out_size=0 on failure. This is based on part of BoringSSL's commit to fix malloc crashes: https://boringssl.googlesource.com/boringssl/+/69a01608f33ab6fe2c3485d94aef1fe9eacf5364 ok miod@
Diffstat (limited to 'src/lib/libssl/t1_enc.c')
-rw-r--r--src/lib/libssl/t1_enc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c
index 4aae344696..3b7e625db3 100644
--- a/src/lib/libssl/t1_enc.c
+++ b/src/lib/libssl/t1_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_enc.c,v 1.74 2014/12/14 15:30:50 jsing Exp $ */ 1/* $OpenBSD: t1_enc.c,v 1.75 2014/12/15 00:46:53 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1054,12 +1054,13 @@ tls1_mac(SSL *ssl, unsigned char *md, int send)
1054 * timing-side channel information about how many blocks of 1054 * timing-side channel information about how many blocks of
1055 * data we are hashing because that gives an attacker a 1055 * data we are hashing because that gives an attacker a
1056 * timing-oracle. */ 1056 * timing-oracle. */
1057 ssl3_cbc_digest_record(mac_ctx, 1057 if (!ssl3_cbc_digest_record(mac_ctx,
1058 md, &md_size, header, rec->input, 1058 md, &md_size, header, rec->input,
1059 rec->length + md_size, orig_len, 1059 rec->length + md_size, orig_len,
1060 ssl->s3->read_mac_secret, 1060 ssl->s3->read_mac_secret,
1061 ssl->s3->read_mac_secret_size, 1061 ssl->s3->read_mac_secret_size,
1062 0 /* not SSLv3 */); 1062 0 /* not SSLv3 */))
1063 return -1;
1063 } else { 1064 } else {
1064 EVP_DigestSignUpdate(mac_ctx, header, sizeof(header)); 1065 EVP_DigestSignUpdate(mac_ctx, header, sizeof(header));
1065 EVP_DigestSignUpdate(mac_ctx, rec->input, rec->length); 1066 EVP_DigestSignUpdate(mac_ctx, rec->input, rec->length);