Commit 6698e1109c for bind

commit 6698e1109cba41ccee312ba9fecf4e900acd1ba9
Author: Michal Nowak <mnowak@isc.org>
Date:   Fri Oct 9 15:42:06 2026 +0000

    Compute the forged NSEC3 hash with dns.dnssec.nsec3_hash()

    dnspython 2.0.0 added dns.dnssec.nsec3_hash(), so the
    rrsig-labels-signer server no longer needs its own SHA-1 NSEC3 hash
    implementation.  The server still adjusts the raw hash by one to forge
    the covering NSEC3 record, so the base32hex result is decoded back to
    bytes.

    Assisted-by: Claude:claude-opus-5-5

diff --git a/bin/tests/system/dnssec_py/ans4/rrsig_labels_signer_ans.py b/bin/tests/system/dnssec_py/ans4/rrsig_labels_signer_ans.py
index f4bcdac833..0960843b8a 100644
--- a/bin/tests/system/dnssec_py/ans4/rrsig_labels_signer_ans.py
+++ b/bin/tests/system/dnssec_py/ans4/rrsig_labels_signer_ans.py
@@ -37,11 +37,11 @@ from collections.abc import AsyncGenerator
 from pathlib import Path

 import base64
-import hashlib
 import logging
 import time

 from cryptography.hazmat.primitives import serialization
+from dns.dnssectypes import NSEC3Hash
 from dns.rdtypes.dnskeybase import Flag

 import dns.dnssec
@@ -71,14 +71,6 @@ def _to_b32hex_lower(data: bytes) -> str:
     return base64.b32hexencode(data).decode().rstrip("=").lower()


-def _nsec3_sha1(name: str) -> bytes:
-    """
-    SHA-1 NSEC3 hash of name (0 iterations, empty salt).
-    """
-    wire = dns.name.from_text(name).canonicalize().to_wire()
-    return hashlib.sha1(wire).digest()
-
-
 def _inc_bytes(b: bytes) -> bytes:
     out = bytearray(b)
     for i in range(len(out) - 1, -1, -1):
@@ -176,7 +168,11 @@ class AttackerZoneHandler(ResponseHandler):

         # NSEC3 covering hash(attacker.rrsig-labels-signer.) for the
         # NEEDNOQNAME proof (validator.c:findnsec3proofs).
-        h = _nsec3_sha1(ZONE_NAME)
+        h = base64.b32hexdecode(
+            dns.dnssec.nsec3_hash(
+                ZONE_NAME, salt=b"", iterations=0, algorithm=NSEC3Hash.SHA1
+            )
+        )
         h_owner = _dec_bytes(h)  # owner hash just below target
         h_next = _inc_bytes(h)  # next  hash just above target

@@ -184,7 +180,7 @@ class AttackerZoneHandler(ResponseHandler):
         nsec3_rdata = dns.rdtypes.ANY.NSEC3.NSEC3(
             rdclass=dns.rdataclass.IN,
             rdtype=dns.rdatatype.NSEC3,
-            algorithm=1,  # SHA-1
+            algorithm=NSEC3Hash.SHA1,
             flags=0,
             iterations=0,
             salt=b"",