From: Remi Gacogne Date: Mon, 23 May 2022 11:22:47 +0000 (+0200) Subject: auth: Rename the function computing the hash of public keys X-Git-Tag: dnsdist-1.8.0-rc1~98^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b60fb4a95cc672b95290173bda4ffd2d0f9d4e13;p=thirdparty%2Fpdns.git auth: Rename the function computing the hash of public keys As suggested by Fred Morcos (thanks!). --- diff --git a/pdns/dnssecsigner.cc b/pdns/dnssecsigner.cc index 7734a5901f..ded10a7106 100644 --- a/pdns/dnssecsigner.cc +++ b/pdns/dnssecsigner.cc @@ -40,7 +40,7 @@ static int g_cacheweekno; const static std::set 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 lookup(hashPublicKey(drc.d_key), getLookupKey(msg)); // this hash is a memory saving exercise + pair 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()) {