[openssl] master update

Richard Levitte levitte at openssl.org
Fri Mar 29 10:24:29 UTC 2019


The branch master has been updated
       via  7ed4b97b61101952da95a252feef4461c694b851 (commit)
      from  678d2681b22c3968d1ff55ec09b9fece39641d57 (commit)


- Log -----------------------------------------------------------------
commit 7ed4b97b61101952da95a252feef4461c694b851
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Mar 29 07:11:57 2019 +0100

    openssl dgst: show MD name at all times
    
    When 'openssl dgst' is called with a MD alias (such as sha256) and no
    further arguments (i.e. input is taken from stdin), the MD name wasn't
    shown.
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/8609)

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

Summary of changes:
 apps/dgst.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/apps/dgst.c b/apps/dgst.c
index 34494a4..e38496e 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -86,6 +86,7 @@ int dgst_main(int argc, char **argv)
     const EVP_MD *md = NULL, *m;
     const char *outfile = NULL, *keyfile = NULL, *prog = NULL;
     const char *sigfile = NULL;
+    const char *md_name = NULL;
     OPTION_CHOICE o;
     int separator = 0, debug = 0, keyform = FORMAT_PEM, siglen = 0;
     int i, ret = 1, out_bin = -1, want_pub = 0, do_verify = 0;
@@ -365,13 +366,15 @@ int dgst_main(int argc, char **argv)
         BIO_get_md_ctx(bmd, &tctx);
         md = EVP_MD_CTX_md(tctx);
     }
+    if (md != NULL)
+        md_name = EVP_MD_name(md);
 
     if (argc == 0) {
         BIO_set_fp(in, stdin, BIO_NOCLOSE);
         ret = do_fp(out, buf, inp, separator, out_bin, sigkey, sigbuf,
-                    siglen, NULL, NULL, "stdin");
+                    siglen, NULL, md_name, "stdin");
     } else {
-        const char *md_name = NULL, *sig_name = NULL;
+        const char *sig_name = NULL;
         if (!out_bin) {
             if (sigkey != NULL) {
                 const EVP_PKEY_ASN1_METHOD *ameth;
@@ -380,8 +383,6 @@ int dgst_main(int argc, char **argv)
                     EVP_PKEY_asn1_get0_info(NULL, NULL,
                                             NULL, NULL, &sig_name, ameth);
             }
-            if (md != NULL)
-                md_name = EVP_MD_name(md);
         }
         ret = 0;
         for (i = 0; i < argc; i++) {


More information about the openssl-commits mailing list