[openssl] master update

tomas at openssl.org tomas at openssl.org
Tue May 18 07:20:36 UTC 2021


The branch master has been updated
       via  7d72dc78ee54cc3b9163ef9b23cf22bb85015552 (commit)
      from  a94d62ab23e95630c156d00342ee9c3cf2e59515 (commit)


- Log -----------------------------------------------------------------
commit 7d72dc78ee54cc3b9163ef9b23cf22bb85015552
Author: Rich Salz <rsalz at akamai.com>
Date:   Wed May 12 11:45:37 2021 -0400

    Add -quiet flag to genpkey
    
    Picking up late suggestions to PR #6909 by Philip Prindeville
    <philipp at redfish-solutions.com>.
    
    Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15249)

-----------------------------------------------------------------------

Summary of changes:
 apps/genpkey.c                  | 28 ++++++++++++++++++++--------
 doc/man1/openssl-genpkey.pod.in |  5 +++++
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/apps/genpkey.c b/apps/genpkey.c
index f10390e1ba..c187cc2a70 100644
--- a/apps/genpkey.c
+++ b/apps/genpkey.c
@@ -15,6 +15,8 @@
 #include <openssl/err.h>
 #include <openssl/evp.h>
 
+static int quiet;
+
 static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e,
                             OSSL_LIB_CTX *libctx, const char *propq);
 static int genpkey_cb(EVP_PKEY_CTX *ctx);
@@ -23,7 +25,7 @@ typedef enum OPTION_choice {
     OPT_COMMON,
     OPT_ENGINE, OPT_OUTFORM, OPT_OUT, OPT_PASS, OPT_PARAMFILE,
     OPT_ALGORITHM, OPT_PKEYOPT, OPT_GENPARAM, OPT_TEXT, OPT_CIPHER,
-    OPT_CONFIG,
+    OPT_QUIET, OPT_CONFIG,
     OPT_PROV_ENUM
 } OPTION_CHOICE;
 
@@ -35,6 +37,7 @@ const OPTIONS genpkey_options[] = {
 #endif
     {"paramfile", OPT_PARAMFILE, '<', "Parameters file"},
     {"algorithm", OPT_ALGORITHM, 's', "The public key algorithm"},
+    {"quiet", OPT_QUIET, 's', "Do not output status while generating keys"},
     {"pkeyopt", OPT_PKEYOPT, 's',
      "Set the public key algorithm option as opt:value"},
      OPT_CONFIG_OPTION,
@@ -111,6 +114,9 @@ int genpkey_main(int argc, char **argv)
             if (!sk_OPENSSL_STRING_push(keyopt, opt_arg()))
                 goto end;
             break;
+        case OPT_QUIET:
+            quiet = 1;
+            break;
         case OPT_GENPARAM:
             do_param = 1;
             break;
@@ -332,16 +338,22 @@ static int genpkey_cb(EVP_PKEY_CTX *ctx)
 {
     char c = '*';
     BIO *b = EVP_PKEY_CTX_get_app_data(ctx);
-    int p;
-    p = EVP_PKEY_CTX_get_keygen_info(ctx, 0);
-    if (p == 0)
+
+    if (quiet)
+        return 1;
+
+    switch (EVP_PKEY_CTX_get_keygen_info(ctx, 0)) {
+    case 0:
         c = '.';
-    if (p == 1)
+        break;
+    case 1:
         c = '+';
-    if (p == 2)
-        c = '*';
-    if (p == 3)
+        break;
+    case 3:
         c = '\n';
+        break;
+    }
+
     BIO_write(b, &c, 1);
     (void)BIO_flush(b);
     return 1;
diff --git a/doc/man1/openssl-genpkey.pod.in b/doc/man1/openssl-genpkey.pod.in
index aa08b01f4f..9cfd9ae441 100644
--- a/doc/man1/openssl-genpkey.pod.in
+++ b/doc/man1/openssl-genpkey.pod.in
@@ -15,6 +15,7 @@ B<openssl> B<genpkey>
 [B<-help>]
 [B<-out> I<filename>]
 [B<-outform> B<DER>|B<PEM>]
+[B<-quiet>]
 [B<-pass> I<arg>]
 [B<-I<cipher>>]
 [B<-paramfile> I<file>]
@@ -51,6 +52,10 @@ See L<openssl-format-options(1)> for details.
 
 When B<-genparam> is given, B<-outform> is ignored.
 
+=item B<-quiet>
+
+Do not output "status dots" while generating keys.
+
 =item B<-pass> I<arg>
 
 The output file password source. For more information about the format of I<arg>


More information about the openssl-commits mailing list