Allow use of algorithm and cipher names for dgsts and enc utilities instead
authorDr. Stephen Henson <steve@openssl.org>
Mon, 30 Mar 2009 11:31:50 +0000 (11:31 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 30 Mar 2009 11:31:50 +0000 (11:31 +0000)
of having to manually include each one.

CHANGES
apps/openssl.c

diff --git a/CHANGES b/CHANGES
index 8e4b6f6ddf405c196e8d1adaf7f939561d2726e0..14ffb4083eecf419feb0a2d4b8bf4b7289ea4c93 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,7 +2,21 @@
  OpenSSL CHANGES
  _______________
 
- Changes between 0.9.8k and 0.9.9  [xx XXX xxxx]
+ Changes between 0.9.8k and 1.0  [xx XXX xxxx]
+
+  *) Support use of registered digest and cipher names for dgst and cipher
+     commands instead of having to add each one as a special case. So now
+     you can do:
+
+        openssl sha256 foo
+
+     as well as:
+
+        openssl dgst -sha256 foo
+
+     and this works for ENGINE based algorithms too.
+
+     [Steve Henson]
 
   *) Update Gost ENGINE to support parameter files.
      [Victor B. Wagner <vitus@cryptocom.ru>]
index 5d61d171cab3be8d4147a382450a7ef6447f240d..c9d9fe9288de970f34eade8b3b47a19dfa61ea73 100644 (file)
@@ -392,6 +392,21 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
                { ret=0; goto end; }
        f.name=argv[0];
        fp=lh_FUNCTION_retrieve(prog,&f);
+       if (fp == NULL)
+               {
+               if (EVP_get_digestbyname(argv[0]))
+                       {
+                       f.type = FUNC_TYPE_MD;
+                       f.func = dgst_main;
+                       fp = &f;
+                       }
+               else if (EVP_get_cipherbyname(argv[0]))
+                       {
+                       f.type = FUNC_TYPE_CIPHER;
+                       f.func = enc_main;
+                       fp = &f;
+                       }
+               }
        if (fp != NULL)
                {
                ret=fp->func(argc,argv);