From: Dr. David von Oheimb Date: Sat, 24 Sep 2022 11:44:47 +0000 (+0200) Subject: apps/{dsa,ec,rsa,pkey}.c: harmonize coding w.r.t. 'pubin' variable X-Git-Tag: openssl-3.2.0-alpha1~1184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=091fef4936da93deee585dadd994144b330485d4;p=thirdparty%2Fopenssl.git apps/{dsa,ec,rsa,pkey}.c: harmonize coding w.r.t. 'pubin' variable Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy Reviewed-by: David von Oheimb (Merged from https://github.com/openssl/openssl/pull/19076) --- diff --git a/apps/dsa.c b/apps/dsa.c index 9dda3b2c2f1..d6030c44f64 100644 --- a/apps/dsa.c +++ b/apps/dsa.c @@ -167,9 +167,7 @@ int dsa_main(int argc, char **argv) if (!opt_cipher(ciphername, &enc)) goto end; - private = pubin || pubout ? 0 : 1; - if (text && !pubin) - private = 1; + private = !pubin && (!pubout || text); if (!app_passwd(passinarg, passoutarg, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); diff --git a/apps/ec.c b/apps/ec.c index 0962d6a5003..30d651a89eb 100644 --- a/apps/ec.c +++ b/apps/ec.c @@ -163,9 +163,7 @@ int ec_main(int argc, char **argv) if (!opt_cipher(ciphername, &enc)) goto opthelp; - private = param_out || pubin || pubout ? 0 : 1; - if (text && !pubin) - private = 1; + private = !pubin && (text || (!param_out && !pubout)); if (!app_passwd(passinarg, passoutarg, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); diff --git a/apps/rsa.c b/apps/rsa.c index 77bab992db3..09ab81d5aeb 100644 --- a/apps/rsa.c +++ b/apps/rsa.c @@ -223,7 +223,7 @@ int rsa_main(int argc, char **argv) if (!opt_cipher(ciphername, &enc)) goto opthelp; - private = (text && !pubin) || (!pubout && !noout) ? 1 : 0; + private = (text && !pubin) || (!pubout && !noout); if (!app_passwd(passinarg, passoutarg, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n");