[openssl] master update

Richard Levitte levitte at openssl.org
Tue May 4 09:41:09 UTC 2021


The branch master has been updated
       via  5432d827ec2cffa2e75bf8dd0bc570288cba19f6 (commit)
       via  49ce00374030c74f527c9916bff7c2c7268f4318 (commit)
      from  f97bc7c4240ba370c323c0d753d9d97f7a7c89bf (commit)


- Log -----------------------------------------------------------------
commit 5432d827ec2cffa2e75bf8dd0bc570288cba19f6
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon May 3 08:48:17 2021 +0200

    APPS: Add passphrase handling in the "rsa" and "dsa" commands
    
    They completely ignored any passphrase related setting.
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15119)

commit 49ce00374030c74f527c9916bff7c2c7268f4318
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon May 3 08:48:07 2021 +0200

    APPS: Set a default passphrase UI for the "ec" command
    
    Fixes #15114
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15119)

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

Summary of changes:
 apps/dsa.c | 14 ++++++++++++++
 apps/ec.c  |  3 +++
 apps/rsa.c | 14 ++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/apps/dsa.c b/apps/dsa.c
index 9ea1098514..9a7bf04adb 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -267,6 +267,20 @@ int dsa_main(int argc, char **argv)
         goto end;
     }
 
+    /* Passphrase setup */
+    if (enc != NULL)
+        OSSL_ENCODER_CTX_set_cipher(ectx, EVP_CIPHER_name(enc), NULL);
+
+    /* Default passphrase prompter */
+    if (enc != NULL || outformat == FORMAT_PVK) {
+        OSSL_ENCODER_CTX_set_passphrase_ui(ectx, get_ui_method(), NULL);
+        if (passout != NULL)
+            /* When passout given, override the passphrase prompter */
+            OSSL_ENCODER_CTX_set_passphrase(ectx,
+                                            (const unsigned char *)passout,
+                                            strlen(passout));
+    }
+
     /* PVK requires a bit more */
     if (outformat == FORMAT_PVK) {
         OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
diff --git a/apps/ec.c b/apps/ec.c
index 5103838da0..f8f77dd492 100644
--- a/apps/ec.c
+++ b/apps/ec.c
@@ -267,7 +267,10 @@ int ec_main(int argc, char **argv)
                                              NULL);
         if (enc != NULL) {
             OSSL_ENCODER_CTX_set_cipher(ectx, EVP_CIPHER_name(enc), NULL);
+            /* Default passphrase prompter */
+            OSSL_ENCODER_CTX_set_passphrase_ui(ectx, get_ui_method(), NULL);
             if (passout != NULL)
+                /* When passout given, override the passphrase prompter */
                 OSSL_ENCODER_CTX_set_passphrase(ectx,
                                                 (const unsigned char *)passout,
                                                 strlen(passout));
diff --git a/apps/rsa.c b/apps/rsa.c
index fc1db506d7..47316757d5 100644
--- a/apps/rsa.c
+++ b/apps/rsa.c
@@ -335,6 +335,20 @@ int rsa_main(int argc, char **argv)
         goto end;
     }
 
+    /* Passphrase setup */
+    if (enc != NULL)
+        OSSL_ENCODER_CTX_set_cipher(ectx, EVP_CIPHER_name(enc), NULL);
+
+    /* Default passphrase prompter */
+    if (enc != NULL || outformat == FORMAT_PVK) {
+        OSSL_ENCODER_CTX_set_passphrase_ui(ectx, get_ui_method(), NULL);
+        if (passout != NULL)
+            /* When passout given, override the passphrase prompter */
+            OSSL_ENCODER_CTX_set_passphrase(ectx,
+                                            (const unsigned char *)passout,
+                                            strlen(passout));
+    }
+
     /* PVK is a bit special... */
     if (outformat == FORMAT_PVK) {
         OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };


More information about the openssl-commits mailing list