summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-05-18 17:20:49 +0200
committerTomas Mraz <tomas@openssl.org>2021-05-21 10:00:21 +0200
commit57cea5baf616a4a435650d174bfb435578c770c5 (patch)
treebd79cc50edfbd8129fa71f947777df2cca6c94f0
parent9ad400f788fd4f1e36f0814c1952e2c4cbc3b970 (diff)
downloadopenssl-new-57cea5baf616a4a435650d174bfb435578c770c5.tar.gz
apps: Cleanup useless bio_open_default() calls for key input
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15331)
-rw-r--r--apps/ec.c9
-rw-r--r--apps/ecparam.c6
-rw-r--r--apps/pkey.c3
3 files changed, 3 insertions, 15 deletions
diff --git a/apps/ec.c b/apps/ec.c
index e3ce437076..3a7f505474 100644
--- a/apps/ec.c
+++ b/apps/ec.c
@@ -67,7 +67,7 @@ int ec_main(int argc, char **argv)
OSSL_DECODER_CTX *dctx = NULL;
EVP_PKEY_CTX *pctx = NULL;
EVP_PKEY *eckey = NULL;
- BIO *in = NULL, *out = NULL;
+ BIO *out = NULL;
ENGINE *e = NULL;
EVP_CIPHER *enc = NULL;
char *infile = NULL, *outfile = NULL, *ciphername = NULL, *prog;
@@ -174,12 +174,6 @@ int ec_main(int argc, char **argv)
goto end;
}
- if (informat != FORMAT_ENGINE) {
- in = bio_open_default(infile, 'r', informat);
- if (in == NULL)
- goto end;
- }
-
BIO_printf(bio_err, "read EC key\n");
if (pubin)
@@ -285,7 +279,6 @@ int ec_main(int argc, char **argv)
end:
if (ret != 0)
ERR_print_errors(bio_err);
- BIO_free(in);
BIO_free_all(out);
EVP_PKEY_free(eckey);
EVP_CIPHER_free(enc);
diff --git a/apps/ecparam.c b/apps/ecparam.c
index a801ad69bf..c3dbd75365 100644
--- a/apps/ecparam.c
+++ b/apps/ecparam.c
@@ -100,7 +100,7 @@ int ecparam_main(int argc, char **argv)
OSSL_ENCODER_CTX *ectx_key = NULL, *ectx_params = NULL;
OSSL_DECODER_CTX *dctx_params = NULL;
ENGINE *e = NULL;
- BIO *in = NULL, *out = NULL;
+ BIO *out = NULL;
char *curve_name = NULL;
char *asn1_encoding = NULL;
char *point_format = NULL;
@@ -195,9 +195,6 @@ int ecparam_main(int argc, char **argv)
private = genkey ? 1 : 0;
- in = bio_open_default(infile, 'r', informat);
- if (in == NULL)
- goto end;
out = bio_open_owner(outfile, outformat, private);
if (out == NULL)
goto end;
@@ -342,7 +339,6 @@ end:
OSSL_DECODER_CTX_free(dctx_params);
OSSL_ENCODER_CTX_free(ectx_params);
OSSL_ENCODER_CTX_free(ectx_key);
- BIO_free(in);
BIO_free_all(out);
return ret;
}
diff --git a/apps/pkey.c b/apps/pkey.c
index ddc3414d0c..781f376837 100644
--- a/apps/pkey.c
+++ b/apps/pkey.c
@@ -67,7 +67,7 @@ const OPTIONS pkey_options[] = {
int pkey_main(int argc, char **argv)
{
- BIO *in = NULL, *out = NULL;
+ BIO *out = NULL;
ENGINE *e = NULL;
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL;
@@ -321,7 +321,6 @@ int pkey_main(int argc, char **argv)
EVP_CIPHER_free(cipher);
release_engine(e);
BIO_free_all(out);
- BIO_free(in);
OPENSSL_free(passin);
OPENSSL_free(passout);