Skip to content

Commit

Permalink
check the return value of EVP_MD_fetch in ecdh_exch.c:285 & dh_exch.c…
Browse files Browse the repository at this point in the history
…:347

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #17153)

(cherry picked from commit 04e3ab6)
  • Loading branch information
x2018 authored and t8m committed Nov 9, 2022
1 parent 9316125 commit ea578b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions providers/implementations/exchange/dh_exch.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,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);
Expand Down
5 changes: 3 additions & 2 deletions providers/implementations/exchange/ecdh_exch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ea578b6

Please sign in to comment.