summaryrefslogtreecommitdiffstats
path: root/crypto/evp/digest.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-05-10 14:13:30 +1000
committerPauli <pauli@openssl.org>2021-05-12 11:11:53 +1000
commit0df56c30f7ad1d29bac5ed2546069402d6219c15 (patch)
treef93719459aa0a91548396d0b0b53e3b5715260db /crypto/evp/digest.c
parent4885ecffc7857a3eb4ef580763b1200cbaf9f45e (diff)
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 <shane.lontis@oracle.com> Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/15208)
Diffstat (limited to 'crypto/evp/digest.c')
-rw-r--r--crypto/evp/digest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index e584bd8b2b..25ce609854 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) {