summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--providers/implementations/keymgmt/dh_kmgmt.c4
-rw-r--r--providers/implementations/keymgmt/dsa_kmgmt.c5
-rw-r--r--providers/implementations/keymgmt/ec_kmgmt.c10
-rw-r--r--providers/implementations/keymgmt/rsa_kmgmt.c5
4 files changed, 14 insertions, 10 deletions
diff --git a/providers/implementations/keymgmt/dh_kmgmt.c b/providers/implementations/keymgmt/dh_kmgmt.c
index 88fddf51de..58a5fd009f 100644
--- a/providers/implementations/keymgmt/dh_kmgmt.c
+++ b/providers/implementations/keymgmt/dh_kmgmt.c
@@ -236,11 +236,11 @@ static int dh_export(void *keydata, int selection, OSSL_CALLBACK *param_cb,
ok = ok && ossl_dh_key_todata(dh, tmpl, NULL, include_private);
}
- if (!ok
- || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) {
+ if (!ok || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) {
ok = 0;
goto err;
}
+
ok = param_cb(params, cbarg);
OSSL_PARAM_free(params);
err:
diff --git a/providers/implementations/keymgmt/dsa_kmgmt.c b/providers/implementations/keymgmt/dsa_kmgmt.c
index 2ab69f5f32..100e917167 100644
--- a/providers/implementations/keymgmt/dsa_kmgmt.c
+++ b/providers/implementations/keymgmt/dsa_kmgmt.c
@@ -235,9 +235,10 @@ static int dsa_export(void *keydata, int selection, OSSL_CALLBACK *param_cb,
ok = ok && dsa_key_todata(dsa, tmpl, NULL, include_private);
}
- if (!ok
- || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL)
+ if (!ok || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) {
+ ok = 0;
goto err;
+ }
ok = param_cb(params, cbarg);
OSSL_PARAM_free(params);
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c
index bfaae4f234..0d244054e6 100644
--- a/providers/implementations/keymgmt/ec_kmgmt.c
+++ b/providers/implementations/keymgmt/ec_kmgmt.c
@@ -496,12 +496,14 @@ int ec_export(void *keydata, int selection, OSSL_CALLBACK *param_cb,
if ((selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) != 0)
ok = ok && otherparams_to_params(ec, tmpl, NULL);
- if (ok && (params = OSSL_PARAM_BLD_to_param(tmpl)) != NULL)
- ok = param_cb(params, cbarg);
- else
+ if (!ok || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) {
ok = 0;
-end:
+ goto end;
+ }
+
+ ok = param_cb(params, cbarg);
OSSL_PARAM_free(params);
+end:
OSSL_PARAM_BLD_free(tmpl);
OPENSSL_free(pub_key);
OPENSSL_free(genbuf);
diff --git a/providers/implementations/keymgmt/rsa_kmgmt.c b/providers/implementations/keymgmt/rsa_kmgmt.c
index 1528e43adb..b76835ccc4 100644
--- a/providers/implementations/keymgmt/rsa_kmgmt.c
+++ b/providers/implementations/keymgmt/rsa_kmgmt.c
@@ -229,9 +229,10 @@ static int rsa_export(void *keydata, int selection,
ok = ok && ossl_rsa_todata(rsa, tmpl, NULL, include_private);
}
- if (!ok
- || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL)
+ if (!ok || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) {
+ ok = 0;
goto err;
+ }
ok = param_callback(params, cbarg);
OSSL_PARAM_free(params);