9b329d
From 3446425cf03f2b5a7cbf6af47bd167f72e4135aa Mon Sep 17 00:00:00 2001
899014
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
899014
Date: Thu, 2 Aug 2018 23:46:45 +0200
ad7b3b
Subject: [PATCH] FIPS tests changes
899014
MIME-Version: 1.0
899014
Content-Type: text/plain; charset=UTF-8
899014
Content-Transfer-Encoding: 8bit
899014
ad7b3b
Squashed commit of the following:
ad7b3b
899014
commit 09e5eb48698d4fef2fc1031870de86c553b6bfaa
899014
Author: Petr Menšík <pemensik@redhat.com>
899014
Date:   Wed Mar 7 20:35:13 2018 +0100
899014
899014
    Fix nsupdate test. Do not use md5 by default for rndc, skip gracefully md5 if not available.
899014
899014
commit ab303db70082db76ecf36493d0b82ef3e8750cad
899014
Author: Petr Menšík <pemensik@redhat.com>
899014
Date:   Wed Mar 7 18:11:10 2018 +0100
899014
899014
    Changed root key to be RSASHA256
899014
899014
    Change bad trusted key to be the same algorithm.
899014
899014
commit 88ab07c0e14cc71247e1f9d11a1ea832b64c1ee8
899014
Author: Petr Menšík <pemensik@redhat.com>
899014
Date:   Wed Mar 7 16:56:17 2018 +0100
899014
899014
    Change used key to not use hmac-md5
899014
899014
    Fix upforwd test, do not use hmac-md5
899014
899014
commit aec891571626f053acfb4d0a247240cbc21a84e9
899014
Author: Petr Menšík <pemensik@redhat.com>
899014
Date:   Wed Mar 7 15:54:11 2018 +0100
899014
899014
    Increase bitsize of DSA key to pass FIPS 140-2 mode.
899014
899014
commit bca8e164fa0d9aff2f946b8b4eb0f1f7e0bf6696
899014
Author: Petr Menšík <pemensik@redhat.com>
899014
Date:   Wed Mar 7 15:41:08 2018 +0100
899014
899014
    Fix tsig and rndc tests for disabled md5
899014
899014
    Use hmac-sha256 instead of hmac-md5.
899014
899014
commit 0d314c1ab6151aa13574a21ad22f28d3b7f42a67
899014
Author: Petr Menšík <pemensik@redhat.com>
899014
Date:   Wed Mar 7 13:21:00 2018 +0100
899014
899014
    Add md5 availability detection to featuretest
899014
899014
commit f389a918803e2853e4b55fed62765dc4a492e34f
899014
Author: Petr Menšík <pemensik@redhat.com>
899014
Date:   Wed Mar 7 10:44:23 2018 +0100
899014
899014
    Change tests to not use hmac-md5 algorithms if not required
899014
899014
    Use hmac-sha256 instead of default hmac-md5 for allow-query
21fe71
21fe71
Use DEFAULT_HMAC configured variable
899014
---
1e4169
 bin/tests/system/acl/ns2/named1.conf.in       |  4 +-
1e4169
 bin/tests/system/acl/ns2/named2.conf.in       |  4 +-
1e4169
 bin/tests/system/acl/ns2/named3.conf.in       |  6 +-
1e4169
 bin/tests/system/acl/ns2/named4.conf.in       |  4 +-
1e4169
 bin/tests/system/acl/ns2/named5.conf.in       |  4 +-
1e4169
 bin/tests/system/acl/tests.sh                 | 32 ++++-----
1e4169
 .../system/allow-query/ns2/named10.conf.in    |  2 +-
1e4169
 .../system/allow-query/ns2/named11.conf.in    |  4 +-
1e4169
 .../system/allow-query/ns2/named12.conf.in    |  2 +-
1e4169
 .../system/allow-query/ns2/named30.conf.in    |  2 +-
1e4169
 .../system/allow-query/ns2/named31.conf.in    |  4 +-
1e4169
 .../system/allow-query/ns2/named32.conf.in    |  2 +-
1e4169
 .../system/allow-query/ns2/named40.conf.in    |  4 +-
1e4169
 bin/tests/system/allow-query/tests.sh         | 18 ++---
1e4169
 bin/tests/system/checkconf/bad-tsig.conf      |  2 +-
1e4169
 bin/tests/system/checkconf/good.conf          |  2 +-
21fe71
 bin/tests/system/cookie/ns1/named.conf.in     |  2 +-
21fe71
 bin/tests/system/dnssec/ns4/named5.conf.in    |  2 +-
aaee84
 bin/tests/system/feature-test.c               | 14 ++++
1e4169
 bin/tests/system/notify/ns5/named.conf.in     |  6 +-
1e4169
 bin/tests/system/notify/tests.sh              |  6 +-
1e4169
 bin/tests/system/nsupdate/ns1/named.conf.in   |  2 +-
1e4169
 bin/tests/system/nsupdate/ns2/named.conf.in   |  2 +-
21fe71
 bin/tests/system/nsupdate/ns9/named.conf.in   |  2 +-
0b18b1
 bin/tests/system/nsupdate/setup.sh            |  6 +-
bbdbcb
 bin/tests/system/nsupdate/tests.sh            |  9 ++-
21fe71
 bin/tests/system/rndc/ns2/named.conf.in       |  2 +-
