fixes for

F-2554 Missing wc_ecc_free Before free in km_ecdh_init When wc_ecc_set_rng Fails
F-2555 Missing wc_FreeDhKey Before free in km_ffdhe_init When wc_DhSetNamedKey Fails
This commit is contained in:
Daniel Pouzzner
2026-06-08 18:07:38 -05:00
parent 05fc258ca2
commit 67c1d65ef7
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -779,6 +779,7 @@ static int km_ffdhe_init(struct crypto_kpp *tfm, int name, word32 nbits)
pr_err("%s: wc_DhSetNamedKey returned: %d\n", WOLFKM_DH_DRIVER,
err);
#endif /* WOLFKM_DEBUG_DH */
wc_FreeDhKey(ctx->key);
free(ctx->key);
ctx->key = NULL;
return -ENOMEM;
+1
View File
@@ -415,6 +415,7 @@ static int km_ecdh_init(struct crypto_kpp *tfm, int curve_id)
#ifdef ECC_TIMING_RESISTANT
ret = wc_ecc_set_rng(ctx->key, &ctx->rng);
if (ret < 0) {
wc_ecc_free(ctx->key);
free(ctx->key);
ctx->key = NULL;
return -ENOMEM;