]> 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 10912/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:47:56 +0000 (13:47 +0200)
(cherry picked from commit a660ce6dbfc4182922eea8e548eb504af31b6cc1)

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 bdecf625425449fb4a2b195d8e0abc3d73cdf14d..78ca2da00c988f5b03c33a518e80d64c41064f5e 100644 (file)
@@ -2562,10 +2562,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 {