Parcourir la source

libdpkg: Use CRC64 for xz integrity checks

This is the default CRC used by the xz command-line tool, align with
it and switch from CRC32 to CRC64. It should provide slightly better
detection against damaged data, at a negligible speed difference.
Guillem Jover il y a 11 ans
Parent
commit
777915108d
2 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 3 0
      debian/changelog
  2. 1 1
      lib/dpkg/compress.c

+ 3 - 0
debian/changelog

@@ -17,6 +17,9 @@ dpkg (1.18.2) UNRELEASED; urgency=low
   * Use string_to_security_class() instead of a literal SECCLASS value in
     the setexecfilecon() libcompat function, as <selinux/flask.h> is now
     deprecated.
+  * Switch libdpkg xz compressor to use CRC64 for integrity checks, to match
+    the default on the command-line tool, which should provide slightly better
+    detection against damaged data, at a negligible speed difference.
   * Perl modules:
     - Remove non-functional timezone name support from
       Dpkg::Changelog::Entry::Debian.

+ 1 - 1
lib/dpkg/compress.c

@@ -534,7 +534,7 @@ filter_xz_init(struct io_lzma *io, lzma_stream *s)
 	preset = io->params->level;
 	if (io->params->strategy == COMPRESSOR_STRATEGY_EXTREME)
 		preset |= LZMA_PRESET_EXTREME;
-	ret = lzma_easy_encoder(s, preset, LZMA_CHECK_CRC32);
+	ret = lzma_easy_encoder(s, preset, LZMA_CHECK_CRC64);
 	if (ret != LZMA_OK)
 		filter_lzma_error(io, ret);
 }