BIND 10 trac2268, updated. 25cd191443ffd0cffc036c53a0ff57ad2391cead [2268] Make all hash related checks use isc::dns::NSEC3Hash

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Oct 3 17:13:44 UTC 2012


The branch, trac2268 has been updated
       via  25cd191443ffd0cffc036c53a0ff57ad2391cead (commit)
      from  e01716291c402d11710387fa6a9b2cfcd8e3953f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 25cd191443ffd0cffc036c53a0ff57ad2391cead
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Oct 3 22:42:26 2012 +0530

    [2268] Make all hash related checks use isc::dns::NSEC3Hash
    
    This is possible now as we have the new NSEC3Hash::create() variant.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/memory/zone_data_updater.cc |   22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_data_updater.cc b/src/lib/datasrc/memory/zone_data_updater.cc
index f704263..45c985e 100644
--- a/src/lib/datasrc/memory/zone_data_updater.cc
+++ b/src/lib/datasrc/memory/zone_data_updater.cc
@@ -16,6 +16,9 @@
 #include <datasrc/zone.h>
 
 #include <dns/rdataclass.h>
+#include <dns/nsec3hash.h>
+
+#include <boost/scoped_ptr.hpp>
 
 using namespace isc::dns;
 using namespace isc::dns::rdata;
@@ -243,20 +246,13 @@ ZoneDataUpdater::setupNSEC3(const ConstRRsetPtr rrset) {
         zone_data_.setNSEC3Data(nsec3_data);
         zone_data_.setSigned(true);
     } else {
-        size_t salt_len = nsec3_data->getSaltLen();
-        const uint8_t* salt_data = nsec3_data->getSaltData();
-        const std::vector<uint8_t>& salt_data_2 = nsec3_rdata.getSalt();
-
-        if ((nsec3_rdata.getHashalg() != nsec3_data->hashalg) ||
-            (nsec3_rdata.getIterations() != nsec3_data->iterations) ||
-            (salt_data_2.size() != salt_len)) {
-            isc_throw(AddError,
-                      rrset->getType() << " with inconsistent parameters: "
-                      << rrset->toText());
-        }
+        const boost::scoped_ptr<NSEC3Hash> hash
+            (NSEC3Hash::create(nsec3_data->hashalg,
+                               nsec3_data->iterations,
+                               nsec3_data->getSaltData(),
+                               nsec3_data->getSaltLen()));
 
-        if ((salt_len > 0) &&
-            (std::memcmp(&salt_data_2[0], salt_data, salt_len) != 0)) {
+        if (!hash->match(nsec3_rdata)) {
             isc_throw(AddError,
                       rrset->getType() << " with inconsistent parameters: "
                       << rrset->toText());



More information about the bind10-changes mailing list