]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: extend 105-ntpauth test
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 19 Sep 2019 15:38:22 +0000 (17:38 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 24 Sep 2019 14:39:49 +0000 (16:39 +0200)
test/simulation/105-ntpauth

index 46b2660e7db3496df564b23a24a30ccfd3621ff4..950313849b97846b6d1905cf31b36ea02d2dd3bb 100755 (executable)
@@ -23,16 +23,20 @@ EOF
 
 keys=4
 
-if check_config_h 'FEAT_SECHASH 1'; then
-       hashes="MD5 SHA1 SHA256 SHA384 SHA512"
-else
-       hashes="MD5"
-fi
+types="MD5"
+check_config_h 'FEAT_SECHASH 1' && types="$types SHA1 SHA256 SHA384 SHA512"
+check_config_h 'HAVE_CMAC 1' && types="$types AES128 AES256"
 
-for hash in $hashes; do
+for type in $types; do
        keys=$[$keys + 1]
-       key=$(echo $keys $hash HEX:$(tr -c -d '0-9A-F' < /dev/urandom 2> /dev/null | \
-               head -c $[$RANDOM % 64 * 2 + 2]))
+       case $type in
+               AES128) length=16;;
+               AES256) length=32;;
+               *)      length=$[$RANDOM % 32 + 1];;
+       esac
+
+       key=$(echo $keys $type HEX:$(tr -c -d '0-9A-F' < /dev/urandom 2> /dev/null | \
+               head -c $[$length * 2]))
        echo "$key" >> tmp/server.keys
        echo "$key" >> tmp/client.keys
 done