1baafe
From 3f04cf343dbeb8819197702ce1be737e26e0638a Mon Sep 17 00:00:00 2001
1baafe
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
1baafe
Date: Thu, 2 Aug 2018 23:46:45 +0200
1baafe
Subject: [PATCH] FIPS tests changes
1baafe
MIME-Version: 1.0
1baafe
Content-Type: text/plain; charset=UTF-8
1baafe
Content-Transfer-Encoding: 8bit
1baafe
1baafe
Squashed commit of the following:
1baafe
1baafe
commit 09e5eb48698d4fef2fc1031870de86c553b6bfaa
1baafe
Author: Petr Menšík <pemensik@redhat.com>
1baafe
Date:   Wed Mar 7 20:35:13 2018 +0100
1baafe
1baafe
    Fix nsupdate test. Do not use md5 by default for rndc, skip gracefully md5 if not available.
1baafe
1baafe
commit ab303db70082db76ecf36493d0b82ef3e8750cad
1baafe
Author: Petr Menšík <pemensik@redhat.com>
1baafe
Date:   Wed Mar 7 18:11:10 2018 +0100
1baafe
1baafe
    Changed root key to be RSASHA256
1baafe
1baafe
    Change bad trusted key to be the same algorithm.
1baafe
1baafe
commit 88ab07c0e14cc71247e1f9d11a1ea832b64c1ee8
1baafe
Author: Petr Menšík <pemensik@redhat.com>
1baafe
Date:   Wed Mar 7 16:56:17 2018 +0100
1baafe
1baafe
    Change used key to not use hmac-md5
1baafe
1baafe
    Fix upforwd test, do not use hmac-md5
1baafe
1baafe
commit aec891571626f053acfb4d0a247240cbc21a84e9
1baafe
Author: Petr Menšík <pemensik@redhat.com>
1baafe
Date:   Wed Mar 7 15:54:11 2018 +0100
1baafe
1baafe
    Increase bitsize of DSA key to pass FIPS 140-2 mode.
1baafe
1baafe
commit bca8e164fa0d9aff2f946b8b4eb0f1f7e0bf6696
1baafe
Author: Petr Menšík <pemensik@redhat.com>
1baafe
Date:   Wed Mar 7 15:41:08 2018 +0100
1baafe
1baafe
    Fix tsig and rndc tests for disabled md5
1baafe
1baafe
    Use hmac-sha256 instead of hmac-md5.
1baafe
1baafe
commit 0d314c1ab6151aa13574a21ad22f28d3b7f42a67
1baafe
Author: Petr Menšík <pemensik@redhat.com>
1baafe
Date:   Wed Mar 7 13:21:00 2018 +0100
1baafe
1baafe
    Add md5 availability detection to featuretest
1baafe
1baafe
commit f389a918803e2853e4b55fed62765dc4a492e34f
1baafe
Author: Petr Menšík <pemensik@redhat.com>
1baafe
Date:   Wed Mar 7 10:44:23 2018 +0100
1baafe
1baafe
    Change tests to not use hmac-md5 algorithms if not required
1baafe
1baafe
    Use hmac-sha256 instead of default hmac-md5 for allow-query
1baafe
---
1baafe
 bin/tests/system/acl/ns2/named1.conf.in       |  4 +-
1baafe
 bin/tests/system/acl/ns2/named2.conf.in       |  4 +-
1baafe
 bin/tests/system/acl/ns2/named3.conf.in       |  6 +-
1baafe
 bin/tests/system/acl/ns2/named4.conf.in       |  4 +-
1baafe
 bin/tests/system/acl/ns2/named5.conf.in       |  4 +-
1baafe
 bin/tests/system/acl/tests.sh                 | 32 ++++-----
1baafe
 .../system/allow-query/ns2/named10.conf.in    |  2 +-
1baafe
 .../system/allow-query/ns2/named11.conf.in    |  4 +-
1baafe
 .../system/allow-query/ns2/named12.conf.in    |  2 +-
1baafe
 .../system/allow-query/ns2/named30.conf.in    |  2 +-
1baafe
 .../system/allow-query/ns2/named31.conf.in    |  4 +-
1baafe
 .../system/allow-query/ns2/named32.conf.in    |  2 +-
1baafe
 .../system/allow-query/ns2/named40.conf.in    |  4 +-
1baafe
 bin/tests/system/allow-query/tests.sh         | 18 ++---
1baafe
 bin/tests/system/catz/ns1/named.conf.in       |  2 +-
1baafe
 bin/tests/system/catz/ns2/named.conf.in       |  2 +-
1baafe
 bin/tests/system/checkconf/bad-tsig.conf      |  2 +-
1baafe
 bin/tests/system/checkconf/good.conf          |  2 +-
1baafe
 bin/tests/system/feature-test.c               | 14 ++++
1baafe
 bin/tests/system/notify/ns5/named.conf.in     |  6 +-
1baafe
 bin/tests/system/notify/tests.sh              |  6 +-
1baafe
 bin/tests/system/nsupdate/ns1/named.conf.in   |  2 +-
1baafe
 bin/tests/system/nsupdate/ns2/named.conf.in   |  2 +-
