From 035609cd6be6ecd122ab70b2ac8027161a057cba Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sun, 16 Feb 2020 03:35:13 +0300 Subject: [PATCH] OcCompressionLib: Sync zlib up to d71dc66fa8a153fb6e7c626847095d9697a6cf42 --- Library/OcCompressionLib/zlib/crc32.c | 2 +- Library/OcCompressionLib/zlib/zlib.h | 12 +++++++----- Library/OcCompressionLib/zlib/zlib_uefi.c | 4 ---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Library/OcCompressionLib/zlib/crc32.c b/Library/OcCompressionLib/zlib/crc32.c index 7503972b..62cb9fe3 100644 --- a/Library/OcCompressionLib/zlib/crc32.c +++ b/Library/OcCompressionLib/zlib/crc32.c @@ -224,7 +224,7 @@ local once_t made = ONCE_INIT; is just exclusive-or, and multiplying a polynomial by x is a right shift by one. If we call the above polynomial p, and represent a byte as the polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + byte 0xb1 is the polynomial x^7+x^3+x^2+1), then the CRC is (q*x^32) mod p, where a mod b means the remainder after dividing a by b. This calculation is done using the shift-register method of multiplying and diff --git a/Library/OcCompressionLib/zlib/zlib.h b/Library/OcCompressionLib/zlib/zlib.h index d33db136..18ce4331 100644 --- a/Library/OcCompressionLib/zlib/zlib.h +++ b/Library/OcCompressionLib/zlib/zlib.h @@ -1690,8 +1690,9 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. + return the updated checksum. An Adler-32 value is in the range of a 32-bit + unsigned integer. If buf is Z_NULL, this function returns the required + initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed much faster. @@ -1727,9 +1728,10 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. + updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. + If buf is Z_NULL, this function returns the required initial value for the + crc. Pre- and post-conditioning (one's complement) is performed within this + function so it shouldn't be done by the application. Usage example: diff --git a/Library/OcCompressionLib/zlib/zlib_uefi.c b/Library/OcCompressionLib/zlib/zlib_uefi.c index ac21404c..380ad77d 100644 --- a/Library/OcCompressionLib/zlib/zlib_uefi.c +++ b/Library/OcCompressionLib/zlib/zlib_uefi.c @@ -34,8 +34,6 @@ void ZLIB_INTERNAL zcfree (opaque, ptr) FreePool (ptr); } -#ifndef OC_USE_SSH_ZLIB - UINT8 * CompressZLIB ( OUT UINT8 *Dst, @@ -77,5 +75,3 @@ DecompressZLIB ( return 0; } - -#endif // OC_USE_SSH_ZLIB