From: Pauli Date: Mon, 10 May 2021 04:13:30 +0000 (+1000) Subject: evp: fix return code check. X-Git-Tag: openssl-3.0.0-alpha17~176 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0df56c30f7ad1d29bac5ed2546069402d6219c15;p=thirdparty%2Fopenssl.git evp: fix return code check. The return from evp_do_md_getparams() is 0 for failure and -1 for not being a provided algorithm. The code in evp_md_cache_constants() failed to check the return code properly. In this case it was harmless but better to fix it. Reviewed-by: Shane Lontis Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/15208) --- diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index e584bd8b2bf..25ce6098545 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -882,7 +882,7 @@ static int evp_md_cache_constants(EVP_MD *md) params[3] = OSSL_PARAM_construct_int(OSSL_DIGEST_PARAM_ALGID_ABSENT, &algid_absent); params[4] = OSSL_PARAM_construct_end(); - ok = evp_do_md_getparams(md, params); + ok = evp_do_md_getparams(md, params) > 0; if (mdsize > INT_MAX || blksz > INT_MAX) ok = 0; if (ok) {