summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_srvr.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/d1_srvr.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/d1_srvr.c')
-rw-r--r--src/lib/libssl/d1_srvr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c
index dee182f541..057d92109c 100644
--- a/src/lib/libssl/d1_srvr.c
+++ b/src/lib/libssl/d1_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_srvr.c,v 1.45 2014/12/14 15:30:50 jsing Exp $ */ 1/* $OpenBSD: d1_srvr.c,v 1.46 2014/12/15 00:46:53 doug Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -1213,8 +1213,9 @@ dtls1_send_server_key_exchange(SSL *s)
1213 q = md_buf; 1213 q = md_buf;
1214 j = 0; 1214 j = 0;
1215 for (num = 2; num > 0; num--) { 1215 for (num = 2; num > 0; num--) {
1216 EVP_DigestInit_ex(&md_ctx, (num == 2) 1216 if (!EVP_DigestInit_ex(&md_ctx, (num == 2)
1217 ? s->ctx->md5 : s->ctx->sha1, NULL); 1217 ? s->ctx->md5 : s->ctx->sha1, NULL))
1218 goto err;
1218 EVP_DigestUpdate(&md_ctx, 1219 EVP_DigestUpdate(&md_ctx,
1219 &(s->s3->client_random[0]), 1220 &(s->s3->client_random[0]),
1220 SSL3_RANDOM_SIZE); 1221 SSL3_RANDOM_SIZE);