From ede38a3e9c0f6e8cb4b0f59663295ca5bb07b262 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 31 Mar 2022 09:36:09 +0000 Subject: [PATCH] Check EVPDigest* return values. CID 351293 --- regress/lib/libcrypto/ecdsa/ecdsatest.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/regress/lib/libcrypto/ecdsa/ecdsatest.c b/regress/lib/libcrypto/ecdsa/ecdsatest.c index 6d6797ab397..683260aeeef 100644 --- a/regress/lib/libcrypto/ecdsa/ecdsatest.c +++ b/regress/lib/libcrypto/ecdsa/ecdsatest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecdsatest.c,v 1.8 2022/01/12 09:02:34 tb Exp $ */ +/* $OpenBSD: ecdsatest.c,v 1.9 2022/03/31 09:36:09 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -103,9 +103,12 @@ x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in) if ((md_ctx = EVP_MD_CTX_new()) == NULL) goto x962_int_err; /* get the message digest */ - EVP_DigestInit(md_ctx, EVP_sha1()); - EVP_DigestUpdate(md_ctx, (const void*)message, 3); - EVP_DigestFinal(md_ctx, digest, &dgst_len); + if (!EVP_DigestInit(md_ctx, EVP_sha1())) + goto x962_int_err; + if (!EVP_DigestUpdate(md_ctx, (const void*)message, 3)) + goto x962_int_err; + if (!EVP_DigestFinal(md_ctx, digest, &dgst_len)) + goto x962_int_err; BIO_printf(out, "testing %s: ", OBJ_nid2sn(nid)); /* create the key */ -- 2.20.1