]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
A SHA-384 DS should not trump a SHA-256 one, so only potentially zap SHA-1 10908/head
authorOtto <otto.moerbeek@open-xchange.com>
Wed, 27 Oct 2021 10:01:09 +0000 (12:01 +0200)
committerOtto <otto.moerbeek@open-xchange.com>
Wed, 27 Oct 2021 10:01:09 +0000 (12:01 +0200)
pdns/recursordist/test-syncres_cc9.cc
pdns/syncres.cc

index d296f25bf4e58801ab903f8fbc9df77b0de44c71..48094541e53cd2e1ce92b5658d88f3543da7c42d 100644 (file)
@@ -819,9 +819,9 @@ BOOST_AUTO_TEST_CASE(test_getDSRecords_multialgo_all_sha)
   dsmap_t ds;
   auto state = sr->getDSRecords(target, ds, false, 0, false);
   BOOST_CHECK_EQUAL(state, vState::Secure);
-  BOOST_REQUIRE_EQUAL(ds.size(), 1U);
+  BOOST_REQUIRE_EQUAL(ds.size(), 2U);
   for (const auto& i : ds) {
-    BOOST_CHECK_EQUAL(i.d_digesttype, DNSSECKeeper::DIGEST_SHA384);
+    BOOST_CHECK(i.d_digesttype == DNSSECKeeper::DIGEST_SHA384 || i.d_digesttype == DNSSECKeeper::DIGEST_SHA256);
   }
 }
 
index e962cf7fea1fda58d7e9e08743a9a33be95d4325..2740d452f417a38c3233e84aa974bbb323e17f33 100644 (file)
@@ -2585,10 +2585,10 @@ vState SyncRes::getDSRecords(const DNSName& zone, dsmap_t& ds, bool taOnly, unsi
 
     /* RFC 4509 section 3: "Validator implementations SHOULD ignore DS RRs containing SHA-1
      * digests if DS RRs with SHA-256 digests are present in the DS RRset."
-     * As SHA348 is specified as well, the spirit of the this line is "use the best algorithm".
+     * We interpret that as: do not use SHA-1 if SHA-256 or SHA-384 is available
      */
     for (auto dsrec = ds.begin(); dsrec != ds.end(); ) {
-      if (dsrec->d_digesttype != bestDigestType) {
+      if (dsrec->d_digesttype == DNSSECKeeper::DIGEST_SHA1 && dsrec->d_digesttype != bestDigestType) {
         dsrec = ds.erase(dsrec);
       }
       else {