ec_gen_set_params() can fail after some big numbers have already been
copied over. Those need to be cleaned to avoid a memory leak on failure.
This can be done with ec_gen_cleanup(), which is also consistent in how
the ecx_gen code does it.
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29335)
gctx->ecdh_mode = 0;
OSSL_FIPS_IND_INIT(gctx)
if (!ec_gen_set_params(gctx, params)) {
- OPENSSL_free(gctx);
+ ec_gen_cleanup(gctx);
gctx = NULL;
}
}