diff options
author | doug <> | 2014-12-15 00:46:53 +0000 |
---|---|---|
committer | doug <> | 2014-12-15 00:46:53 +0000 |
commit | 5ff3741c44f372895206f59414df34e2dcd5eaa0 (patch) | |
tree | a755a6603462bb1b649e3f343d73dd0e1c3b34c5 /src/lib/libssl/ssl_lib.c | |
parent | 02216b57a0ccb0dd187f3ea646c6ae40e827d3ae (diff) | |
download | openbsd-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/ssl_lib.c')
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index e809ff0bc0..8dbd4a3f39 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_lib.c,v 1.93 2014/12/14 14:34:43 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.94 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 | * |
@@ -3033,8 +3033,12 @@ ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) | |||
3033 | { | 3033 | { |
3034 | ssl_clear_hash_ctx(hash); | 3034 | ssl_clear_hash_ctx(hash); |
3035 | *hash = EVP_MD_CTX_create(); | 3035 | *hash = EVP_MD_CTX_create(); |
3036 | if (*hash != NULL && md != NULL) | 3036 | if (*hash != NULL && md != NULL) { |
3037 | EVP_DigestInit_ex(*hash, md, NULL); | 3037 | if (!EVP_DigestInit_ex(*hash, md, NULL)) { |
3038 | ssl_clear_hash_ctx(hash); | ||
3039 | return (NULL); | ||
3040 | } | ||
3041 | } | ||
3038 | return (*hash); | 3042 | return (*hash); |
3039 | } | 3043 | } |
3040 | 3044 | ||