Commit 523b6afe authored by Daniel Salzman's avatar Daniel Salzman

libdnssec: add dnssec_nsec3_params_match

parent 1fff9a65
......@@ -56,6 +56,7 @@ libdnssec.so.6 libdnssec6 #MINVER#
dnssec_nsec3_hash_length@Base 2.3.0
dnssec_nsec3_params_free@Base 2.3.0
dnssec_nsec3_params_from_rdata@Base 2.3.0
dnssec_nsec3_params_match@Base 2.8.0
dnssec_nsec_bitmap_add@Base 2.3.0
dnssec_nsec_bitmap_clear@Base 2.3.0
dnssec_nsec_bitmap_contains@Base 2.7.0
......
......@@ -279,10 +279,7 @@ static bool zone_update_changed_nsec3param(const zone_update_t *update)
dnssec_nsec3_params_t *orig = &update->zone->contents->nsec3_params;
dnssec_nsec3_params_t *upd = &update->new_cont->nsec3_params;
return (orig->algorithm == upd->algorithm &&
orig->iterations == upd->iterations &&
orig->flags == upd->flags &&
dnssec_binary_cmp(&orig->salt, &upd->salt) == 0);
return dnssec_nsec3_params_match(orig, upd);
}
const knot_rdataset_t *zone_update_from(zone_update_t *update)
......
/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -139,6 +139,17 @@ void dnssec_nsec3_params_free(dnssec_nsec3_params_t *params);
int dnssec_nsec3_params_from_rdata(dnssec_nsec3_params_t *params,
const dnssec_binary_t *rdata);
/*!
* Check if NSEC3 parameters match.
*
* \param params1 NSEC3 parameters 1.
* \param params2 NSEC3 parameters 2.
*
* \return True if match or if both NULL.
*/
bool dnssec_nsec3_params_match(const dnssec_nsec3_params_t *params1,
const dnssec_nsec3_params_t *params2);
/*!
* Check whether a given NSEC bitmap contains a given RR type.
*
......
......@@ -114,3 +114,17 @@ bool dnssec_nsec_bitmap_contains(const uint8_t *bitmap, uint16_t size, uint16_t
return false;
}
_public_
bool dnssec_nsec3_params_match(const dnssec_nsec3_params_t *params1,
const dnssec_nsec3_params_t *params2)
{
if (params1 != NULL && params2 != NULL) {
return (params1->algorithm == params2->algorithm &&
params1->flags == params2->flags &&
params1->iterations == params2->iterations &&
dnssec_binary_cmp(&params1->salt, &params2->salt) == 0);
} else {
return (params1 == NULL && params2 == NULL);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment