diff options
author | Juergen Christ <jchrist@linux.ibm.com> | 2023-01-16 11:37:15 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-01-17 17:38:29 +0100 |
commit | 05040e9697104ad65a1f111ac29c9d8cf4ead705 (patch) | |
tree | e0b4ed13e084ea81f0b689e4aae784099556fcb4 | |
parent | 16129bf1b8470d512572eb4571ed4a33fb08d1a2 (diff) |
Fix potential NULL pointer dereference
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)
-rw-r--r-- | providers/implementations/keymgmt/ec_kmgmt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index 30c8a30105..4eafc319c2 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -1004,10 +1004,10 @@ static void *ec_gen_init(void *provctx, int selection, 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; } |