]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: Rename the function computing the hash of public keys
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 23 May 2022 11:22:47 +0000 (13:22 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 12 Jan 2023 13:39:10 +0000 (14:39 +0100)
As suggested by Fred Morcos (thanks!).

pdns/dnssecsigner.cc

index 7734a5901f6b84d94da1eeb92d4764872bf31370..ded10a710698b93978f1b8a2e2ebd401fa12831c 100644 (file)
@@ -40,7 +40,7 @@ static int g_cacheweekno;
 const static std::set<uint16_t> g_KSKSignedQTypes {QType::DNSKEY, QType::CDS, QType::CDNSKEY};
 AtomicCounter* g_signatureCount;
 
-static std::string getLookupKey(const std::string& msg)
+static std::string getLookupKeyFromMessage(const std::string& msg)
 {
   try {
     return pdns_md5(msg);
@@ -50,10 +50,10 @@ static std::string getLookupKey(const std::string& msg)
   }
 }
 
-static std::string hashPublicKey(const std::string& pubKey)
+static std::string getLookupKeyFromPublicKey(const std::string& pubKey)
 {
   /* arbitrarily cut off at 64 bytes, the main idea is to save space
-     for very large keys like RSA ones (1024+ bytes) by storing a 20 bytes hash
+     for very large keys like RSA ones (1024+ bits so 128+ bytes) by storing a 20 bytes hash
      instead */
   if (pubKey.size() <= 64) {
     return pubKey;
@@ -72,11 +72,10 @@ static void fillOutRRSIG(DNSSECPrivateKey& dpk, const DNSName& signQName, RRSIGR
   rrc.d_algorithm = drc.d_algorithm;
 
   string msg = getMessageForRRSET(signQName, rrc, toSign); // this is what we will hash & sign
-  pair<string, string> lookup(hashPublicKey(drc.d_key), getLookupKey(msg));  // this hash is a memory saving exercise
+  pair<string, string> lookup(getLookupKeyFromPublicKey(drc.d_key), getLookupKeyFromMessage(msg));  // this hash is a memory saving exercise
 
-  bool doCache=true;
-  if(doCache)
-  {
+  bool doCache = true;
+  if (doCache) {
     auto signatures = g_signatures.read_lock();
     signaturecache_t::const_iterator iter = signatures->find(lookup);
     if (iter != signatures->end()) {