]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Randomize algorithm selection for mkeys test
authorTom Krizek <tkrizek@isc.org>
Wed, 26 Oct 2022 14:20:57 +0000 (16:20 +0200)
committerTom Krizek <tkrizek@isc.org>
Tue, 1 Nov 2022 18:51:52 +0000 (19:51 +0100)
Use the ALGORITHM_SET option to use randomly selected default algorithm
in this test. Make sure the test works by using variables instead of
hard-coding values.

(cherry picked from commit f65f276f986fe1e0498698f7058722a0b7a9aec1)

bin/tests/system/mkeys/setup.sh
bin/tests/system/mkeys/tests.sh

index bc4520eecdc2db725717452e469a1348c7d702fd..6b361de8c7e2cc446d3ef73019cb917251797b8d 100644 (file)
 # information regarding copyright ownership.
 
 SYSTEMTESTTOP=..
+
+export ALGORITHM_SET="ecc_default"
 . $SYSTEMTESTTOP/conf.sh
 
+# Ensure the selected algorithm set is okay.
+if [ "$ALGORITHM_SET" = "error" ]; then
+    echofail "Algorithm selection failed." >&2
+    exit 1
+fi
+
 copy_setports ns1/named1.conf.in ns1/named.conf
 copy_setports ns2/named.conf.in ns2/named.conf
 copy_setports ns3/named.conf.in ns3/named.conf
index 8e873f39b22e3362b99b6c7c5b22e81a541e247c..ae714741e92167edfa7722e57133d4dbfd8e8cf3 100644 (file)
@@ -14,6 +14,7 @@
 set -e
 
 SYSTEMTESTTOP=..
+export ALGORITHM_SET="ecc_default"
 #shellcheck source=conf.sh
 . "$SYSTEMTESTTOP/conf.sh"
 
@@ -691,7 +692,7 @@ ret=0
 # compare against the known key.
 tathex=$(grep "query '_ta-[0-9a-f][0-9a-f]*/NULL/IN' approved" ns1/named.run | awk '{print $6; exit 0}' | sed -e 's/(_ta-\([0-9a-f][0-9a-f]*\)):/\1/') || true
 tatkey=$($PERL -e 'printf("%d\n", hex(@ARGV[0]));' "$tathex")
-realkey=$(rndccmd 10.53.0.2 secroots - | sed -n 's#.*SHA256/\([0-9][0-9]*\) ; .*managed.*#\1#p')
+realkey=$(rndccmd 10.53.0.2 secroots - | sed -n "s#.*${DEFAULT_ALGORITHM}/\([0-9][0-9]*\) ; .*managed.*#\1#p")
 [ "$tatkey" -eq "$realkey" ] || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))