diff --git a/checks/ChangeLog b/checks/ChangeLog index ea4f3220c..906fe2773 100644 --- a/checks/ChangeLog +++ b/checks/ChangeLog @@ -1,3 +1,13 @@ +2007-05-14 David Shaw + + * defs.inc (all_cipher_algos): New function to return all ciphers + we support. This is safer than the previous setup which could + hide that some ciphers weren't being tested. Plus, this + automatically tests any new ciphers we may add. + + * conventional.test, encrypt-test, encrypt-dsa.test, + conventional-mdc.test: Use it here. + 2007-05-02 David Shaw * conventional.test, encrypt.test, encrypt-dsa.test, diff --git a/checks/conventional-mdc.test b/checks/conventional-mdc.test index b3cf10b3a..3da5d26df 100755 --- a/checks/conventional-mdc.test +++ b/checks/conventional-mdc.test @@ -2,31 +2,10 @@ . $srcdir/defs.inc || exit 3 -algos="3des" - -if have_cipher_algo "IDEA"; then - algos="$algos idea" -fi - -if have_cipher_algo "CAST5"; then - algos="$algos cast5" -fi - -if have_cipher_algo "BLOWFISH"; then - algos="$algos blowfish" -fi - -if have_cipher_algo "AES"; then - algos="$algos aes aes192 aes256" -fi - -if have_cipher_algo "TWOFISH"; then - algos="$algos twofish" -fi - #info Checking conventional encryption -for i in 0 1 2 3 9 10 11 19 20 21 22 23 39 40 41 8192 32000 ; do - for ciph in $algos; do +for ciph in `all_cipher_algos`; do + echo_n "$ciph " + for i in 0 1 2 3 9 10 11 19 20 21 22 23 39 40 41 8192 32000 ; do # *BSD's dd can't cope with a count of 0 if test "$i" = "0"; then : >z @@ -40,3 +19,4 @@ for i in 0 1 2 3 9 10 11 19 20 21 22 23 39 40 41 8192 32000 ; do cmp z y || error "$ciph/$i: mismatch" done done +echo_n "| " diff --git a/checks/conventional.test b/checks/conventional.test index 8b75c8a50..25a1a662f 100755 --- a/checks/conventional.test +++ b/checks/conventional.test @@ -9,29 +9,8 @@ for i in plain-2 data-32000 ; do cmp $i y || error "$i: mismatch" done -algos="3des" - -if have_cipher_algo "IDEA"; then - algos="$algos idea" -fi - -if have_cipher_algo "CAST5"; then - algos="$algos cast5" -fi - -if have_cipher_algo "BLOWFISH"; then - algos="$algos blowfish" -fi - -if have_cipher_algo "AES"; then - algos="$algos aes aes192 aes256" -fi - -if have_cipher_algo "TWOFISH"; then - algos="$algos twofish" -fi - -for a in $algos; do +for a in `all_cipher_algos`; do + echo_n "$a " for i in plain-1 data-80000 ; do echo "Hier spricht HAL" | $GPG --passphrase-fd 0 \ --cipher-algo $a -c -o x --yes $i @@ -39,3 +18,4 @@ for a in $algos; do cmp $i y || error "$i: ($a) mismatch" done done +echo_n "| " diff --git a/checks/defs.inc b/checks/defs.inc index 98a6c3f76..bf4de8227 100755 --- a/checks/defs.inc +++ b/checks/defs.inc @@ -121,15 +121,6 @@ have_pubkey_algo () { fi } -have_cipher_algo () { - if ../g10/gpg --homedir . --version | grep "Cipher:.*$1" >/dev/null - then - true - else - false - fi -} - have_hash_algo () { if ../g10/gpg --homedir . --version | grep "Hash:.*$1" >/dev/null then @@ -139,6 +130,10 @@ have_hash_algo () { fi } +all_cipher_algos () { + ../g10/gpg --homedir . --version | grep "Cipher" | sed 's/^Cipher: //; s/,//g' +} + set -e pgmname=`basename $0` #trap cleanup SIGHUP SIGINT SIGQUIT diff --git a/checks/encrypt-dsa.test b/checks/encrypt-dsa.test index 4b9da35ff..da5e99d6a 100755 --- a/checks/encrypt-dsa.test +++ b/checks/encrypt-dsa.test @@ -9,29 +9,8 @@ for i in $plain_files $data_files ; do cmp $i y || error "$i: mismatch" done -algos="3des" - -if have_cipher_algo "IDEA"; then - algos="$algos idea" -fi - -if have_cipher_algo "CAST5"; then - algos="$algos cast5" -fi - -if have_cipher_algo "BLOWFISH"; then - algos="$algos blowfish" -fi - -if have_cipher_algo "AES"; then - algos="$algos aes aes192 aes256" -fi - -if have_cipher_algo "TWOFISH"; then - algos="$algos twofish" -fi - -for ca in $algos ; do +for ca in `all_cipher_algos` ; do + echo_n "$ca " for i in $plain_files $data_files ; do $GPG $dsa_keyrings --always-trust --cipher-algo $ca -e \ -o x --yes -r "$dsa_usrname2" $i @@ -39,3 +18,4 @@ for ca in $algos ; do cmp $i y || error "$i: mismatch" done done +echo_n "| " diff --git a/checks/encrypt.test b/checks/encrypt.test index 35f35d0e5..a6ee1c691 100755 --- a/checks/encrypt.test +++ b/checks/encrypt.test @@ -9,32 +9,12 @@ for i in $plain_files $data_files ; do cmp $i y || error "$i: mismatch" done -algos="3des" - -if have_cipher_algo "IDEA"; then - algos="$algos idea" -fi - -if have_cipher_algo "CAST5"; then - algos="$algos cast5" -fi - -if have_cipher_algo "BLOWFISH"; then - algos="$algos blowfish" -fi - -if have_cipher_algo "AES"; then - algos="$algos aes aes192 aes256" -fi - -if have_cipher_algo "TWOFISH"; then - algos="$algos twofish" -fi - -for ca in $algos ; do +for ca in `all_cipher_algos` ; do + echo_n "$ca " for i in $plain_files $data_files ; do $GPG --always-trust -e -o x --yes -r "$usrname2" --cipher-algo $ca $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done done +echo_n "| "