diff options
author | x2018 <xkernel.wang@foxmail.com> | 2021-11-29 15:32:47 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-01-04 12:30:12 +0100 |
commit | 04e3ab64d58bb43efc4392d12c607bb4b5a2c562 (patch) | |
tree | 0063e087bc97dbe3ba0578f3d5b9e0bd553a0f58 /providers | |
parent | d26b3766a0a35668ee62b839a62acbdcd9ff2a98 (diff) | |
download | openssl-04e3ab64d58bb43efc4392d12c607bb4b5a2c562.tar.gz |
check the return value of EVP_MD_fetch in ecdh_exch.c:285 & dh_exch.c:347
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17153)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/exchange/dh_exch.c | 5 | ||||
-rw-r--r-- | providers/implementations/exchange/ecdh_exch.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/providers/implementations/exchange/dh_exch.c b/providers/implementations/exchange/dh_exch.c index 6edf57e0ae..4bea7af4ec 100644 --- a/providers/implementations/exchange/dh_exch.c +++ b/providers/implementations/exchange/dh_exch.c @@ -345,12 +345,13 @@ static int dh_set_ctx_params(void *vpdhctx, const OSSL_PARAM params[]) EVP_MD_free(pdhctx->kdf_md); pdhctx->kdf_md = EVP_MD_fetch(pdhctx->libctx, name, mdprops); + if (pdhctx->kdf_md == NULL) + return 0; if (!ossl_digest_is_allowed(pdhctx->libctx, pdhctx->kdf_md)) { EVP_MD_free(pdhctx->kdf_md); pdhctx->kdf_md = NULL; - } - if (pdhctx->kdf_md == NULL) return 0; + } } p = OSSL_PARAM_locate_const(params, OSSL_EXCHANGE_PARAM_KDF_OUTLEN); diff --git a/providers/implementations/exchange/ecdh_exch.c b/providers/implementations/exchange/ecdh_exch.c index 64b163f5e0..bf6f5c2366 100644 --- a/providers/implementations/exchange/ecdh_exch.c +++ b/providers/implementations/exchange/ecdh_exch.c @@ -283,12 +283,13 @@ int ecdh_set_ctx_params(void *vpecdhctx, const OSSL_PARAM params[]) EVP_MD_free(pectx->kdf_md); pectx->kdf_md = EVP_MD_fetch(pectx->libctx, name, mdprops); + if (pectx->kdf_md == NULL) + return 0; if (!ossl_digest_is_allowed(pectx->libctx, pectx->kdf_md)) { EVP_MD_free(pectx->kdf_md); pectx->kdf_md = NULL; - } - if (pectx->kdf_md == NULL) return 0; + } } p = OSSL_PARAM_locate_const(params, OSSL_EXCHANGE_PARAM_KDF_OUTLEN); |