summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/ssl/ssl_lib.c
diff options
context:
space:
mode:
authordoug <doug@openbsd.org>2014-12-15 00:46:53 +0000
committerdoug <doug@openbsd.org>2014-12-15 00:46:53 +0000
commitc3782ab635167098e7c9266c2ca490c0e6181f27 (patch)
tree9d94cbd21a621ea5d67d93c859d424edd051fe4c /lib/libssl/src/ssl/ssl_lib.c
parentunconditionally align SSL payloads (diff)
downloadwireguard-openbsd-c3782ab635167098e7c9266c2ca490c0e6181f27.tar.xz
wireguard-openbsd-c3782ab635167098e7c9266c2ca490c0e6181f27.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 'lib/libssl/src/ssl/ssl_lib.c')
-rw-r--r--lib/libssl/src/ssl/ssl_lib.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libssl/src/ssl/ssl_lib.c b/lib/libssl/src/ssl/ssl_lib.c
index e809ff0bc00..8dbd4a3f392 100644
--- a/lib/libssl/src/ssl/ssl_lib.c
+++ b/lib/libssl/src/ssl/ssl_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_lib.c,v 1.93 2014/12/14 14:34:43 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.94 2014/12/15 00:46:53 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -3033,8 +3033,12 @@ ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
{
ssl_clear_hash_ctx(hash);
*hash = EVP_MD_CTX_create();
- if (*hash != NULL && md != NULL)
- EVP_DigestInit_ex(*hash, md, NULL);
+ if (*hash != NULL && md != NULL) {
+ if (!EVP_DigestInit_ex(*hash, md, NULL)) {
+ ssl_clear_hash_ctx(hash);
+ return (NULL);
+ }
+ }
return (*hash);
}