| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8206f6b commit 70a0510
32 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -274,7 +274,6 @@ source_set("zlib_slide_hash_simd") { | |||
| 274 | 274 | config("zlib_warnings") { | |
| 275 | 275 | if (is_clang) { | |
| 276 | 276 | cflags = [ | |
| 277 | - "-Wno-deprecated-non-prototype", | ||
| 278 | 277 | "-Wno-incompatible-pointer-types", | |
| 279 | 278 | "-Wunused-variable", | |
| 280 | 279 | ] | |
@@ -380,7 +379,6 @@ config("minizip_warnings") { | |||
| 380 | 379 | cflags = [ | |
| 381 | 380 | # zlib uses `if ((a == b))` for some reason. | |
| 382 | 381 | "-Wno-parentheses-equality", | |
| 383 | - "-Wno-deprecated-non-prototype", | ||
| 384 | 382 | ] | |
| 385 | 383 | } | |
| 386 | 384 | } | |
@@ -452,8 +450,6 @@ if (!is_win || target_os != "winuwp") { | |||
| 452 | 450 | if (is_clang) { | |
| 453 | 451 | cflags = [ | |
| 454 | 452 | "-Wno-incompatible-pointer-types-discards-qualifiers", | |
| 455 | - | ||
| 456 | - "-Wno-deprecated-non-prototype", | ||
| 457 | 453 | ] | |
| 458 | 454 | } | |
| 459 | 455 | ||
@@ -476,7 +472,6 @@ if (!is_win || target_os != "winuwp") { | |||
| 476 | 472 | if (is_clang) { | |
| 477 | 473 | cflags = [ | |
| 478 | 474 | "-Wno-incompatible-pointer-types-discards-qualifiers", | |
| 479 | - "-Wno-deprecated-non-prototype", | ||
| 480 | 475 | ] | |
| 481 | 476 | } | |
| 482 | 477 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,32 +25,55 @@ option(ENABLE_SIMD_OPTIMIZATIONS "Enable all SIMD optimizations" OFF) | |||
| 25 | 25 | option(ENABLE_SIMD_AVX512 "Enable SIMD AXV512 optimizations" OFF) | |
| 26 | 26 | option(USE_ZLIB_RABIN_KARP_HASH "Enable bitstream compatibility with canonical zlib" OFF) | |
| 27 | 27 | option(BUILD_UNITTESTS "Enable standalone unit tests build" OFF) | |
| 28 | + option(BUILD_MINIZIP_BIN "Enable building minzip_bin tool" OFF) | ||
| 28 | 29 | ||
| 29 | 30 | if (USE_ZLIB_RABIN_KARP_HASH) | |
| 30 | 31 | add_definitions(-DUSE_ZLIB_RABIN_KARP_ROLLING_HASH) | |
| 31 | 32 | endif() | |
| 32 | 33 | ||
| 33 | - # TODO(cavalcantii): add support for other OSes (e.g. Android, fuchsia, osx) | ||
| 34 | - # and architectures (e.g. Arm). | ||
| 34 | + # TODO(cavalcantii): add support for other OSes (e.g. Android, Fuchsia, etc) | ||
| 35 | + # and architectures (e.g. RISCV). | ||
| 35 | 36 | if (ENABLE_SIMD_OPTIMIZATIONS) | |
| 36 | - add_definitions(-DINFLATE_CHUNK_SIMD_SSE2) | ||
| 37 | - add_definitions(-DADLER32_SIMD_SSSE3) | ||
| 38 | - add_definitions(-DINFLATE_CHUNK_READ_64LE) | ||
| 39 | - add_definitions(-DCRC32_SIMD_SSE42_PCLMUL) | ||
| 40 | - if (ENABLE_SIMD_AVX512) | ||
| 41 | - add_definitions(-DCRC32_SIMD_AVX512_PCLMUL) | ||
| 42 | - add_compile_options(-mvpclmulqdq -msse2 -mavx512f -mpclmul) | ||
| 43 | - else() | ||
| 44 | - add_compile_options(-msse4.2 -mpclmul) | ||
| 45 | - endif() | ||
| 46 | - add_definitions(-DDEFLATE_SLIDE_HASH_SSE2) | ||
| 47 | - # Required by CPU features detection code. | ||
| 48 | - add_definitions(-DX86_NOT_WINDOWS) | ||
| 49 | - # Apparently some environments (e.g. CentOS) require to explicitly link | ||
| 50 | - # with pthread and that is required by the CPU features detection code. | ||
| 51 | - find_package (Threads REQUIRED) | ||
| 52 | - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") | ||
| 53 | - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") | ||
| 37 | + # Apparently some environments (e.g. CentOS) require to explicitly link | ||
| 38 | + # with pthread and that is required by the CPU features detection code. | ||
| 39 | + find_package (Threads REQUIRED) | ||
| 40 | + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") | ||
| 41 | + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") | ||
| 42 | + | ||
| 43 | + if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") | ||
| 44 | + add_definitions(-DINFLATE_CHUNK_SIMD_SSE2) | ||
| 45 | + add_definitions(-DADLER32_SIMD_SSSE3) | ||
| 46 | + add_definitions(-DINFLATE_CHUNK_READ_64LE) | ||
| 47 | + add_definitions(-DCRC32_SIMD_SSE42_PCLMUL) | ||
| 48 | + if (ENABLE_SIMD_AVX512) | ||
| 49 | + add_definitions(-DCRC32_SIMD_AVX512_PCLMUL) | ||
| 50 | + add_compile_options(-mvpclmulqdq -msse2 -mavx512f -mpclmul) | ||
| 51 | + else() | ||
| 52 | + add_compile_options(-msse4.2 -mpclmul) | ||
| 53 | + endif() | ||
| 54 | + add_definitions(-DDEFLATE_SLIDE_HASH_SSE2) | ||
| 55 | + # Required by CPU features detection code. | ||
| 56 | + add_definitions(-DX86_NOT_WINDOWS) | ||
| 57 | + endif() | ||
| 58 | + | ||
| 59 | + if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") OR | ||
| 60 | + (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")) | ||
| 61 | + add_definitions(-DINFLATE_CHUNK_SIMD_NEON) | ||
| 62 | + add_definitions(-DADLER32_SIMD_NEON) | ||
| 63 | + add_definitions(-DINFLATE_CHUNK_READ_64LE) | ||
| 64 | + add_definitions(-DCRC32_ARMV8_CRC32) | ||
| 65 | + add_definitions(-DDEFLATE_SLIDE_HASH_NEON) | ||
| 66 | + # Required by CPU features detection code. | ||
| 67 | + if (APPLE) | ||
| 68 | + add_definitions(-DARMV8_OS_MACOS) | ||
| 69 | + endif() | ||
| 70 | + | ||
| 71 | + if (UNIX AND NOT APPLE) | ||
| 72 | + add_definitions(-DARMV8_OS_LINUX) | ||
| 73 | + endif() | ||
| 74 | + | ||
| 75 | + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a+crc+crypto") | ||
| 76 | + endif() | ||
| 54 | 77 | endif() | |
| 55 | 78 | ||
| 56 | 79 | # | |
@@ -300,8 +323,11 @@ endif() | |||
| 300 | 323 | #============================================================================ | |
| 301 | 324 | # Minigzip tool | |
| 302 | 325 | #============================================================================ | |
| 303 | - add_executable(minizip_bin contrib/minizip/minizip.c contrib/minizip/ioapi.c | ||
| 304 | - contrib/minizip/ioapi.h contrib/minizip/unzip.c | ||
| 305 | - contrib/minizip/unzip.h contrib/minizip/zip.c contrib/minizip/zip.h | ||
| 306 | - ) | ||
| 307 | - target_link_libraries(minizip_bin zlib) | ||
| 326 | + # TODO(cavalcantii): get it working on Windows. | ||
| 327 | + if (BUILD_MINIZIP_BIN) | ||
| 328 | + add_executable(minizip_bin contrib/minizip/minizip.c contrib/minizip/ioapi.c | ||
| 329 | + contrib/minizip/ioapi.h contrib/minizip/unzip.c | ||
| 330 | + contrib/minizip/unzip.h contrib/minizip/zip.c contrib/minizip/zip.h | ||
| 331 | + ) | ||
| 332 | + target_link_libraries(minizip_bin zlib) | ||
| 333 | + endif() | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,6 @@ | |||
| 1 | 1 | monorail: { | |
| 2 | 2 | component: "Internals" | |
| 3 | 3 | } | |
| 4 | + buganizer_public: { | ||
| 5 | + component_id: 1456292 | ||
| 6 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | CC=cc | |
| 2 | - CFLAGS=-O -I../.. | ||
| 2 | + CFLAGS := $(CFLAGS) -O -I../.. | ||
| 3 | 3 | ||
| 4 | 4 | UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a | |
| 5 | 5 | ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a | |
@@ -16,10 +16,14 @@ minizip: $(ZIP_OBJS) | |||
| 16 | 16 | $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) | |
| 17 | 17 | ||
| 18 | 18 | test: miniunz minizip | |
| 19 | - ./minizip test readme.txt | ||
| 19 | + @rm -f test.* | ||
| 20 | + @echo hello hello hello > test.txt | ||
| 21 | + ./minizip test test.txt | ||
| 20 | 22 | ./miniunz -l test.zip | |
| 21 | - mv readme.txt readme.old | ||
| 23 | + @mv test.txt test.old | ||
| 22 | 24 | ./miniunz test.zip | |
| 25 | + @cmp test.txt test.old | ||
| 26 | + @rm -f test.* | ||
| 23 | 27 | ||
| 24 | 28 | clean: | |
| 25 | - /bin/rm -f *.o *~ minizip miniunz | ||
| 29 | + /bin/rm -f *.o *~ minizip miniunz test.* | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | Name: ZIP file API for reading file entries in a ZIP archive | |
| 2 | 2 | Short Name: minizip | |
| 3 | 3 | URL: https://github.com/madler/zlib/tree/master/contrib/minizip | |
| 4 | - Version: 1.2.12 | ||
| 4 | + Version: 1.3.0.1 | ||
| 5 | 5 | License: Zlib | |
| 6 | 6 | License File: //third_party/zlib/LICENSE | |
| 7 | 7 | Security Critical: yes | |
@@ -13,9 +13,16 @@ Minizip provides API on top of zlib that can enumerate and extract ZIP archive | |||
| 13 | 13 | files. See minizip.md for chromium build instructions. | |
| 14 | 14 | ||
| 15 | 15 | Local Modifications: | |
| 16 | + - Fixed uncompressing files with wrong uncompressed size set | ||
| 17 | + crrev.com/268940 | ||
| 18 | + 0014-minizip-unzip-with-incorrect-size.patch | ||
| 19 | + | ||
| 20 | + - Enable traditional PKWARE decryption in zlib/contrib/minizip | ||
| 21 | + Correct the value of rest_read_compressed when decompressing an encrypted | ||
| 22 | + zip. (crrev.com/580862) | ||
| 23 | + 0015-minizip-unzip-enable-decryption.patch | ||
| 24 | + | ||
| 16 | 25 | - Add parsing of the 'Info-ZIP Unicode Path Extra Field' as described in | |
| 17 | 26 | https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT section 4.6.9. | |
| 18 | 27 | (see crrev.com/1002476) | |
| 19 | - | ||
| 20 | - - Check for overly long filename, comment, or extra field in | ||
| 21 | - zipOpenNewFileInZip4_64 (crbug.com/1470539). | ||
| 28 | + 0016-minizip-parse-unicode-path-extra-field.patch | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,21 +32,20 @@ | |||
| 32 | 32 | /*********************************************************************** | |
| 33 | 33 | * Return the next byte in the pseudo-random sequence | |
| 34 | 34 | */ | |
| 35 | - static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) | ||
| 36 | - { | ||
| 35 | + static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) { | ||
| 37 | 36 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an | |
| 38 | 37 | * unpredictable manner on 16-bit systems; not a problem | |
| 39 | 38 | * with any known compiler so far, though */ | |
| 40 | 39 | ||
| 40 | + (void)pcrc_32_tab; | ||
| 41 | 41 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; | |
| 42 | 42 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); | |
| 43 | 43 | } | |
| 44 | 44 | ||
| 45 | 45 | /*********************************************************************** | |
| 46 | 46 | * Update the encryption keys with the next byte of plain text | |
| 47 | 47 | */ | |
| 48 | - static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) | ||
| 49 | - { | ||
| 48 | + static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c) { | ||
| 50 | 49 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); | |
| 51 | 50 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; | |
| 52 | 51 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; | |
@@ -62,8 +61,7 @@ static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) | |||
| 62 | 61 | * Initialize the encryption keys and the random header according to | |
| 63 | 62 | * the given password. | |
| 64 | 63 | */ | |
| 65 | - static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab) | ||
| 66 | - { | ||
| 64 | + static void init_keys(const char* passwd, unsigned long* pkeys, const z_crc_t* pcrc_32_tab) { | ||
| 67 | 65 | *(pkeys+0) = 305419896L; | |
| 68 | 66 | *(pkeys+1) = 591751049L; | |
| 69 | 67 | *(pkeys+2) = 878082192L; | |
@@ -77,24 +75,23 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcr | |||
| 77 | 75 | (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) | |
| 78 | 76 | ||
| 79 | 77 | #define zencode(pkeys,pcrc_32_tab,c,t) \ | |
| 80 | - (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) | ||
| 78 | + (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c)) | ||
| 81 | 79 | ||
| 82 | 80 | #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED | |
| 83 | 81 | ||
| 84 | 82 | #define RAND_HEAD_LEN 12 | |
| 85 | 83 | /* "last resort" source for second part of crypt seed pattern */ | |
| 86 | 84 | # ifndef ZCR_SEED2 | |
| 87 | - # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ | ||
| 85 | + # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ | ||
| 88 | 86 | # endif | |
| 89 | 87 | ||
| 90 | - static int crypthead(const char* passwd, /* password string */ | ||
| 91 | - unsigned char* buf, /* where to write header */ | ||
| 92 | - int bufSize, | ||
| 93 | - unsigned long* pkeys, | ||
| 94 | - const z_crc_t* pcrc_32_tab, | ||
| 95 | - unsigned long crcForCrypting) | ||
| 96 | - { | ||
| 97 | - int n; /* index in random header */ | ||
| 88 | + static unsigned crypthead(const char* passwd, /* password string */ | ||
| 89 | + unsigned char* buf, /* where to write header */ | ||
| 90 | + int bufSize, | ||
| 91 | + unsigned long* pkeys, | ||
| 92 | + const z_crc_t* pcrc_32_tab, | ||
| 93 | + unsigned long crcForCrypting) { | ||
| 94 | + unsigned n; /* index in random header */ | ||
| 98 | 95 | int t; /* temporary */ | |
| 99 | 96 | int c; /* random byte */ | |
| 100 | 97 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments