diff options
author | xkernel <xkernel.wang@foxmail.com> | 2022-12-15 00:22:40 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-12-22 12:15:49 +0100 |
commit | 467b0492c1e597857b30b91ed72605387aa9825b (patch) | |
tree | 081580090e1db346dd69477467197b61e510e104 /providers | |
parent | 0e4e03c8528ab54a5b125582afdf2cdadfb6c9bb (diff) | |
download | openssl-new-467b0492c1e597857b30b91ed72605387aa9825b.tar.gz |
ec_kmgmt.c: check the return of BN_CTX_get() in time.
If x and y are all NULL, then it is unnecessary to do subsequent operations.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19905)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/keymgmt/ec_kmgmt.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index b23fab5fde..cecb8cef3e 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -158,10 +158,16 @@ int key_to_params(const EC_KEY *eckey, OSSL_PARAM_BLD *tmpl, goto err; } if (px != NULL || py != NULL) { - if (px != NULL) + if (px != NULL) { x = BN_CTX_get(bnctx); - if (py != NULL) + if (x == NULL) + goto err; + } + if (py != NULL) { y = BN_CTX_get(bnctx); + if (y == NULL) + goto err; + } if (!EC_POINT_get_affine_coordinates(ecg, pub_point, x, y, bnctx)) goto err; |