In EC key generation, if allocation of struct ec_gen_ctx fails, values
provided by parameters are copied into the context at represented by a NULL
pointer. To fix this, prevent copy if allocation fails.
Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20055)
(cherry picked from commit
235ef96049dbe337a3c3c5d419dacbb5a81df1b3)
gctx->libctx = libctx;
gctx->selection = selection;
gctx->ecdh_mode = 0;
- }
- if (!ec_gen_set_params(gctx, params)) {
- OPENSSL_free(gctx);
- gctx = NULL;
+ if (!ec_gen_set_params(gctx, params)) {
+ OPENSSL_free(gctx);
+ gctx = NULL;
+ }
}
return gctx;
}