21fe71
 bin/tests/system/rndc/ns3/named.conf.in       |  2 +-
1e4169
 bin/tests/system/rndc/setup.sh                |  2 +-
8a47aa
 bin/tests/system/rndc/tests.sh                | 22 +++---
1e4169
 bin/tests/system/tsig/ns1/named.conf.in       | 10 +--
21fe71
 bin/tests/system/tsig/ns1/rndc5.conf.in       | 10 +++
1e4169
 bin/tests/system/tsig/setup.sh                |  5 ++
8a47aa
 bin/tests/system/tsig/tests.sh                | 67 ++++++++++++-------
1e4169
 bin/tests/system/upforwd/ns1/named.conf.in    |  2 +-
1e4169
 bin/tests/system/upforwd/tests.sh             |  2 +-
9b329d
 36 files changed, 161 insertions(+), 110 deletions(-)
21fe71
 create mode 100644 bin/tests/system/tsig/ns1/rndc5.conf.in
899014
899014
diff --git a/bin/tests/system/acl/ns2/named1.conf.in b/bin/tests/system/acl/ns2/named1.conf.in
21fe71
index 8787c6a..682ba97 100644
899014
--- a/bin/tests/system/acl/ns2/named1.conf.in
899014
+++ b/bin/tests/system/acl/ns2/named1.conf.in
8a47aa
@@ -35,12 +35,12 @@ options {
899014
 };
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
 key two {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/acl/ns2/named2.conf.in b/bin/tests/system/acl/ns2/named2.conf.in
21fe71
index a95b4c1..7b1cea6 100644
899014
--- a/bin/tests/system/acl/ns2/named2.conf.in
899014
+++ b/bin/tests/system/acl/ns2/named2.conf.in
8a47aa
@@ -35,12 +35,12 @@ options {
899014
 };
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
 key two {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/acl/ns2/named3.conf.in b/bin/tests/system/acl/ns2/named3.conf.in
21fe71
index 14cc3fe..6b35ba5 100644
899014
--- a/bin/tests/system/acl/ns2/named3.conf.in
899014
+++ b/bin/tests/system/acl/ns2/named3.conf.in
8a47aa
@@ -35,17 +35,17 @@ options {
899014
 };
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
 key two {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
 key three {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/acl/ns2/named4.conf.in b/bin/tests/system/acl/ns2/named4.conf.in
21fe71
index 77cf110..b23a1ca 100644
899014
--- a/bin/tests/system/acl/ns2/named4.conf.in
899014
+++ b/bin/tests/system/acl/ns2/named4.conf.in
8a47aa
@@ -35,12 +35,12 @@ options {
899014
 };
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
 key two {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/acl/ns2/named5.conf.in b/bin/tests/system/acl/ns2/named5.conf.in
21fe71
index 5ccabf9..52791aa 100644
899014
--- a/bin/tests/system/acl/ns2/named5.conf.in
899014
+++ b/bin/tests/system/acl/ns2/named5.conf.in
8a47aa
@@ -37,12 +37,12 @@ options {
899014
 };
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
 key two {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/acl/tests.sh b/bin/tests/system/acl/tests.sh
99f74e
index ad98fa1..7a7ff4a 100644
899014
--- a/bin/tests/system/acl/tests.sh
899014
+++ b/bin/tests/system/acl/tests.sh
8a47aa
@@ -23,14 +23,14 @@ echo_i "testing basic ACL processing"
899014
 # key "one" should fail
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
899014
 
899014
 
899014
 # any other key should be fine
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
899014
 
899014
 copy_setports ns2/named2.conf.in ns2/named.conf
8a47aa
@@ -40,18 +40,18 @@ sleep 5
899014
 # prefix 10/8 should fail
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # any other address should work, as long as it sends key "one"
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 127.0.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
899014
 
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
899014
 
899014
 echo_i "testing nested ACL processing"
8a47aa
@@ -63,31 +63,31 @@ sleep 5
899014
 # should succeed
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # should succeed
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # should succeed
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # should succeed
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # but only one or the other should fail
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
899014
 
899014
 t=`expr $t + 1`
8a47aa
@@ -98,7 +98,7 @@ grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $tt failed" ; status=1
899014
 # and other values? right out
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 127.0.0.1 axfr -y three:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:three:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # now we only allow 10.53.0.1 *and* key one, or 10.53.0.2 *and* key two
8a47aa
@@ -109,31 +109,31 @@ sleep 5
899014
 # should succeed
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # should succeed
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # should fail
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # should fail
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
899014
 
899014
 # should fail
899014
 t=`expr $t + 1`
899014
 $DIG $DIGOPTS tsigzone. \
899014
-	@10.53.0.2 -b 10.53.0.3 axfr -y one:1234abcd8765 > dig.out.${t}
899014
+	@10.53.0.2 -b 10.53.0.3 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
899014
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
899014
 
899014
 echo_i "testing allow-query-on ACL processing"
899014
diff --git a/bin/tests/system/allow-query/ns2/named10.conf.in b/bin/tests/system/allow-query/ns2/named10.conf.in
21fe71
index b91d19a..ae485e8 100644
899014
--- a/bin/tests/system/allow-query/ns2/named10.conf.in
899014
+++ b/bin/tests/system/allow-query/ns2/named10.conf.in
8a47aa
@@ -12,7 +12,7 @@
0b18b1
  */
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/allow-query/ns2/named11.conf.in b/bin/tests/system/allow-query/ns2/named11.conf.in
21fe71
index 308c4ca..8a5e806 100644
899014
--- a/bin/tests/system/allow-query/ns2/named11.conf.in
899014
+++ b/bin/tests/system/allow-query/ns2/named11.conf.in
8a47aa
@@ -12,12 +12,12 @@
0b18b1
  */
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
 key two {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234efgh8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/allow-query/ns2/named12.conf.in b/bin/tests/system/allow-query/ns2/named12.conf.in
21fe71
index 6b0fe55..a10c6d0 100644
899014
--- a/bin/tests/system/allow-query/ns2/named12.conf.in
899014
+++ b/bin/tests/system/allow-query/ns2/named12.conf.in
8a47aa
@@ -12,7 +12,7 @@
0b18b1
  */
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/allow-query/ns2/named30.conf.in b/bin/tests/system/allow-query/ns2/named30.conf.in
21fe71
index aefc474..52981a7 100644
899014
--- a/bin/tests/system/allow-query/ns2/named30.conf.in
899014
+++ b/bin/tests/system/allow-query/ns2/named30.conf.in
8a47aa
@@ -12,7 +12,7 @@
0b18b1
  */
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/allow-query/ns2/named31.conf.in b/bin/tests/system/allow-query/ns2/named31.conf.in
21fe71
index 27eccc2..f627870 100644
899014
--- a/bin/tests/system/allow-query/ns2/named31.conf.in
899014
+++ b/bin/tests/system/allow-query/ns2/named31.conf.in
8a47aa
@@ -12,12 +12,12 @@
0b18b1
  */
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
 key two {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234efgh8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/allow-query/ns2/named32.conf.in b/bin/tests/system/allow-query/ns2/named32.conf.in
21fe71
index adbb203..6fd516b 100644
899014
--- a/bin/tests/system/allow-query/ns2/named32.conf.in
899014
+++ b/bin/tests/system/allow-query/ns2/named32.conf.in
8a47aa
@@ -12,7 +12,7 @@
0b18b1
  */
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/allow-query/ns2/named40.conf.in b/bin/tests/system/allow-query/ns2/named40.conf.in
21fe71
index 364f94b..de37915 100644
899014
--- a/bin/tests/system/allow-query/ns2/named40.conf.in
899014
+++ b/bin/tests/system/allow-query/ns2/named40.conf.in
8a47aa
@@ -16,12 +16,12 @@ acl accept { 10.53.0.2; };
899014
 acl badaccept { 10.53.0.1; };
899014
 
899014
 key one {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
 key two {
899014
-	algorithm hmac-md5;
21fe71
+	algorithm @DEFAULT_HMAC@;
899014
 	secret "1234efgh8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/allow-query/tests.sh b/bin/tests/system/allow-query/tests.sh
99fd53
index 01a13cf..3711c63 100644
899014
--- a/bin/tests/system/allow-query/tests.sh
899014
+++ b/bin/tests/system/allow-query/tests.sh
99fd53
@@ -201,7 +201,7 @@ rndc_reload ns2 10.53.0.2
899014
 
899014
 echo_i "test $n: key allowed - query allowed"
899014
 ret=0
899014
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
899014
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null || ret=1
899014
 if [ $ret != 0 ]; then echo_i "failed"; fi
99fd53
@@ -214,7 +214,7 @@ rndc_reload ns2 10.53.0.2
899014
 
899014
 echo_i "test $n: key not allowed - query refused"
899014
 ret=0
899014
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
8a47aa
 grep 'EDE: 18 (Prohibited)' dig.out.ns2.$n > /dev/null || ret=1
899014
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1
99fd53
@@ -228,7 +228,7 @@ rndc_reload ns2 10.53.0.2
899014
 
899014
 echo_i "test $n: key disallowed - query refused"
899014
 ret=0
899014
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
8a47aa
 grep 'EDE: 18 (Prohibited)' dig.out.ns2.$n > /dev/null || ret=1
899014
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1
99fd53
@@ -367,7 +367,7 @@ rndc_reload ns2 10.53.0.2
899014
 
899014
 echo_i "test $n: views key allowed - query allowed"
899014
 ret=0
899014
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
899014
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null || ret=1
899014
 if [ $ret != 0 ]; then echo_i "failed"; fi
99fd53
@@ -380,7 +380,7 @@ rndc_reload ns2 10.53.0.2
899014
 
899014
 echo_i "test $n: views key not allowed - query refused"
899014
 ret=0
899014
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
8a47aa
 grep 'EDE: 18 (Prohibited)' dig.out.ns2.$n > /dev/null || ret=1
899014
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1
99fd53
@@ -394,7 +394,7 @@ rndc_reload ns2 10.53.0.2
899014
 
899014
 echo_i "test $n: views key disallowed - query refused"
899014
 ret=0
899014
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
899014
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
8a47aa
 grep 'EDE: 18 (Prohibited)' dig.out.ns2.$n > /dev/null || ret=1
899014
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1
99fd53
@@ -534,7 +534,7 @@ status=`expr $status + $ret`
899014
 n=`expr $n + 1`
899014
 echo_i "test $n: zone key allowed - query allowed"
899014
 ret=0
899014
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.keyallow.example a > dig.out.ns2.$n || ret=1
899014
+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.keyallow.example a > dig.out.ns2.$n || ret=1
899014
 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
899014
 grep '^a.keyallow.example' dig.out.ns2.$n > /dev/null || ret=1
899014
 if [ $ret != 0 ]; then echo_i "failed"; fi
99fd53
@@ -544,7 +544,7 @@ status=`expr $status + $ret`
899014
 n=`expr $n + 1`
899014
 echo_i "test $n: zone key not allowed - query refused"
899014
 ret=0
899014
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y two:1234efgh8765 a.keyallow.example a > dig.out.ns2.$n || ret=1
899014
+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:two:1234efgh8765 a.keyallow.example a > dig.out.ns2.$n || ret=1
899014
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
8a47aa
 grep 'EDE: 18 (Prohibited)' dig.out.ns2.$n > /dev/null || ret=1
899014
 grep '^a.keyallow.example' dig.out.ns2.$n > /dev/null && ret=1
99fd53
@@ -555,7 +555,7 @@ status=`expr $status + $ret`
899014
 n=`expr $n + 1`
899014
 echo_i "test $n: zone key disallowed - query refused"
899014
 ret=0
899014
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.keydisallow.example a > dig.out.ns2.$n || ret=1
899014
+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.keydisallow.example a > dig.out.ns2.$n || ret=1
899014
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
8a47aa
 grep 'EDE: 18 (Prohibited)' dig.out.ns2.$n > /dev/null || ret=1
899014
 grep '^a.keydisallow.example' dig.out.ns2.$n > /dev/null && ret=1
899014
diff --git a/bin/tests/system/checkconf/bad-tsig.conf b/bin/tests/system/checkconf/bad-tsig.conf
8a47aa
index 4af25b0..9f202d5 100644
899014
--- a/bin/tests/system/checkconf/bad-tsig.conf
899014
+++ b/bin/tests/system/checkconf/bad-tsig.conf
8a47aa
@@ -13,7 +13,7 @@
899014
 
899014
 /* Bad secret */
899014
 key "badtsig" {
899014
-	algorithm hmac-md5;
899014
+	algorithm hmac-sha256;
899014
 	secret "jEdD+BPKg==";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/checkconf/good.conf b/bin/tests/system/checkconf/good.conf
9b329d
index 93939ff..3f78622 100644
899014
--- a/bin/tests/system/checkconf/good.conf
899014
+++ b/bin/tests/system/checkconf/good.conf
9b329d
@@ -280,6 +280,6 @@ dyndb "name" "library.so" {
899014
 	system;
899014
 };
899014
 key "mykey" {
899014
-	algorithm "hmac-md5";
899014
+	algorithm "hmac-sha256";
899014
 	secret "qwertyuiopasdfgh";
899014
 };
21fe71
diff --git a/bin/tests/system/cookie/ns1/named.conf.in b/bin/tests/system/cookie/ns1/named.conf.in
21fe71
index 1304303..e9c28c6 100644
21fe71
--- a/bin/tests/system/cookie/ns1/named.conf.in
21fe71
+++ b/bin/tests/system/cookie/ns1/named.conf.in
21fe71
@@ -18,7 +18,7 @@ key rndc_key {
21fe71
 
21fe71
 key foo {
21fe71
 	secret "aaaaaaaaaaaa";
21fe71
-	algorithm hmac-sha256;
21fe71
+	algorithm @DEFAULT_HMAC@;
21fe71
 };
21fe71
 
21fe71
 server 10.53.0.10 {
21fe71
diff --git a/bin/tests/system/dnssec/ns4/named5.conf.in b/bin/tests/system/dnssec/ns4/named5.conf.in
21fe71
index f1b817a..e457062 100644
21fe71
--- a/bin/tests/system/dnssec/ns4/named5.conf.in
21fe71
+++ b/bin/tests/system/dnssec/ns4/named5.conf.in
21fe71
@@ -35,5 +35,5 @@ controls {
21fe71
 
21fe71
 key auth {
21fe71
 	secret "1234abcd8765";
21fe71
-	algorithm hmac-sha256;
21fe71
+	algorithm @DEFAULT_HMAC@;
21fe71
 };
899014
diff --git a/bin/tests/system/feature-test.c b/bin/tests/system/feature-test.c
9b329d
index b1adaed..3942df6 100644
899014
--- a/bin/tests/system/feature-test.c
899014
+++ b/bin/tests/system/feature-test.c
99f74e
@@ -17,6 +17,7 @@
b626a2
 #include <string.h>
b626a2
 #include <unistd.h>
b626a2
 
b626a2
+#include <isc/md.h>
b626a2
 #include <isc/net.h>
899014
 #include <isc/print.h>
899014
 #include <isc/util.h>
9b329d
@@ -143,6 +144,19 @@ main(int argc, char **argv) {
8a47aa
 #endif
899014
 	}
899014
 
899014
+	if (strcmp(argv[1], "--md5") == 0) {
0b18b1
+		unsigned char digest[ISC_MAX_MD_SIZE];
aaee84
+		const unsigned char test[] = "test";
aaee84
+		unsigned int size = sizeof(digest);
0b18b1
+
0b18b1
+		if (isc_md(ISC_MD_MD5, test, sizeof(test),
aaee84
+		           digest, &size) == ISC_R_SUCCESS) {
899014
+			return (0);
899014
+		} else {
899014
+			return (1);
899014
+		}
899014
+	}
899014
+
8a47aa
 	if (strcmp(argv[1], "--ipv6only=no") == 0) {
8a47aa
 #if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
8a47aa
 		int s;
899014
diff --git a/bin/tests/system/notify/ns5/named.conf.in b/bin/tests/system/notify/ns5/named.conf.in
21fe71
index 5cab276..c0492e1 100644
899014
--- a/bin/tests/system/notify/ns5/named.conf.in
899014
+++ b/bin/tests/system/notify/ns5/named.conf.in
8a47aa
@@ -12,17 +12,17 @@
899014
  */
899014
 
899014
 key "a" {
899014
-	algorithm "hmac-md5";
21fe71
+	algorithm "@DEFAULT_HMAC@";
899014
 	secret "aaaaaaaaaaaaaaaaaaaa";
899014
 };
899014
 
899014
 key "b" {
899014
-	algorithm "hmac-md5";
21fe71
+	algorithm "@DEFAULT_HMAC@";
899014
 	secret "bbbbbbbbbbbbbbbbbbbb";
899014
 };
899014
 
899014
 key "c" {
899014
-	algorithm "hmac-md5";
21fe71
+	algorithm "@DEFAULT_HMAC@";
899014
 	secret "cccccccccccccccccccc";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/notify/tests.sh b/bin/tests/system/notify/tests.sh
9b329d
index 706b7fc..2565ab4 100644
899014
--- a/bin/tests/system/notify/tests.sh
899014
+++ b/bin/tests/system/notify/tests.sh
99f74e
@@ -179,7 +179,7 @@ test_start "checking notify to multiple views using tsig"
899014
 $NSUPDATE << EOF
899014
 server 10.53.0.5 ${PORT}
899014
 zone x21
899014
-key a aaaaaaaaaaaaaaaaaaaa
899014
+key hmac-sha256:a aaaaaaaaaaaaaaaaaaaa
899014
 update add added.x21 0 in txt "test string"
899014
 send
899014
 EOF
99f74e
@@ -187,9 +187,9 @@ fnb="dig.out.b.ns5.test$n"
8a47aa
 fnc="dig.out.c.ns5.test$n"
899014
 for i in 1 2 3 4 5 6 7 8 9
899014
 do
8a47aa
-	dig_plus_opts added.x21. -y b:bbbbbbbbbbbbbbbbbbbb @10.53.0.5 \
8a47aa
+	dig_plus_opts added.x21. -y hmac-sha256:b:bbbbbbbbbbbbbbbbbbbb @10.53.0.5 \
8a47aa
 		txt > "$fnb" || ret=1
8a47aa
-	dig_plus_opts added.x21. -y c:cccccccccccccccccccc @10.53.0.5 \
8a47aa
+	dig_plus_opts added.x21. -y hmac-sha256:c:cccccccccccccccccccc @10.53.0.5 \
8a47aa
 		txt > "$fnc" || ret=1
8a47aa
 	grep "test string" "$fnb" > /dev/null &&
8a47aa
 	grep "test string" "$fnc" > /dev/null &&
899014
diff --git a/bin/tests/system/nsupdate/ns1/named.conf.in b/bin/tests/system/nsupdate/ns1/named.conf.in
bbdbcb
index 2b67360..a734584 100644
899014
--- a/bin/tests/system/nsupdate/ns1/named.conf.in
899014
+++ b/bin/tests/system/nsupdate/ns1/named.conf.in
8a47aa
@@ -39,7 +39,7 @@ controls {
899014
 };
899014
 
899014
 key altkey {
899014
-	algorithm hmac-md5;
899014
+	algorithm hmac-sha512;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/nsupdate/ns2/named.conf.in b/bin/tests/system/nsupdate/ns2/named.conf.in
bbdbcb
index c85eef5..428b6b1 100644
899014
--- a/bin/tests/system/nsupdate/ns2/named.conf.in
899014
+++ b/bin/tests/system/nsupdate/ns2/named.conf.in
8a47aa
@@ -34,7 +34,7 @@ controls {
899014
 };
899014
 
899014
 key altkey {
899014
-	algorithm hmac-md5;
899014
+	algorithm hmac-sha512;
899014
 	secret "1234abcd8765";
899014
 };
899014
 
21fe71
diff --git a/bin/tests/system/nsupdate/ns9/named.conf.in b/bin/tests/system/nsupdate/ns9/named.conf.in
21fe71
index 6a7ff88..0b70745 100644
21fe71
--- a/bin/tests/system/nsupdate/ns9/named.conf.in
21fe71
+++ b/bin/tests/system/nsupdate/ns9/named.conf.in
21fe71
@@ -32,7 +32,7 @@ key rndc_key {
21fe71
 
21fe71
 key subkey {
21fe71
 	secret "1234abcd8765";
21fe71
-	algorithm hmac-sha256;
21fe71
+	algorithm @DEFAULT_HMAC@;
21fe71
 };
21fe71
 
21fe71
 controls {
899014
diff --git a/bin/tests/system/nsupdate/setup.sh b/bin/tests/system/nsupdate/setup.sh
8a47aa
index 50056dc..a4a1a3f 100644
899014
--- a/bin/tests/system/nsupdate/setup.sh
899014
+++ b/bin/tests/system/nsupdate/setup.sh
8a47aa
@@ -72,7 +72,11 @@ EOF
899014
 
8a47aa
 $TSIGKEYGEN ddns-key.example.nil > ns1/ddns.key
899014
 
8a47aa
-$TSIGKEYGEN -a hmac-md5 md5-key > ns1/md5.key
899014
+if $FEATURETEST --md5; then
8a47aa
+	$TSIGKEYGEN -a hmac-md5 md5-key > ns1/md5.key
899014
+else
899014
+	echo -n > ns1/md5.key
899014
+fi
8a47aa
 $TSIGKEYGEN -a hmac-sha1 sha1-key > ns1/sha1.key
8a47aa
 $TSIGKEYGEN -a hmac-sha224 sha224-key > ns1/sha224.key
8a47aa
 $TSIGKEYGEN -a hmac-sha256 sha256-key > ns1/sha256.key
899014
diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh
9b329d
index d612a22..9f18e57 100755
899014
--- a/bin/tests/system/nsupdate/tests.sh
899014
+++ b/bin/tests/system/nsupdate/tests.sh
bbdbcb
@@ -841,7 +841,12 @@ fi
bbdbcb
 n=$((n + 1))
899014
 ret=0
76074c
 echo_i "check TSIG key algorithms (nsupdate -k) ($n)"
899014
-for alg in md5 sha1 sha224 sha256 sha384 sha512; do
bbdbcb
+MD5ALG='md5'
bbdbcb
+if ! $FEATURETEST --md5; then
bbdbcb
+	MD5ALG=''
899014
+	echo_i "skipping disabled md5 algorithm"
899014
+fi
bbdbcb
+for alg in $MD5ALG sha1 sha224 sha256 sha384 sha512; do
899014
     $NSUPDATE -k ns1/${alg}.key <<END > /dev/null || ret=1
899014
 server 10.53.0.1 ${PORT}
899014
 update add ${alg}.keytests.nil. 600 A 10.10.10.3
bbdbcb
@@ -849,7 +854,7 @@ send
899014
 END
899014
 done
899014
 sleep 2
899014
-for alg in md5 sha1 sha224 sha256 sha384 sha512; do
899014
+for alg in $ALGS; do
899014
     $DIG $DIGOPTS +short @10.53.0.1 ${alg}.keytests.nil | grep 10.10.10.3 > /dev/null 2>&1 || ret=1
899014
 done
899014
 if [ $ret -ne 0 ]; then
21fe71
diff --git a/bin/tests/system/rndc/ns2/named.conf.in b/bin/tests/system/rndc/ns2/named.conf.in
21fe71
index 117a5f4..be1af25 100644
21fe71
--- a/bin/tests/system/rndc/ns2/named.conf.in
21fe71
+++ b/bin/tests/system/rndc/ns2/named.conf.in
21fe71
@@ -27,7 +27,7 @@ key rndc_key {
21fe71
 
21fe71
 key secondkey {
21fe71
 	secret "abcd1234abcd8765";
21fe71
-	algorithm hmac-sha256;
21fe71
+	algorithm @DEFAULT_HMAC@;
21fe71
 };
21fe71
 
21fe71
 controls {
21fe71
diff --git a/bin/tests/system/rndc/ns3/named.conf.in b/bin/tests/system/rndc/ns3/named.conf.in
21fe71
index 3078e90..fd97ca2 100644
21fe71
--- a/bin/tests/system/rndc/ns3/named.conf.in
21fe71
+++ b/bin/tests/system/rndc/ns3/named.conf.in
21fe71
@@ -25,7 +25,7 @@ key rndc_key {
21fe71
 
21fe71
 key secondkey {
21fe71
 	secret "abcd1234abcd8765";
21fe71
-	algorithm hmac-sha256;
21fe71
+	algorithm @DEFAULT_HMAC@;
21fe71
 };
21fe71
 
21fe71
 controls {
899014
diff --git a/bin/tests/system/rndc/setup.sh b/bin/tests/system/rndc/setup.sh
9b329d
index 5f638ef..85d6b73 100644
899014
--- a/bin/tests/system/rndc/setup.sh
899014
+++ b/bin/tests/system/rndc/setup.sh
8a47aa
@@ -47,7 +47,7 @@ make_key () {
899014
             sed 's/allow { 10.53.0.4/allow { any/' >> ns4/named.conf
899014
 }
899014
 
899014
-make_key 1 ${EXTRAPORT1} hmac-md5
899014
+$FEATURETEST --md5 && make_key 1 ${EXTRAPORT1} hmac-md5
899014
 make_key 2 ${EXTRAPORT2} hmac-sha1
899014
 make_key 3 ${EXTRAPORT3} hmac-sha224
899014
 make_key 4 ${EXTRAPORT4} hmac-sha256
899014
diff --git a/bin/tests/system/rndc/tests.sh b/bin/tests/system/rndc/tests.sh
9b329d
index e68428c..acbeb52 100644
899014
--- a/bin/tests/system/rndc/tests.sh
899014
+++ b/bin/tests/system/rndc/tests.sh
8a47aa
@@ -350,15 +350,19 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
8a47aa
 status=$((status+ret))
899014
 
8a47aa
 n=$((n+1))
899014
-echo_i "testing rndc with hmac-md5 ($n)"
899014
-ret=0
899014
-$RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key1.conf status > /dev/null 2>&1 || ret=1
899014
-for i in 2 3 4 5 6
899014
-do
899014
-        $RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
899014
-done
899014
-if [ $ret != 0 ]; then echo_i "failed"; fi
8a47aa
-status=$((status+ret))
99f74e
+if $FEATURETEST --md5; then
899014
+	echo_i "testing rndc with hmac-md5 ($n)"
899014
+	ret=0
899014
+	$RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key1.conf status > /dev/null 2>&1 || ret=1
899014
+	for i in 2 3 4 5 6
899014
+	do
8a47aa
+	        $RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
899014
+	done
899014
+	if [ $ret != 0 ]; then echo_i "failed"; fi
8a47aa
+	status=$((status+ret))
899014
+else
899014
+	echo_i "skipping rndc with hmac-md5 ($n)"
899014
+fi
899014
 
8a47aa
 n=$((n+1))
899014
 echo_i "testing rndc with hmac-sha1 ($n)"
899014
diff --git a/bin/tests/system/tsig/ns1/named.conf.in b/bin/tests/system/tsig/ns1/named.conf.in
8a47aa
index 76cf970..22637af 100644
899014
--- a/bin/tests/system/tsig/ns1/named.conf.in
899014
+++ b/bin/tests/system/tsig/ns1/named.conf.in
8a47aa
@@ -23,10 +23,7 @@ options {
899014
 	notify no;
899014
 };
899014
 
899014
-key "md5" {
899014
-	secret "97rnFx24Tfna4mHPfgnerA==";
899014
-	algorithm hmac-md5;
899014
-};
899014
+# md5 key appended by setup.sh at the end
899014
 
899014
 key "sha1" {
899014
 	secret "FrSt77yPTFx6hTs4i2tKLB9LmE0=";
8a47aa
@@ -53,10 +50,7 @@ key "sha512" {
899014
 	algorithm hmac-sha512;
899014
 };
899014
 
899014
-key "md5-trunc" {
899014
-	secret "97rnFx24Tfna4mHPfgnerA==";
899014
-	algorithm hmac-md5-80;
899014
-};
899014
+# md5-trunc key appended by setup.sh at the end
899014
 
899014
 key "sha1-trunc" {
899014
 	secret "FrSt77yPTFx6hTs4i2tKLB9LmE0=";
21fe71
diff --git a/bin/tests/system/tsig/ns1/rndc5.conf.in b/bin/tests/system/tsig/ns1/rndc5.conf.in
21fe71
new file mode 100644
21fe71
index 0000000..0682194
21fe71
--- /dev/null
21fe71
+++ b/bin/tests/system/tsig/ns1/rndc5.conf.in
21fe71
@@ -0,0 +1,10 @@
21fe71
+# Conditionally included when support for MD5 is available
21fe71
+key "md5" {
21fe71
+	secret "97rnFx24Tfna4mHPfgnerA==";
21fe71
+	algorithm hmac-md5;
21fe71
+};
21fe71
+
21fe71
+key "md5-trunc" {
21fe71
+	secret "97rnFx24Tfna4mHPfgnerA==";
21fe71
+	algorithm hmac-md5-80;
21fe71
+};
899014
diff --git a/bin/tests/system/tsig/setup.sh b/bin/tests/system/tsig/setup.sh
8a47aa
index 34cc73b..d51ff21 100644
899014
--- a/bin/tests/system/tsig/setup.sh
899014
+++ b/bin/tests/system/tsig/setup.sh
8a47aa
@@ -16,3 +16,8 @@
0b18b1
 $SHELL clean.sh
899014
 
0b18b1
 copy_setports ns1/named.conf.in ns1/named.conf
1e4169
+
899014
+if $FEATURETEST --md5
899014
+then
899014
+	cat ns1/rndc5.conf.in >> ns1/named.conf
899014
+fi
899014
diff --git a/bin/tests/system/tsig/tests.sh b/bin/tests/system/tsig/tests.sh
8a47aa
index 1067227..ee05e83 100644
899014
--- a/bin/tests/system/tsig/tests.sh
899014
+++ b/bin/tests/system/tsig/tests.sh
8a47aa
@@ -27,20 +27,25 @@ sha512="jI/Pa4qRu96t76Pns5Z/Ndxbn3QCkwcxLOgt9vgvnJw5wqTRvNyk3FtD6yIMd1dWVlqZ+Y4f
899014
 
899014
 status=0
899014
 
899014
-echo_i "fetching using hmac-md5 (old form)"
899014
-ret=0
899014
-$DIG $DIGOPTS example.nil. -y "md5:$md5" @10.53.0.1 soa > dig.out.md5.old || ret=1
899014
-grep -i "md5.*TSIG.*NOERROR" dig.out.md5.old > /dev/null || ret=1
899014
-if [ $ret -eq 1 ] ; then
899014
-	echo_i "failed"; status=1
899014
-fi
8a47aa
-
8a47aa
-echo_i "fetching using hmac-md5 (new form)"
8a47aa
-ret=0
8a47aa
-$DIG $DIGOPTS example.nil. -y "hmac-md5:md5:$md5" @10.53.0.1 soa > dig.out.md5.new || ret=1
8a47aa
-grep -i "md5.*TSIG.*NOERROR" dig.out.md5.new > /dev/null || ret=1
8a47aa
-if [ $ret -eq 1 ] ; then
8a47aa
-	echo_i "failed"; status=1
899014
+if $FEATURETEST --md5
899014
+then
899014
+	echo_i "fetching using hmac-md5 (old form)"
899014
+	ret=0
899014
+	$DIG $DIGOPTS example.nil. -y "md5:$md5" @10.53.0.1 soa > dig.out.md5.old || ret=1
899014
+	grep -i "md5.*TSIG.*NOERROR" dig.out.md5.old > /dev/null || ret=1
899014
+	if [ $ret -eq 1 ] ; then
899014
+		echo_i "failed"; status=1
899014
+	fi
8a47aa
+
899014
+	echo_i "fetching using hmac-md5 (new form)"
899014
+	ret=0
899014
+	$DIG $DIGOPTS example.nil. -y "hmac-md5:md5:$md5" @10.53.0.1 soa > dig.out.md5.new || ret=1
899014
+	grep -i "md5.*TSIG.*NOERROR" dig.out.md5.new > /dev/null || ret=1
899014
+	if [ $ret -eq 1 ] ; then
899014
+		echo_i "failed"; status=1
899014
+	fi
899014
+else
899014
+	echo_i "skipping using hmac-md5"
899014
 fi
899014
 
899014
 echo_i "fetching using hmac-sha1"
8a47aa
@@ -88,12 +93,17 @@ fi
899014
 #	Truncated TSIG
899014
 #
899014
 #
899014
-echo_i "fetching using hmac-md5 (trunc)"
899014
-ret=0
899014
-$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5-trunc:$md5" @10.53.0.1 soa > dig.out.md5.trunc || ret=1
899014
-grep -i "md5-trunc.*TSIG.*NOERROR" dig.out.md5.trunc > /dev/null || ret=1
899014
-if [ $ret -eq 1 ] ; then
899014
-	echo_i "failed"; status=1
899014
+if $FEATURETEST --md5
899014
+then
899014
+	echo_i "fetching using hmac-md5 (trunc)"
899014
+	ret=0
899014
+	$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5-trunc:$md5" @10.53.0.1 soa > dig.out.md5.trunc || ret=1
899014
+	grep -i "md5-trunc.*TSIG.*NOERROR" dig.out.md5.trunc > /dev/null || ret=1
899014
+	if [ $ret -eq 1 ] ; then
899014
+		echo_i "failed"; status=1
899014
+	fi
899014
+else
899014
+	echo_i "skipping using hmac-md5 (trunc)"
899014
 fi
899014
 
899014
 echo_i "fetching using hmac-sha1 (trunc)"
8a47aa
@@ -142,12 +152,17 @@ fi
899014
 #	Check for bad truncation.
899014
 #
899014
 #
899014
-echo_i "fetching using hmac-md5-80 (BADTRUNC)"
899014
-ret=0
899014
-$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5:$md5" @10.53.0.1 soa > dig.out.md5-80 || ret=1
899014
-grep -i "md5.*TSIG.*BADTRUNC" dig.out.md5-80 > /dev/null || ret=1
899014
-if [ $ret -eq 1 ] ; then
899014
-	echo_i "failed"; status=1
899014
+if $FEATURETEST --md5
899014
+then
899014
+	echo_i "fetching using hmac-md5-80 (BADTRUNC)" 
899014
+	ret=0
899014
+	$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5:$md5" @10.53.0.1 soa > dig.out.md5-80 || ret=1
899014
+	grep -i "md5.*TSIG.*BADTRUNC" dig.out.md5-80 > /dev/null || ret=1
899014
+	if [ $ret -eq 1 ] ; then
899014
+		echo_i "failed"; status=1
899014
+	fi
899014
+else
899014
+	echo_i "skipping using hmac-md5-80 (BADTRUNC)" 
899014
 fi
899014
 
899014
 echo_i "fetching using hmac-sha1-80 (BADTRUNC)"
899014
diff --git a/bin/tests/system/upforwd/ns1/named.conf.in b/bin/tests/system/upforwd/ns1/named.conf.in
21fe71
index c2b57dd..ea744f8 100644
899014
--- a/bin/tests/system/upforwd/ns1/named.conf.in
899014
+++ b/bin/tests/system/upforwd/ns1/named.conf.in
8a47aa
@@ -12,7 +12,7 @@
899014
  */
899014
 
899014
 key "update.example." {
899014
-	algorithm "hmac-md5";
21fe71
+	algorithm "@DEFAULT_HMAC@";
899014
 	secret "c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";
899014
 };
899014
 
899014
diff --git a/bin/tests/system/upforwd/tests.sh b/bin/tests/system/upforwd/tests.sh
8a47aa
index a6de312..ebcadb1 100644
899014
--- a/bin/tests/system/upforwd/tests.sh
899014
+++ b/bin/tests/system/upforwd/tests.sh
8a47aa
@@ -80,7 +80,7 @@ if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
899014
 
899014
 echo_i "updating zone (signed) ($n)"
899014
 ret=0
899014
-$NSUPDATE -y update.example:c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K -- - <
899014
+$NSUPDATE -y hmac-sha256:update.example:c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K -- - <
899014
 server 10.53.0.3 ${PORT}
899014
 update add updated.example. 600 A 10.10.10.1
899014
 update add updated.example. 600 TXT Foo
899014
-- 
9b329d
2.39.0
899014