From 0df56c30f7ad1d29bac5ed2546069402d6219c15 Mon Sep 17 00:00:00 2001 From: Pauli Date: Mon, 10 May 2021 14:13:30 +1000 Subject: [PATCH] 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) --- crypto/evp/digest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.47.3