]> granicus.if.org Git - pdns/commitdiff
enable function to hash qnames w/o having the NSEC3PARAM ready
authorbert hubert <bert.hubert@netherlabs.nl>
Wed, 27 Apr 2016 13:10:17 +0000 (15:10 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Wed, 27 Apr 2016 13:10:17 +0000 (15:10 +0200)
pdns/dnssecinfra.cc
pdns/dnssecinfra.hh

index 7c59814d6a1d64d0f39d6840273fc585c1266cb6..a7bebe03fe6ffad0c8dfa06829231f89d55bf2ac 100644 (file)
@@ -404,12 +404,17 @@ uint32_t getStartOfWeek()
 
 string hashQNameWithSalt(const NSEC3PARAMRecordContent& ns3prc, const DNSName& qname)
 {
-  unsigned int times = ns3prc.d_iterations;
+  return hashQNameWithSalt(ns3prc.d_salt, ns3prc.d_iterations, qname);
+}
+
+string hashQNameWithSalt(const std::string& salt, unsigned int iterations, const DNSName& qname)
+{
+  unsigned int times = iterations;
   unsigned char hash[20];
   string toHash(qname.toDNSStringLC());
 
   for(;;) {
-    toHash.append(ns3prc.d_salt);
+    toHash.append(salt);
     SHA1((unsigned char*)toHash.c_str(), toHash.length(), hash);
     toHash.assign((char*)hash, sizeof(hash));
     if(!times--)
index e0d15335e1cbb646d6fbe581c844d21cd2caa989..bd95b439b07c2a3f3cf9b25408e57a4ed73c2c0d 100644 (file)
@@ -127,6 +127,7 @@ int getRRSIGsForRRSET(DNSSECKeeper& dk, const DNSName& signer, const DNSName sig
   vector<shared_ptr<DNSRecordContent> >& toSign, vector<RRSIGRecordContent> &rrc);
 
 string hashQNameWithSalt(const NSEC3PARAMRecordContent& ns3prc, const DNSName& qname);
+string hashQNameWithSalt(const std::string& salt, unsigned int iterations, const DNSName& qname);
 void decodeDERIntegerSequence(const std::string& input, vector<string>& output);
 class DNSPacket;
 void addRRSigs(DNSSECKeeper& dk, UeberBackend& db, const std::set<DNSName>& authMap, vector<DNSResourceRecord>& rrs);