]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/{dsa,ec,rsa,pkey}.c: harmonize coding w.r.t. 'pubin' variable
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Sat, 24 Sep 2022 11:44:47 +0000 (13:44 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Tue, 14 Mar 2023 16:26:49 +0000 (17:26 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/19076)

apps/dsa.c
apps/ec.c
apps/rsa.c

index 9dda3b2c2f1970cfc7ca187e4888374ff8ce8ef4..d6030c44f647ce73f981afdf38c454d2e0531380 100644 (file)
@@ -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");
index 0962d6a50037326d549acb17e0cfb1ab471dd69b..30d651a89eb62dac1ce36006338f80520f29bcdd 100644 (file)
--- 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");
index 77bab992db3fda9cc27a9bc4043f388d39208b2a..09ab81d5aeb133ff301a1d230e8a040f9f0dd5ec 100644 (file)
@@ -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");