summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. David von Oheimb <dev@ddvo.net>2024-09-26 19:25:43 +0200
committerTomas Mraz <tomas@openssl.org>2024-10-04 12:09:33 +0200
commitc8359abb884daa6230cd1c1514ff188c93cfc914 (patch)
treef37a2895f514a2d6973d861a801d511c2b86a6b2 /apps
parentAPPS/pkcs8: fix case where infile and outfile are the same (diff)
downloadopenssl-c8359abb884daa6230cd1c1514ff188c93cfc914.tar.xz
openssl-c8359abb884daa6230cd1c1514ff188c93cfc914.zip
APPS/pkey: fix case where infile and outfile are the same
Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25552)
Diffstat (limited to 'apps')
-rw-r--r--apps/pkey.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/pkey.c b/apps/pkey.c
index 3e4c09b362..ab0c95c2ac 100644
--- a/apps/pkey.c
+++ b/apps/pkey.c
@@ -208,10 +208,6 @@ int pkey_main(int argc, char **argv)
goto end;
}
- out = bio_open_owner(outfile, outformat, private);
- if (out == NULL)
- goto end;
-
if (pubin)
pkey = load_pubkey(infile, informat, 1, passin, e, "Public Key");
else
@@ -219,6 +215,10 @@ int pkey_main(int argc, char **argv)
if (pkey == NULL)
goto end;
+ out = bio_open_owner(outfile, outformat, private);
+ if (out == NULL)
+ goto end;
+
#ifndef OPENSSL_NO_EC
if (asn1_encoding != NULL || point_format != NULL) {
OSSL_PARAM params[3], *p = params;