# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//testing/libfuzzer/fuzzer_test.gni") config("minizip_compiler_flags") { if (is_clang) { cflags = [ # mz_zip.c does |UINT_MAX == UINT16_MAX && ...|. "-Wno-unreachable-code", "-Wno-unused-function", ] if (!is_nacl && (target_cpu == "x86" || target_cpu == "x64")) { cflags += [ "-maes", "-msse3", "-msse4.1", ] } if (is_nacl) { cflags += [ "-Wno-char-subscripts" ] } } } config("minizip_public_config") { include_dirs = [ "src/lib/brg", "//third_party/zlib", ] defines = [ "HAVE_ZLIB", "HAVE_PKCRYPT", "HAVE_WZAES", "HAVE_STDINT_H", # This isn't actually low entropy. It just allows for an OS-specific # random number generator. "FORCE_LOWQUALITY_ENTROPY", ] } static_library("minizip") { sources = [ "mz_os_chrome.cc", "src/lib/brg/aes.h", "src/lib/brg/aescrypt.c", "src/lib/brg/aeskey.c", "src/lib/brg/aesopt.h", "src/lib/brg/aestab.c", "src/lib/brg/aestab.h", "src/lib/brg/brg_endian.h", "src/lib/brg/brg_types.h", "src/lib/brg/hmac.c", "src/lib/brg/hmac.h", "src/lib/brg/sha1.c", "src/lib/brg/sha1.h", "src/lib/brg/sha2.c", "src/lib/brg/sha2.h", "src/mz.h", "src/mz_crypt.c", "src/mz_crypt.h", "src/mz_crypt_brg.c", "src/mz_os.c", "src/mz_os.h", "src/mz_strm.c", "src/mz_strm.h", "src/mz_strm_mem.c", "src/mz_strm_mem.h", "src/mz_strm_pkcrypt.c", "src/mz_strm_pkcrypt.h", "src/mz_strm_wzaes.c", "src/mz_strm_wzaes.h", "src/mz_strm_zlib.c", "src/mz_strm_zlib.h", "src/mz_zip.c", "src/mz_zip.h", "src/mz_zip_rw.c", "src/mz_zip_rw.h", ] configs += [ ":minizip_compiler_flags" ] public_configs = [ ":minizip_public_config" ] deps = [ "//base", "//third_party/zlib:zlib", ] visibility = [ # NOTE: Modifying visibility list requires approval from security team. ":minizip_compress_fuzzer", ":minizip_uncompress_fuzzer", "//chrome/browser/resources/chromeos/zip_archiver/cpp:zip_archiver_library", ] } fuzzer_test("minizip_compress_fuzzer") { sources = [ "minizip_compress_fuzzer.cc" ] deps = [ ":minizip", "//base", "//base/test:test_support", ] } fuzzer_test("minizip_uncompress_fuzzer") { sources = [ "minizip_uncompress_fuzzer.cc" ] deps = [ ":minizip" ] seed_corpus = "minizip_uncompress_corpus" }