]> 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 10910/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 11:40:45 +0000 (13:40 +0200)
(cherry picked from commit a660ce6dbfc4182922eea8e548eb504af31b6cc1)

pdns/recursordist/test-syncres_cc9.cc
pdns/syncres.cc

index 9bf28ac3cb9a9f1b6b2c9b6a17be12c9ea9fac37..03f8b05c2d13fb3ffc5c2e73290e36f8a227abab 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 b4e064faaefe3a29aa9c4f4543a1779d9b51ba21..2463b89fed857fe40265863945b4af1d273aa632 100644 (file)
@@ -2482,10 +2482,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 {