Check CPL hash in the PKL on verify.
authorCarl Hetherington <cth@carlh.net>
Sun, 6 Jan 2019 01:02:38 +0000 (01:02 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 6 Jan 2019 01:02:38 +0000 (01:02 +0000)
src/verify.cc

index 984cdf4a8841eb00aa2ef4b32d327c4d97980a0f..bd61124c779303b9dad05ea2b766da1448706e35 100644 (file)
@@ -115,6 +115,15 @@ dcp::verify (vector<boost::filesystem::path> directories, function<void (string,
 
                BOOST_FOREACH (shared_ptr<CPL> cpl, dcp->cpls()) {
                        stage ("Checking CPL", cpl->file());
+
+                       /* Check that the CPL's hash corresponds to the PKL */
+                       BOOST_FOREACH (shared_ptr<PKL> i, dcp->pkls()) {
+                               optional<string> h = i->hash(cpl->id());
+                               if (h && make_digest(Data(*cpl->file())) != *h) {
+                                       notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, "CPL hash is incorrect."));
+                               }
+                       }
+
                        BOOST_FOREACH (shared_ptr<Reel> reel, cpl->reels()) {
                                stage ("Checking reel", optional<boost::filesystem::path>());
                                if (reel->main_picture()) {