Browse Source

[2218] Use the new NSEC3Hash::create() variant passing the uint8_t buffer directly

Mukund Sivaraman 12 years ago
parent
commit
42dc5ad3e7
1 changed files with 5 additions and 9 deletions
  1. 5 9
      src/lib/datasrc/memory/zone_finder.cc

+ 5 - 9
src/lib/datasrc/memory/zone_finder.cc

@@ -646,23 +646,19 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) {
     // Convenient shortcuts
     const unsigned int olabels = getOrigin().getLabelCount();
     const unsigned int qlabels = name.getLabelCount();
-
     // placeholder of the next closer proof
     const ZoneNode* covering_node(NULL);
-
     ZoneChain chain;
+    const boost::scoped_ptr<NSEC3Hash> hash
+        (NSEC3Hash::create(nsec3_data->hashalg,
+                           nsec3_data->iterations,
+                           nsec3_data->getSaltData(),
+                           nsec3_data->getSaltLen()));
 
     // Examine all names from the query name to the origin name, stripping
     // the deepest label one by one, until we find a name that has a matching
     // NSEC3 hash.
     for (unsigned int labels = qlabels; labels >= olabels; --labels) {
-        const std::vector<uint8_t> salt(nsec3_data->getSaltData(),
-                                        (nsec3_data->getSaltData() +
-                                         nsec3_data->getSaltLen()));
-        const boost::scoped_ptr<NSEC3Hash> hash
-            (NSEC3Hash::create(nsec3_data->hashalg,
-                               nsec3_data->iterations,
-                               salt));
         const Name& hname = (labels == qlabels ?
                              name : name.split(qlabels - labels, labels));
         const std::string hlabel = hash->calculate(hname);