apps/progs.pl: more consistent output for digests
authorRichard Levitte <levitte@openssl.org>
Fri, 18 Mar 2016 19:01:58 +0000 (20:01 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 18 Mar 2016 19:12:27 +0000 (20:12 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
apps/progs.h
apps/progs.pl

index fff2639..a996353 100644 (file)
@@ -227,6 +227,8 @@ static FUNCTION functions[] = {
 #endif
 #ifndef OPENSSL_NO_BLAKE2
     { FT_md, "blake2b512", dgst_main},
+#endif
+#ifndef OPENSSL_NO_BLAKE2
     { FT_md, "blake2s256", dgst_main},
 #endif
 #ifndef OPENSSL_NO_AES
index f24b91b..b601fef 100644 (file)
@@ -84,11 +84,16 @@ foreach (
        "md2", "md4", "md5",
        "md_ghost94",
        "sha1", "sha224", "sha256", "sha384", "sha512",
-       "mdc2", "rmd160", "blake2b", "blake2s"
+       "mdc2", "rmd160", "blake2b512", "blake2s256"
 ) {
-        printf "#ifndef OPENSSL_NO_".uc($_)."\n" if ! /sha/;
-        printf "    { FT_md, \"".$_."\", dgst_main},\n";
-        printf "#endif\n" if ! /sha/;
+        my $str = "    { FT_md, \"".$_."\", dgst_main},\n";
+        if (/blake2/) {
+                print "#ifndef OPENSSL_NO_BLAKE2\n${str}#endif\n";
+        } elsif (/sha/) {
+                print "${str}";
+        } else {
+                print "#ifndef OPENSSL_NO_".uc($_)."\n${str}#endif\n";
+        }
 }
 
 foreach (