1baafe
 bin/tests/system/nsupdate/setup.sh            |  6 +-
1baafe
 bin/tests/system/nsupdate/tests.sh            | 15 +++--
1baafe
 bin/tests/system/rndc/setup.sh                |  2 +-
1baafe
 bin/tests/system/rndc/tests.sh                | 23 ++++---
1baafe
 bin/tests/system/tsig/ns1/named.conf.in       | 10 +--
1baafe
 bin/tests/system/tsig/ns1/rndc5.conf.in       | 10 +++
1baafe
 bin/tests/system/tsig/setup.sh                |  5 ++
1baafe
 bin/tests/system/tsig/tests.sh                | 65 ++++++++++++-------
1baafe
 bin/tests/system/upforwd/ns1/named.conf.in    |  2 +-
1baafe
 bin/tests/system/upforwd/tests.sh             |  2 +-
1baafe
 33 files changed, 162 insertions(+), 108 deletions(-)
1baafe
 create mode 100644 bin/tests/system/tsig/ns1/rndc5.conf.in
1baafe
1baafe
diff --git a/bin/tests/system/acl/ns2/named1.conf.in b/bin/tests/system/acl/ns2/named1.conf.in
1baafe
index 60f22e1..249f672 100644
1baafe
--- a/bin/tests/system/acl/ns2/named1.conf.in
1baafe
+++ b/bin/tests/system/acl/ns2/named1.conf.in
1baafe
@@ -33,12 +33,12 @@ options {
1baafe
 };
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
 key two {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/acl/ns2/named2.conf.in b/bin/tests/system/acl/ns2/named2.conf.in
1baafe
index ada97bc..f82d858 100644
1baafe
--- a/bin/tests/system/acl/ns2/named2.conf.in
1baafe
+++ b/bin/tests/system/acl/ns2/named2.conf.in
1baafe
@@ -33,12 +33,12 @@ options {
1baafe
 };
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
 key two {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/acl/ns2/named3.conf.in b/bin/tests/system/acl/ns2/named3.conf.in
1baafe
index 97684e4..de6a2e9 100644
1baafe
--- a/bin/tests/system/acl/ns2/named3.conf.in
1baafe
+++ b/bin/tests/system/acl/ns2/named3.conf.in
1baafe
@@ -33,17 +33,17 @@ options {
1baafe
 };
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
 key two {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
 key three {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/acl/ns2/named4.conf.in b/bin/tests/system/acl/ns2/named4.conf.in
1baafe
index 462b3fa..994b35c 100644
1baafe
--- a/bin/tests/system/acl/ns2/named4.conf.in
1baafe
+++ b/bin/tests/system/acl/ns2/named4.conf.in
1baafe
@@ -33,12 +33,12 @@ options {
1baafe
 };
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
 key two {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/acl/ns2/named5.conf.in b/bin/tests/system/acl/ns2/named5.conf.in
1baafe
index 728da58..8f00d09 100644
1baafe
--- a/bin/tests/system/acl/ns2/named5.conf.in
1baafe
+++ b/bin/tests/system/acl/ns2/named5.conf.in
1baafe
@@ -35,12 +35,12 @@ options {
1baafe
 };
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
 key two {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/acl/tests.sh b/bin/tests/system/acl/tests.sh
1baafe
index be59d64..13d5bdc 100644
1baafe
--- a/bin/tests/system/acl/tests.sh
1baafe
+++ b/bin/tests/system/acl/tests.sh
1baafe
@@ -22,14 +22,14 @@ echo_i "testing basic ACL processing"
1baafe
 # key "one" should fail
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 
1baafe
 # any other key should be fine
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 copy_setports ns2/named2.conf.in ns2/named.conf
1baafe
@@ -39,18 +39,18 @@ sleep 5
1baafe
 # prefix 10/8 should fail
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # any other address should work, as long as it sends key "one"
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 127.0.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 echo_i "testing nested ACL processing"
1baafe
@@ -62,31 +62,31 @@ sleep 5
1baafe
 # should succeed
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # should succeed
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # should succeed
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # should succeed
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # but only one or the other should fail
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 t=`expr $t + 1`
1baafe
@@ -97,7 +97,7 @@ grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $tt failed" ; status=1
1baafe
 # and other values? right out
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 127.0.0.1 axfr -y three:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:three:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # now we only allow 10.53.0.1 *and* key one, or 10.53.0.2 *and* key two
1baafe
@@ -108,31 +108,31 @@ sleep 5
1baafe
 # should succeed
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # should succeed
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # should fail
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # should fail
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 # should fail
1baafe
 t=`expr $t + 1`
1baafe
 $DIG $DIGOPTS tsigzone. \
1baafe
-	@10.53.0.2 -b 10.53.0.3 axfr -y one:1234abcd8765 > dig.out.${t}
1baafe
+	@10.53.0.2 -b 10.53.0.3 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t}
1baafe
 grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
1baafe
 
1baafe
 echo_i "testing allow-query-on ACL processing"
1baafe
diff --git a/bin/tests/system/allow-query/ns2/named10.conf.in b/bin/tests/system/allow-query/ns2/named10.conf.in
1baafe
index 7d43e36..f7b25f9 100644
1baafe
--- a/bin/tests/system/allow-query/ns2/named10.conf.in
1baafe
+++ b/bin/tests/system/allow-query/ns2/named10.conf.in
1baafe
@@ -10,7 +10,7 @@
1baafe
  */
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/allow-query/ns2/named11.conf.in b/bin/tests/system/allow-query/ns2/named11.conf.in
1baafe
index 2952518..121557e 100644
1baafe
--- a/bin/tests/system/allow-query/ns2/named11.conf.in
1baafe
+++ b/bin/tests/system/allow-query/ns2/named11.conf.in
1baafe
@@ -10,12 +10,12 @@
1baafe
  */
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
 key two {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234efgh8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/allow-query/ns2/named12.conf.in b/bin/tests/system/allow-query/ns2/named12.conf.in
1baafe
index 0c01071..ceabbb5 100644
1baafe
--- a/bin/tests/system/allow-query/ns2/named12.conf.in
1baafe
+++ b/bin/tests/system/allow-query/ns2/named12.conf.in
1baafe
@@ -10,7 +10,7 @@
1baafe
  */
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/allow-query/ns2/named30.conf.in b/bin/tests/system/allow-query/ns2/named30.conf.in
1baafe
index 4c17292..9cd9d1f 100644
1baafe
--- a/bin/tests/system/allow-query/ns2/named30.conf.in
1baafe
+++ b/bin/tests/system/allow-query/ns2/named30.conf.in
1baafe
@@ -10,7 +10,7 @@
1baafe
  */
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/allow-query/ns2/named31.conf.in b/bin/tests/system/allow-query/ns2/named31.conf.in
1baafe
index a2690a4..f488730 100644
1baafe
--- a/bin/tests/system/allow-query/ns2/named31.conf.in
1baafe
+++ b/bin/tests/system/allow-query/ns2/named31.conf.in
1baafe
@@ -10,12 +10,12 @@
1baafe
  */
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
 key two {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234efgh8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/allow-query/ns2/named32.conf.in b/bin/tests/system/allow-query/ns2/named32.conf.in
1baafe
index a0708c8..51fa457 100644
1baafe
--- a/bin/tests/system/allow-query/ns2/named32.conf.in
1baafe
+++ b/bin/tests/system/allow-query/ns2/named32.conf.in
1baafe
@@ -10,7 +10,7 @@
1baafe
  */
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/allow-query/ns2/named40.conf.in b/bin/tests/system/allow-query/ns2/named40.conf.in
1baafe
index 687768e..d24d6d2 100644
1baafe
--- a/bin/tests/system/allow-query/ns2/named40.conf.in
1baafe
+++ b/bin/tests/system/allow-query/ns2/named40.conf.in
1baafe
@@ -14,12 +14,12 @@ acl accept { 10.53.0.2; };
1baafe
 acl badaccept { 10.53.0.1; };
1baafe
 
1baafe
 key one {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
 key two {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "1234efgh8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/allow-query/tests.sh b/bin/tests/system/allow-query/tests.sh
1baafe
index fe40635..543c663 100644
1baafe
--- a/bin/tests/system/allow-query/tests.sh
1baafe
+++ b/bin/tests/system/allow-query/tests.sh
1baafe
@@ -182,7 +182,7 @@ rndc_reload ns2 10.53.0.2
1baafe
 
1baafe
 echo_i "test $n: key allowed - query allowed"
1baafe
 ret=0
1baafe
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
1baafe
+$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
1baafe
 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
@@ -195,7 +195,7 @@ rndc_reload ns2 10.53.0.2
1baafe
 
1baafe
 echo_i "test $n: key not allowed - query refused"
1baafe
 ret=0
1baafe
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1
1baafe
+$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
1baafe
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1
1baafe
 if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
@@ -208,7 +208,7 @@ rndc_reload ns2 10.53.0.2
1baafe
 
1baafe
 echo_i "test $n: key disallowed - query refused"
1baafe
 ret=0
1baafe
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
1baafe
+$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
1baafe
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1
1baafe
 if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
@@ -341,7 +341,7 @@ rndc_reload ns2 10.53.0.2
1baafe
 
1baafe
 echo_i "test $n: views key allowed - query allowed"
1baafe
 ret=0
1baafe
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
1baafe
+$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
1baafe
 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
@@ -354,7 +354,7 @@ rndc_reload ns2 10.53.0.2
1baafe
 
1baafe
 echo_i "test $n: views key not allowed - query refused"
1baafe
 ret=0
1baafe
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1
1baafe
+$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
1baafe
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1
1baafe
 if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
@@ -367,7 +367,7 @@ rndc_reload ns2 10.53.0.2
1baafe
 
1baafe
 echo_i "test $n: views key disallowed - query refused"
1baafe
 ret=0
1baafe
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1
1baafe
+$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
1baafe
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1
1baafe
 if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
@@ -500,7 +500,7 @@ status=`expr $status + $ret`
1baafe
 n=`expr $n + 1`
1baafe
 echo_i "test $n: zone key allowed - query allowed"
1baafe
 ret=0
1baafe
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.keyallow.example a > dig.out.ns2.$n || ret=1
1baafe
+$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
1baafe
 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 grep '^a.keyallow.example' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
@@ -510,7 +510,7 @@ status=`expr $status + $ret`
1baafe
 n=`expr $n + 1`
1baafe
 echo_i "test $n: zone key not allowed - query refused"
1baafe
 ret=0
1baafe
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y two:1234efgh8765 a.keyallow.example a > dig.out.ns2.$n || ret=1
1baafe
+$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
1baafe
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 grep '^a.keyallow.example' dig.out.ns2.$n > /dev/null && ret=1
1baafe
 if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
@@ -520,7 +520,7 @@ status=`expr $status + $ret`
1baafe
 n=`expr $n + 1`
1baafe
 echo_i "test $n: zone key disallowed - query refused"
1baafe
 ret=0
1baafe
-$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.keydisallow.example a > dig.out.ns2.$n || ret=1
1baafe
+$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
1baafe
 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
1baafe
 grep '^a.keydisallow.example' dig.out.ns2.$n > /dev/null && ret=1
1baafe
 if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
diff --git a/bin/tests/system/catz/ns1/named.conf.in b/bin/tests/system/catz/ns1/named.conf.in
1baafe
index 1218669..e62715e 100644
1baafe
--- a/bin/tests/system/catz/ns1/named.conf.in
1baafe
+++ b/bin/tests/system/catz/ns1/named.conf.in
1baafe
@@ -61,5 +61,5 @@ zone "catalog4.example" {
1baafe
 
1baafe
 key tsig_key. {
1baafe
 	secret "LSAnCU+Z";
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 };
1baafe
diff --git a/bin/tests/system/catz/ns2/named.conf.in b/bin/tests/system/catz/ns2/named.conf.in
1baafe
index 30333e6..4005152 100644
1baafe
--- a/bin/tests/system/catz/ns2/named.conf.in
1baafe
+++ b/bin/tests/system/catz/ns2/named.conf.in
1baafe
@@ -70,5 +70,5 @@ zone "catalog4.example" {
1baafe
 
1baafe
 key tsig_key. {
1baafe
 	secret "LSAnCU+Z";
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 };
1baafe
diff --git a/bin/tests/system/checkconf/bad-tsig.conf b/bin/tests/system/checkconf/bad-tsig.conf
1baafe
index 21be03e..e57c308 100644
1baafe
--- a/bin/tests/system/checkconf/bad-tsig.conf
1baafe
+++ b/bin/tests/system/checkconf/bad-tsig.conf
1baafe
@@ -11,7 +11,7 @@
1baafe
 
1baafe
 /* Bad secret */
1baafe
 key "badtsig" {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha256;
1baafe
 	secret "jEdD+BPKg==";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/checkconf/good.conf b/bin/tests/system/checkconf/good.conf
1baafe
index e09b9e8..2e824b3 100644
1baafe
--- a/bin/tests/system/checkconf/good.conf
1baafe
+++ b/bin/tests/system/checkconf/good.conf
1baafe
@@ -210,6 +210,6 @@ dyndb "name" "library.so" {
1baafe
 	system;
1baafe
 };
1baafe
 key "mykey" {
1baafe
-	algorithm "hmac-md5";
1baafe
+	algorithm "hmac-sha256";
1baafe
 	secret "qwertyuiopasdfgh";
1baafe
 };
1baafe
diff --git a/bin/tests/system/feature-test.c b/bin/tests/system/feature-test.c
1baafe
index 877504f..577660a 100644
1baafe
--- a/bin/tests/system/feature-test.c
1baafe
+++ b/bin/tests/system/feature-test.c
1baafe
@@ -14,6 +14,7 @@
1baafe
 #include <string.h>
1baafe
 #include <unistd.h>
1baafe
 
1baafe
+#include <isc/md.h>
1baafe
 #include <isc/net.h>
1baafe
 #include <isc/print.h>
1baafe
 #include <isc/util.h>
1baafe
@@ -186,6 +187,19 @@ main(int argc, char **argv) {
1baafe
 #endif /* ifdef DLZ_FILESYSTEM */
1baafe
 	}
1baafe
 
1baafe
+	if (strcmp(argv[1], "--md5") == 0) {
1baafe
+		unsigned char digest[ISC_MAX_MD_SIZE];
1baafe
+		const unsigned char test[] = "test";
1baafe
+		unsigned int size = sizeof(digest);
1baafe
+
1baafe
+		if (isc_md(ISC_MD_MD5, test, sizeof(test),
1baafe
+		           digest, &size) == ISC_R_SUCCESS) {
1baafe
+			return (0);
1baafe
+		} else {
1baafe
+			return (1);
1baafe
+		}
1baafe
+	}
1baafe
+
1baafe
 	if (strcmp(argv[1], "--with-idn") == 0) {
1baafe
 #ifdef HAVE_LIBIDN2
1baafe
 		return (0);
1baafe
diff --git a/bin/tests/system/notify/ns5/named.conf.in b/bin/tests/system/notify/ns5/named.conf.in
1baafe
index 1ee8df4..2b75d9a 100644
1baafe
--- a/bin/tests/system/notify/ns5/named.conf.in
1baafe
+++ b/bin/tests/system/notify/ns5/named.conf.in
1baafe
@@ -10,17 +10,17 @@
1baafe
  */
1baafe
 
1baafe
 key "a" {
1baafe
-	algorithm "hmac-md5";
1baafe
+	algorithm "hmac-sha256";
1baafe
 	secret "aaaaaaaaaaaaaaaaaaaa";
1baafe
 };
1baafe
 
1baafe
 key "b" {
1baafe
-	algorithm "hmac-md5";
1baafe
+	algorithm "hmac-sha256";
1baafe
 	secret "bbbbbbbbbbbbbbbbbbbb";
1baafe
 };
1baafe
 
1baafe
 key "c" {
1baafe
-	algorithm "hmac-md5";
1baafe
+	algorithm "hmac-sha256";
1baafe
 	secret "cccccccccccccccccccc";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/notify/tests.sh b/bin/tests/system/notify/tests.sh
1baafe
index 3d7e0b7..ec4d9a7 100644
1baafe
--- a/bin/tests/system/notify/tests.sh
1baafe
+++ b/bin/tests/system/notify/tests.sh
1baafe
@@ -212,16 +212,16 @@ ret=0
1baafe
 $NSUPDATE << EOF
1baafe
 server 10.53.0.5 ${PORT}
1baafe
 zone x21
1baafe
-key a aaaaaaaaaaaaaaaaaaaa
1baafe
+key hmac-sha256:a aaaaaaaaaaaaaaaaaaaa
1baafe
 update add added.x21 0 in txt "test string"
1baafe
 send
1baafe
 EOF
1baafe
 
1baafe
 for i in 1 2 3 4 5 6 7 8 9
1baafe
 do
1baafe
-	$DIG $DIGOPTS added.x21. -y b:bbbbbbbbbbbbbbbbbbbb @10.53.0.5 \
1baafe
+	$DIG $DIGOPTS added.x21. -y hmac-sha256:b:bbbbbbbbbbbbbbbbbbbb @10.53.0.5 \
1baafe
 		txt > dig.out.b.ns5.test$n || ret=1
1baafe
-	$DIG $DIGOPTS added.x21. -y c:cccccccccccccccccccc @10.53.0.5 \
1baafe
+	$DIG $DIGOPTS added.x21. -y hmac-sha256:c:cccccccccccccccccccc @10.53.0.5 \
1baafe
 		txt > dig.out.c.ns5.test$n || ret=1
1baafe
 	grep "test string" dig.out.b.ns5.test$n > /dev/null &&
1baafe
 	grep "test string" dig.out.c.ns5.test$n > /dev/null &&
1baafe
diff --git a/bin/tests/system/nsupdate/ns1/named.conf.in b/bin/tests/system/nsupdate/ns1/named.conf.in
1baafe
index b51e700..436c97d 100644
1baafe
--- a/bin/tests/system/nsupdate/ns1/named.conf.in
1baafe
+++ b/bin/tests/system/nsupdate/ns1/named.conf.in
1baafe
@@ -37,7 +37,7 @@ controls {
1baafe
 };
1baafe
 
1baafe
 key altkey {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha512;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/nsupdate/ns2/named.conf.in b/bin/tests/system/nsupdate/ns2/named.conf.in
1baafe
index da6b3b4..c547e47 100644
1baafe
--- a/bin/tests/system/nsupdate/ns2/named.conf.in
1baafe
+++ b/bin/tests/system/nsupdate/ns2/named.conf.in
1baafe
@@ -32,7 +32,7 @@ controls {
1baafe
 };
1baafe
 
1baafe
 key altkey {
1baafe
-	algorithm hmac-md5;
1baafe
+	algorithm hmac-sha512;
1baafe
 	secret "1234abcd8765";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/nsupdate/setup.sh b/bin/tests/system/nsupdate/setup.sh
1baafe
index c055da3..4e1242b 100644
1baafe
--- a/bin/tests/system/nsupdate/setup.sh
1baafe
+++ b/bin/tests/system/nsupdate/setup.sh
1baafe
@@ -56,7 +56,11 @@ EOF
1baafe
 
1baafe
 $DDNSCONFGEN -q -z example.nil > ns1/ddns.key
1baafe
 
1baafe
-$DDNSCONFGEN -q -a hmac-md5 -k md5-key -z keytests.nil > ns1/md5.key
1baafe
+if $FEATURETEST --md5; then
1baafe
+	$DDNSCONFGEN -q -a hmac-md5 -k md5-key -z keytests.nil > ns1/md5.key
1baafe
+else
1baafe
+	echo -n > ns1/md5.key
1baafe
+fi
1baafe
 $DDNSCONFGEN -q -a hmac-sha1 -k sha1-key -z keytests.nil > ns1/sha1.key
1baafe
 $DDNSCONFGEN -q -a hmac-sha224 -k sha224-key -z keytests.nil > ns1/sha224.key
1baafe
 $DDNSCONFGEN -q -a hmac-sha256 -k sha256-key -z keytests.nil > ns1/sha256.key
1baafe
diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh
1baafe
index b35d797..41c128e 100755
1baafe
--- a/bin/tests/system/nsupdate/tests.sh
1baafe
+++ b/bin/tests/system/nsupdate/tests.sh
1baafe
@@ -797,7 +797,14 @@ fi
1baafe
 n=`expr $n + 1`
1baafe
 ret=0
1baafe
 echo_i "check TSIG key algorithms (nsupdate -k) ($n)"
1baafe
-for alg in md5 sha1 sha224 sha256 sha384 sha512; do
1baafe
+if $FEATURETEST --md5
1baafe
+then
1baafe
+	ALGS="md5 sha1 sha224 sha256 sha384 sha512"
1baafe
+else
1baafe
+	ALGS="sha1 sha224 sha256 sha384 sha512"
1baafe
+	echo_i "skipping disabled md5 algorithm"
1baafe
+fi
1baafe
+for alg in $ALGS; do
1baafe
     $NSUPDATE -k ns1/${alg}.key <<END > /dev/null || ret=1
1baafe
 server 10.53.0.1 ${PORT}
1baafe
 update add ${alg}.keytests.nil. 600 A 10.10.10.3
1baafe
@@ -805,7 +812,7 @@ send
1baafe
 END
1baafe
 done
1baafe
 sleep 2
1baafe
-for alg in md5 sha1 sha224 sha256 sha384 sha512; do
1baafe
+for alg in $ALGS; do
1baafe
     $DIG $DIGOPTS +short @10.53.0.1 ${alg}.keytests.nil | grep 10.10.10.3 > /dev/null 2>&1 || ret=1
1baafe
 done
1baafe
 if [ $ret -ne 0 ]; then
1baafe
@@ -816,7 +823,7 @@ fi
1baafe
 n=`expr $n + 1`
1baafe
 ret=0
1baafe
 echo_i "check TSIG key algorithms (nsupdate -y) ($n)"
1baafe
-for alg in md5 sha1 sha224 sha256 sha384 sha512; do
1baafe
+for alg in $ALGS; do
1baafe
     secret=$(sed -n 's/.*secret "\(.*\)";.*/\1/p' ns1/${alg}.key)
1baafe
     $NSUPDATE -y "hmac-${alg}:${alg}-key:$secret" <<END > /dev/null || ret=1
1baafe
 server 10.53.0.1 ${PORT}
1baafe
@@ -825,7 +832,7 @@ send
1baafe
 END
1baafe
 done
1baafe
 sleep 2
1baafe
-for alg in md5 sha1 sha224 sha256 sha384 sha512; do
1baafe
+for alg in $ALGS; do
1baafe
     $DIG $DIGOPTS +short @10.53.0.1 ${alg}.keytests.nil | grep 10.10.10.50 > /dev/null 2>&1 || ret=1
1baafe
 done
1baafe
 if [ $ret -ne 0 ]; then
1baafe
diff --git a/bin/tests/system/rndc/setup.sh b/bin/tests/system/rndc/setup.sh
1baafe
index b59e7a7..04d5f5a 100644
1baafe
--- a/bin/tests/system/rndc/setup.sh
1baafe
+++ b/bin/tests/system/rndc/setup.sh
1baafe
@@ -33,7 +33,7 @@ make_key () {
1baafe
             sed 's/allow { 10.53.0.4/allow { any/' >> ns4/named.conf
1baafe
 }
1baafe
 
1baafe
-make_key 1 ${EXTRAPORT1} hmac-md5
1baafe
+$FEATURETEST --md5 && make_key 1 ${EXTRAPORT1} hmac-md5
1baafe
 make_key 2 ${EXTRAPORT2} hmac-sha1
1baafe
 make_key 3 ${EXTRAPORT3} hmac-sha224
1baafe
 make_key 4 ${EXTRAPORT4} hmac-sha256
1baafe
diff --git a/bin/tests/system/rndc/tests.sh b/bin/tests/system/rndc/tests.sh
1baafe
index 9fd84ed..d0b188f 100644
1baafe
--- a/bin/tests/system/rndc/tests.sh
1baafe
+++ b/bin/tests/system/rndc/tests.sh
1baafe
@@ -348,15 +348,20 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
 status=`expr $status + $ret`
1baafe
 
1baafe
 n=`expr $n + 1`
1baafe
-echo_i "testing rndc with hmac-md5 ($n)"
1baafe
-ret=0
1baafe
-$RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key1.conf status > /dev/null 2>&1 || ret=1
1baafe
-for i in 2 3 4 5 6
1baafe
-do
1baafe
-        $RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
1baafe
-done
1baafe
-if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
-status=`expr $status + $ret`
1baafe
+if $FEATURETEST --md5
1baafe
+then
1baafe
+	echo_i "testing rndc with hmac-md5 ($n)"
1baafe
+	ret=0
1baafe
+	$RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key1.conf status > /dev/null 2>&1 || ret=1
1baafe
+	for i in 2 3 4 5 6
1baafe
+	do
1baafe
+		$RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
1baafe
+	done
1baafe
+	if [ $ret != 0 ]; then echo_i "failed"; fi
1baafe
+	status=`expr $status + $ret`
1baafe
+else
1baafe
+	echo_i "skipping rndc with hmac-md5 ($n)"
1baafe
+fi
1baafe
 
1baafe
 n=`expr $n + 1`
1baafe
 echo_i "testing rndc with hmac-sha1 ($n)"
1baafe
diff --git a/bin/tests/system/tsig/ns1/named.conf.in b/bin/tests/system/tsig/ns1/named.conf.in
1baafe
index 3470c4f..cf539cd 100644
1baafe
--- a/bin/tests/system/tsig/ns1/named.conf.in
1baafe
+++ b/bin/tests/system/tsig/ns1/named.conf.in
1baafe
@@ -21,10 +21,7 @@ options {
1baafe
 	notify no;
1baafe
 };
1baafe
 
1baafe
-key "md5" {
1baafe
-	secret "97rnFx24Tfna4mHPfgnerA==";
1baafe
-	algorithm hmac-md5;
1baafe
-};
1baafe
+# md5 key appended by setup.sh at the end
1baafe
 
1baafe
 key "sha1" {
1baafe
 	secret "FrSt77yPTFx6hTs4i2tKLB9LmE0=";
1baafe
@@ -51,10 +48,7 @@ key "sha512" {
1baafe
 	algorithm hmac-sha512;
1baafe
 };
1baafe
 
1baafe
-key "md5-trunc" {
1baafe
-	secret "97rnFx24Tfna4mHPfgnerA==";
1baafe
-	algorithm hmac-md5-80;
1baafe
-};
1baafe
+# md5-trunc key appended by setup.sh at the end
1baafe
 
1baafe
 key "sha1-trunc" {
1baafe
 	secret "FrSt77yPTFx6hTs4i2tKLB9LmE0=";
1baafe
diff --git a/bin/tests/system/tsig/ns1/rndc5.conf.in b/bin/tests/system/tsig/ns1/rndc5.conf.in
1baafe
new file mode 100644
1baafe
index 0000000..0682194
1baafe
--- /dev/null
1baafe
+++ b/bin/tests/system/tsig/ns1/rndc5.conf.in
1baafe
@@ -0,0 +1,10 @@
1baafe
+# Conditionally included when support for MD5 is available
1baafe
+key "md5" {
1baafe
+	secret "97rnFx24Tfna4mHPfgnerA==";
1baafe
+	algorithm hmac-md5;
1baafe
+};
1baafe
+
1baafe
+key "md5-trunc" {
1baafe
+	secret "97rnFx24Tfna4mHPfgnerA==";
1baafe
+	algorithm hmac-md5-80;
1baafe
+};
1baafe
diff --git a/bin/tests/system/tsig/setup.sh b/bin/tests/system/tsig/setup.sh
1baafe
index e3b4a45..ae21d04 100644
1baafe
--- a/bin/tests/system/tsig/setup.sh
1baafe
+++ b/bin/tests/system/tsig/setup.sh
1baafe
@@ -15,3 +15,8 @@ SYSTEMTESTTOP=..
1baafe
 $SHELL clean.sh
1baafe
 
1baafe
 copy_setports ns1/named.conf.in ns1/named.conf
1baafe
+
1baafe
+if $FEATURETEST --md5
1baafe
+then
1baafe
+	cat ns1/rndc5.conf.in >> ns1/named.conf
1baafe
+fi
1baafe
diff --git a/bin/tests/system/tsig/tests.sh b/bin/tests/system/tsig/tests.sh
1baafe
index 38d842a..668aa6f 100644
1baafe
--- a/bin/tests/system/tsig/tests.sh
1baafe
+++ b/bin/tests/system/tsig/tests.sh
1baafe
@@ -26,20 +26,25 @@ sha512="jI/Pa4qRu96t76Pns5Z/Ndxbn3QCkwcxLOgt9vgvnJw5wqTRvNyk3FtD6yIMd1dWVlqZ+Y4f
1baafe
 
1baafe
 status=0
1baafe
 
1baafe
-echo_i "fetching using hmac-md5 (old form)"
1baafe
-ret=0
1baafe
-$DIG $DIGOPTS example.nil. -y "md5:$md5" @10.53.0.1 soa > dig.out.md5.old || ret=1
1baafe
-grep -i "md5.*TSIG.*NOERROR" dig.out.md5.old > /dev/null || ret=1
1baafe
-if [ $ret -eq 1 ] ; then
1baafe
-	echo_i "failed"; status=1
1baafe
-fi
1baafe
+if $FEATURETEST --md5
1baafe
+then
1baafe
+	echo_i "fetching using hmac-md5 (old form)"
1baafe
+	ret=0
1baafe
+	$DIG $DIGOPTS example.nil. -y "md5:$md5" @10.53.0.1 soa > dig.out.md5.old || ret=1
1baafe
+	grep -i "md5.*TSIG.*NOERROR" dig.out.md5.old > /dev/null || ret=1
1baafe
+	if [ $ret -eq 1 ] ; then
1baafe
+		echo_i "failed"; status=1
1baafe
+	fi
1baafe
 
1baafe
-echo_i "fetching using hmac-md5 (new form)"
1baafe
-ret=0
1baafe
-$DIG $DIGOPTS example.nil. -y "hmac-md5:md5:$md5" @10.53.0.1 soa > dig.out.md5.new || ret=1
1baafe
-grep -i "md5.*TSIG.*NOERROR" dig.out.md5.new > /dev/null || ret=1
1baafe
-if [ $ret -eq 1 ] ; then
1baafe
-	echo_i "failed"; status=1
1baafe
+	echo_i "fetching using hmac-md5 (new form)"
1baafe
+	ret=0
1baafe
+	$DIG $DIGOPTS example.nil. -y "hmac-md5:md5:$md5" @10.53.0.1 soa > dig.out.md5.new || ret=1
1baafe
+	grep -i "md5.*TSIG.*NOERROR" dig.out.md5.new > /dev/null || ret=1
1baafe
+	if [ $ret -eq 1 ] ; then
1baafe
+		echo_i "failed"; status=1
1baafe
+	fi
1baafe
+else
1baafe
+	echo_i "skipping using hmac-md5"
1baafe
 fi
1baafe
 
1baafe
 echo_i "fetching using hmac-sha1"
1baafe
@@ -87,12 +92,17 @@ fi
1baafe
 #	Truncated TSIG
1baafe
 #
1baafe
 #
1baafe
-echo_i "fetching using hmac-md5 (trunc)"
1baafe
-ret=0
1baafe
-$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5-trunc:$md5" @10.53.0.1 soa > dig.out.md5.trunc || ret=1
1baafe
-grep -i "md5-trunc.*TSIG.*NOERROR" dig.out.md5.trunc > /dev/null || ret=1
1baafe
-if [ $ret -eq 1 ] ; then
1baafe
-	echo_i "failed"; status=1
1baafe
+if $FEATURETEST --md5
1baafe
+then
1baafe
+	echo_i "fetching using hmac-md5 (trunc)"
1baafe
+	ret=0
1baafe
+	$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5-trunc:$md5" @10.53.0.1 soa > dig.out.md5.trunc || ret=1
1baafe
+	grep -i "md5-trunc.*TSIG.*NOERROR" dig.out.md5.trunc > /dev/null || ret=1
1baafe
+	if [ $ret -eq 1 ] ; then
1baafe
+		echo_i "failed"; status=1
1baafe
+	fi
1baafe
+else
1baafe
+	echo_i "skipping using hmac-md5 (trunc)"
1baafe
 fi
1baafe
 
1baafe
 echo_i "fetching using hmac-sha1 (trunc)"
1baafe
@@ -141,12 +151,17 @@ fi
1baafe
 #	Check for bad truncation.
1baafe
 #
1baafe
 #
1baafe
-echo_i "fetching using hmac-md5-80 (BADTRUNC)"
1baafe
-ret=0
1baafe
-$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5:$md5" @10.53.0.1 soa > dig.out.md5-80 || ret=1
1baafe
-grep -i "md5.*TSIG.*BADTRUNC" dig.out.md5-80 > /dev/null || ret=1
1baafe
-if [ $ret -eq 1 ] ; then
1baafe
-	echo_i "failed"; status=1
1baafe
+if $FEATURETEST --md5
1baafe
+then
1baafe
+	echo_i "fetching using hmac-md5-80 (BADTRUNC)" 
1baafe
+	ret=0
1baafe
+	$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5:$md5" @10.53.0.1 soa > dig.out.md5-80 || ret=1
1baafe
+	grep -i "md5.*TSIG.*BADTRUNC" dig.out.md5-80 > /dev/null || ret=1
1baafe
+	if [ $ret -eq 1 ] ; then
1baafe
+		echo_i "failed"; status=1
1baafe
+	fi
1baafe
+else
1baafe
+	echo_i "skipping using hmac-md5-80 (BADTRUNC)" 
1baafe
 fi
1baafe
 
1baafe
 echo_i "fetching using hmac-sha1-80 (BADTRUNC)"
1baafe
diff --git a/bin/tests/system/upforwd/ns1/named.conf.in b/bin/tests/system/upforwd/ns1/named.conf.in
1baafe
index 3873c7c..b359a5a 100644
1baafe
--- a/bin/tests/system/upforwd/ns1/named.conf.in
1baafe
+++ b/bin/tests/system/upforwd/ns1/named.conf.in
1baafe
@@ -10,7 +10,7 @@
1baafe
  */
1baafe
 
1baafe
 key "update.example." {
1baafe
-	algorithm "hmac-md5";
1baafe
+	algorithm "hmac-sha256";
1baafe
 	secret "c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";
1baafe
 };
1baafe
 
1baafe
diff --git a/bin/tests/system/upforwd/tests.sh b/bin/tests/system/upforwd/tests.sh
1baafe
index a50c896..8062d68 100644
1baafe
--- a/bin/tests/system/upforwd/tests.sh
1baafe
+++ b/bin/tests/system/upforwd/tests.sh
1baafe
@@ -79,7 +79,7 @@ if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
1baafe
 
1baafe
 echo_i "updating zone (signed) ($n)"
1baafe
 ret=0
1baafe
-$NSUPDATE -y update.example:c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K -- - <
1baafe
+$NSUPDATE -y hmac-sha256:update.example:c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K -- - <
1baafe
 server 10.53.0.3 ${PORT}
1baafe
 update add updated.example. 600 A 10.10.10.1
1baafe
 update add updated.example. 600 TXT Foo
1baafe
-- 
1baafe
2.26.2
1baafe