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)
This commit is contained in:
Tomas Mraz 2021-05-18 17:20:49 +02:00
parent 9ad400f788
commit 57cea5baf6
3 changed files with 3 additions and 15 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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);