summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-06-07 09:20:16 +1000
committerPauli <pauli@openssl.org>2021-06-08 19:32:17 +1000
commit37bbe449294b63f87b03e792cae465b0b095299a (patch)
tree1a500a08299fbadafa1d48e728680dd402c5d9b8 /crypto
parent95c8a5125207a62362345d85be77531ad9654edd (diff)
bio: improve error checking fixing coverity 1485659 & 1485665
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15635)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/bio_ok.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c
index 97641d11d1..97e67fcb68 100644
--- a/crypto/evp/bio_ok.c
+++ b/crypto/evp/bio_ok.c
@@ -483,9 +483,11 @@ static int sig_in(BIO *b)
void *md_data;
ctx = BIO_get_data(b);
- md = ctx->md;
+ if ((md = ctx->md) == NULL)
+ goto berr;
digest = EVP_MD_CTX_get0_md(md);
- md_size = EVP_MD_get_size(digest);
+ if ((md_size = EVP_MD_get_size(digest)) < 0)
+ goto berr;
md_data = EVP_MD_CTX_get0_md_data(md);
if ((int)(ctx->buf_len - ctx->buf_off) < 2 * md_size)
@@ -562,6 +564,8 @@ static int block_in(BIO *b)
ctx = BIO_get_data(b);
md = ctx->md;
md_size = EVP_MD_get_size(EVP_MD_CTX_get0_md(md));
+ if (md_size < 0)
+ goto berr;
assert(sizeof(tl) >= OK_BLOCK_BLOCK); /* always true */
tl = ctx->buf[0];