Check if zlib is compatible.
Add a --zlib_fingerprint flag in delta_generator to check if the zlib of
source image is compatible, and only enable IMGDIFF operation if it is.
Test: Added unittest to check /etc/zlib_fingerprint
Bug: 27156099
Change-Id: Ida346a99430c95cdc8a43e1055d6efa08f07ca25
diff --git a/payload_consumer/payload_constants.h b/payload_consumer/payload_constants.h
index 76d740f..2dbc5fa 100644
--- a/payload_consumer/payload_constants.h
+++ b/payload_consumer/payload_constants.h
@@ -56,6 +56,15 @@
extern const char kBspatchPath[];
extern const char kDeltaMagic[4];
+// The list of compatible SHA256 hashes of zlib source code.
+// This is used to check if the source image have a compatible zlib (produce
+// same compressed result given the same input).
+// When a new fingerprint is found, please examine the changes in zlib source
+// carefully and determine if it's still compatible with previous version, if
+// yes then add the new fingerprint to this array, otherwise remove all previous
+// fingerprints in the array first, and only include the new fingerprint.
+extern const char kCompatibleZlibFingerprint[2][65];
+
// A block number denoting a hole on a sparse file. Used on Extents to refer to
// section of blocks not present on disk on a sparse file.
const uint64_t kSparseHole = std::numeric_limits<uint64_t>::max();