size_t i;
struct regional* region = NULL;
struct sldns_buffer* buf = NULL;
- char zstr[255+1];
uint32_t soa_serial = 0;
region = env->scratch;
regional_free_all(region);
hash, hashlen, region, buf, reason)) {
/* success */
if(verbosity >= VERB_ALGO) {
+ char zstr[255+1];
dname_str(z->name, zstr);
verbose(VERB_ALGO, "auth-zone %s ZONEMD hash is correct", zstr);
}
/* fail, we may have reason */
if(!*reason)
*reason = "no ZONEMD records found";
- dname_str(z->name, zstr);
- verbose(VERB_ALGO, "auth-zone %s ZONEMD failed: %s", zstr, *reason);
+ if(verbosity >= VERB_ALGO) {
+ char zstr[255+1];
+ dname_str(z->name, zstr);
+ verbose(VERB_ALGO, "auth-zone %s ZONEMD failed: %s", zstr, *reason);
+ }
return 0;
}
static void zonemd_verify_tests(void)
{
unit_show_func("services/authzone.c", "auth_zone_verify_zonemd");
+ /* give trustanchor for unsigned zone, should fail */
zonemd_verify_test("example.org",
"testdata/zonemd.example1.zone",
"example.org. IN DS 55566 8 2 9c148338951ce1c3b5cd3da532f3d90dfcf92595148022f2c2fd98e5deee90af",
"20180302005009",
"verify DNSKEY RRset with trust anchor failed: have trust anchor, but zone has no DNSKEY");
+ /* unsigned zone without ZONEMD in it */
zonemd_verify_test("example.org",
"testdata/zonemd.example1.zone",
NULL,
"20180302005009",
"no ZONEMD present");
- /* no trust anchor, so it succeeds */
+ /* no trust anchor, so it succeeds for zone with a correct ZONEMD */
zonemd_verify_test("example.com",
"testdata/zonemd.example2.zone",
NULL,
"ZONEMD verification successful");
/* load a DNSSEC signed zone, but no trust anchor */
+ /* this zonefile has an incorrect ZONEMD digest, with correct
+ * DNSSEC signature. */
zonemd_verify_test("example.com",
"testdata/zonemd.example3.zone",
NULL,
"20180302005009",
"incorrect digest");
/* load a DNSSEC zone with NSEC3, but no trust anchor */
+ /* this zonefile has an incorrect ZONEMD digest, with correct
+ * DNSSEC signature. */
zonemd_verify_test("example.com",
"testdata/zonemd.example4.zone",
NULL,
"20180302005009",
"incorrect digest");
/* valid zonemd, in dnssec signed zone, no trust anchor*/
+ /* this zonefile has a correct ZONEMD digest and
+ * correct DNSSEC signature */
zonemd_verify_test("example.com",
"testdata/zonemd.example5.zone",
NULL,