aboutsummaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-08-24 11:32:48 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-09-05 15:41:30 +1000
commit7ce49eeaca2081ccd881fc1b22fac2d08d3bb69a (patch)
tree56cd8cc98a8110e6fbd698e2de9ec749fe2f90ef /providers
parentea478697927798ff2850ea94b4938bb0c76da48b (diff)
downloadopenssl-7ce49eeaca2081ccd881fc1b22fac2d08d3bb69a.tar.gz
Fix coverity CID #1466377 - resource leak due to early return in ec_get_params().
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/12708)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/keymgmt/ec_kmgmt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c
index cb5e2291da..05b5fdd969 100644
--- a/providers/implementations/keymgmt/ec_kmgmt.c
+++ b/providers/implementations/keymgmt/ec_kmgmt.c
@@ -526,10 +526,10 @@ int ec_get_params(void *key, OSSL_PARAM params[])
if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MAX_SIZE)) != NULL
&& !OSSL_PARAM_set_int(p, ECDSA_size(eck)))
- return 0;
+ goto err;
if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_BITS)) != NULL
&& !OSSL_PARAM_set_int(p, EC_GROUP_order_bits(ecg)))
- return 0;
+ goto err;
if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_SECURITY_BITS)) != NULL) {
int ecbits, sec_bits;
@@ -565,12 +565,12 @@ int ec_get_params(void *key, OSSL_PARAM params[])
sec_bits = ecbits / 2;
if (!OSSL_PARAM_set_int(p, sec_bits))
- return 0;
+ goto err;
}
if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_DEFAULT_DIGEST)) != NULL
&& !OSSL_PARAM_set_utf8_string(p, EC_DEFAULT_MD))
- return 0;
+ goto err;
p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_USE_COFACTOR_ECDH);
if (p != NULL) {
@@ -580,7 +580,7 @@ int ec_get_params(void *key, OSSL_PARAM params[])
(EC_KEY_get_flags(eck) & EC_FLAG_COFACTOR_ECDH) ? 1 : 0;
if (!OSSL_PARAM_set_int(p, ecdh_cofactor_mode))
- return 0;
+ goto err;
}
if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_TLS_ENCODED_PT)) != NULL) {
p->return_size = EC_POINT_point2oct(EC_KEY_get0_group(key),