From 7ae8d2a2abc896f48f161007df99437d419346c3 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Thu, 26 Sep 2024 19:25:43 +0200 Subject: [PATCH] APPS/pkey: fix case where infile and outfile are the same --- apps/pkey.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/pkey.c b/apps/pkey.c index 3e4c09b362552e..ab0c95c2acd680 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;