tests: Handle disabled algorithms.
authorWerner Koch <wk@gnupg.org>
Mon, 10 Feb 2014 09:41:48 +0000 (10:41 +0100)
committerWerner Koch <wk@gnupg.org>
Mon, 10 Feb 2014 09:41:48 +0000 (10:41 +0100)
* tests/openpgp/mds.test: Skip disabled algorithms.
* tests/openpgp/signencrypt-dsa.test: Ditto.
* tests/openpgp/sigs-dsa.test: Ditto.

tests/openpgp/mds.test
tests/openpgp/signencrypt-dsa.test
tests/openpgp/sigs-dsa.test

index a4583a1..944f535 100755 (executable)
@@ -23,11 +23,19 @@ failed=""
 #info Checking message digests
 cat /dev/null | $GPG --with-colons --print-mds >y
 # MD5
-test_one ":1:"    "D41D8CD98F00B204E9800998ECF8427E"
+if have_hash_algo "MD5"; then
+  test_one ":1:"    "D41D8CD98F00B204E9800998ECF8427E"
+else
+  echo "Hash algorithm MD5 is not installed (not an error)"
+fi
 # SHA-1
 test_one ":2:"    "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"
 # RMD160
-test_one ":3:"    "9C1185A5C5E9FC54612808977EE8F548B2258D31"
+if have_hash_algo "RIPEMD160"; then
+  test_one ":3:"    "9C1185A5C5E9FC54612808977EE8F548B2258D31"
+else
+  echo "Hash algorithm RIPEMD160 is not installed (not an error)"
+fi
 # SHA-224
 if have_hash_algo "SHA224"; then
   test_one ":11:"    "D14A028C2A3A2BC9476102BB288234C415A2B01F828EA62AC5B3E42F"
@@ -56,9 +64,13 @@ fi
 [ "$failed" != "" ] && error "$failed failed for empty string"
 
 echo_n "abcdefghijklmnopqrstuvwxyz" | $GPG --with-colons --print-mds >y
-test_one ":1:"    "C3FCD3D76192E4007DFB496CCA67E13B"
+if have_hash_algo "MD5"; then
+  test_one ":1:"    "C3FCD3D76192E4007DFB496CCA67E13B"
+fi
 test_one ":2:"    "32D10C7B8CF96570CA04CE37F2A19D84240D3A89"
-test_one ":3:"    "F71C27109C692C1B56BBDCEB5B9D2865B3708DBC"
+if have_hash_algo "RIPEMD160"; then
+  test_one ":3:"    "F71C27109C692C1B56BBDCEB5B9D2865B3708DBC"
+fi
 if have_hash_algo "SHA224"; then
   test_one ":11:"    "45A5F72C39C5CFF2522EB3429799E49E5F44B356EF926BCF390DCCC2"
 fi
index 9473099..dd724c9 100755 (executable)
@@ -18,7 +18,14 @@ for i in $plain_files $data_files ; do
     cmp $i y || error "$i: mismatch"
 done
 
-for da in ripemd160 sha1; do
+algos="sha1"
+if have_hash_algo "RIPEMD160"; then
+  algos="ripemd160 $algos"
+else
+  echo "Hash algorithm RIPEMD160 is not installed (not an error)"
+fi
+
+for da in $algos; do
     for i in $plain_files; do
        $GPG --always-trust -se -o x --yes --digest-algo $da \
                    -u "$dsa_usrname1" -r "$dsa_usrname2" $i
index e4f812a..4ba43ac 100755 (executable)
@@ -17,7 +17,14 @@ for i in $plain_files $data_files; do
     cmp $i y || error "$i: mismatch"
 done
 
-for da in ripemd160 sha1; do
+algos="sha1"
+if have_hash_algo "RIPEMD160"; then
+  algos="ripemd160 $algos"
+else
+  echo "Hash algorithm RIPEMD160 is not installed (not an error)"
+fi
+
+for da in $algos; do
     for i in $plain_files; do
        $GPG --digest-algo $da -s -o x --yes -u $dsa_usrname1 $i
        $GPG -o y --yes x