diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/ecparam.c | 20 | ||||
-rw-r--r-- | apps/pkeyparam.c | 6 |
2 files changed, 13 insertions, 13 deletions
diff --git a/apps/ecparam.c b/apps/ecparam.c index 71f93c4ca5..35899522d2 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -194,16 +194,6 @@ int ecparam_main(int argc, char **argv) private = genkey ? 1 : 0; - out = bio_open_owner(outfile, outformat, private); - if (out == NULL) - goto end; - - if (list_curves) { - if (list_builtin_curves(out)) - ret = 0; - goto end; - } - if (curve_name != NULL) { OSSL_PARAM params[4]; OSSL_PARAM *p = params; @@ -276,6 +266,16 @@ int ecparam_main(int argc, char **argv) goto end; } + out = bio_open_owner(outfile, outformat, private); + if (out == NULL) + goto end; + + if (list_curves) { + if (list_builtin_curves(out)) + ret = 0; + goto end; + } + if (text && !EVP_PKEY_print_params(out, params_key, 0, NULL)) { BIO_printf(bio_err, "unable to print params\n"); diff --git a/apps/pkeyparam.c b/apps/pkeyparam.c index 4fefe69e6b..fd8de0e02f 100644 --- a/apps/pkeyparam.c +++ b/apps/pkeyparam.c @@ -97,9 +97,6 @@ int pkeyparam_main(int argc, char **argv) in = bio_open_default(infile, 'r', FORMAT_PEM); if (in == NULL) goto end; - out = bio_open_default(outfile, 'w', FORMAT_PEM); - if (out == NULL) - goto end; pkey = PEM_read_bio_Parameters_ex(in, NULL, app_get0_libctx(), app_get0_propq()); if (pkey == NULL) { @@ -107,6 +104,9 @@ int pkeyparam_main(int argc, char **argv) ERR_print_errors(bio_err); goto end; } + out = bio_open_default(outfile, 'w', FORMAT_PEM); + if (out == NULL) + goto end; if (check) { if (e == NULL) |