Specify the list of fuzzers with build.json This is a bit of a mess because we actually build each fuzzer as a separate target, but ah well. Migrating to FuzzTest will resolve that. Bug: 42290412 Change-Id: Ia32287ce8b5947a339e966df9e55e2afabed08c1 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/70427 Reviewed-by: Bob Beck <bbe@google.com> Commit-Queue: David Benjamin <davidben@google.com> Auto-Submit: David Benjamin <davidben@google.com>
diff --git a/build.json b/build.json index c44dc67..55fe1a8 100644 --- a/build.json +++ b/build.json
@@ -1018,5 +1018,13 @@ "tool/internal.h", "tool/transport_common.h" ] + }, + "fuzz": { + // TODO(crbug.com/42290554): Unlike the other targets, each source here + // is expected to be built separately. When we migrate from libFuzzer to + // FuzzTest, this will be moot. + "srcs": [ + "fuzz/*.cc" + ] } }
diff --git a/fuzz/CMakeLists.txt b/fuzz/CMakeLists.txt index 36ec9fb..1c784a1 100644 --- a/fuzz/CMakeLists.txt +++ b/fuzz/CMakeLists.txt
@@ -1,7 +1,11 @@ -macro(fuzzer name) - add_executable(${name} ${name}.cc) +# TODO(crbug.com/42290412): Flatten this build up a layer. Between +# crbug.com/42290128, crbug.com/42290508 and crbug.com/42290554, there is enough +# churn that we've left it alone for now. +foreach(fuzzer ${FUZZ_SOURCES}) + cmake_path(GET fuzzer STEM name) + add_executable(${name} ../${fuzzer}) target_compile_options(${name} PRIVATE "-Wno-missing-prototypes") - target_link_libraries(${name} crypto ${ARGN}) + target_link_libraries(${name} crypto ssl pki) if(LIBFUZZER_FROM_DEPS) set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer-no-link") target_link_libraries(${name} Fuzzer) @@ -13,37 +17,4 @@ PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES) -endmacro() - -fuzzer(arm_cpuinfo) -fuzzer(bn_div) -fuzzer(bn_mod_exp) -fuzzer(cert) -fuzzer(client ssl) -fuzzer(conf) -fuzzer(crl_getcrlstatusforcert_fuzzer pki) -fuzzer(crl_parse_crl_certificatelist_fuzzer pki) -fuzzer(crl_parse_crl_tbscertlist_fuzzer pki) -fuzzer(crl_parse_issuing_distribution_point_fuzzer pki) -fuzzer(decode_client_hello_inner ssl) -fuzzer(der_roundtrip) -fuzzer(dtls_client ssl) -fuzzer(dtls_server ssl) -fuzzer(ocsp_parse_ocsp_cert_id_fuzzer pki) -fuzzer(ocsp_parse_ocsp_response_data_fuzzer pki) -fuzzer(ocsp_parse_ocsp_response_fuzzer pki) -fuzzer(ocsp_parse_ocsp_single_response_fuzzer pki) -fuzzer(parse_authority_key_identifier_fuzzer pki) -fuzzer(parse_certificate_fuzzer pki) -fuzzer(parse_crldp_fuzzer pki) -fuzzer(pkcs12) -fuzzer(pkcs8) -fuzzer(privkey) -fuzzer(read_pem) -fuzzer(server ssl) -fuzzer(session ssl) -fuzzer(spki) -fuzzer(ssl_ctx_api ssl) -fuzzer(verify_name_match_fuzzer pki) -fuzzer(verify_name_match_normalizename_fuzzer pki) -fuzzer(verify_name_match_verifynameinsubtree_fuzzer pki) +endforeach()
diff --git a/gen/sources.bzl b/gen/sources.bzl index 5f8a3b2..4d0497f 100644 --- a/gen/sources.bzl +++ b/gen/sources.bzl
@@ -1052,6 +1052,41 @@ "decrepit/xts/xts_test.cc", ] +fuzz_sources = [ + "fuzz/arm_cpuinfo.cc", + "fuzz/bn_div.cc", + "fuzz/bn_mod_exp.cc", + "fuzz/cert.cc", + "fuzz/client.cc", + "fuzz/conf.cc", + "fuzz/crl_getcrlstatusforcert_fuzzer.cc", + "fuzz/crl_parse_crl_certificatelist_fuzzer.cc", + "fuzz/crl_parse_crl_tbscertlist_fuzzer.cc", + "fuzz/crl_parse_issuing_distribution_point_fuzzer.cc", + "fuzz/decode_client_hello_inner.cc", + "fuzz/der_roundtrip.cc", + "fuzz/dtls_client.cc", + "fuzz/dtls_server.cc", + "fuzz/ocsp_parse_ocsp_cert_id_fuzzer.cc", + "fuzz/ocsp_parse_ocsp_response_data_fuzzer.cc", + "fuzz/ocsp_parse_ocsp_response_fuzzer.cc", + "fuzz/ocsp_parse_ocsp_single_response_fuzzer.cc", + "fuzz/parse_authority_key_identifier_fuzzer.cc", + "fuzz/parse_certificate_fuzzer.cc", + "fuzz/parse_crldp_fuzzer.cc", + "fuzz/pkcs12.cc", + "fuzz/pkcs8.cc", + "fuzz/privkey.cc", + "fuzz/read_pem.cc", + "fuzz/server.cc", + "fuzz/session.cc", + "fuzz/spki.cc", + "fuzz/ssl_ctx_api.cc", + "fuzz/verify_name_match_fuzzer.cc", + "fuzz/verify_name_match_normalizename_fuzzer.cc", + "fuzz/verify_name_match_verifynameinsubtree_fuzzer.cc", +] + pki_sources = [ "pki/cert_error_id.cc", "pki/cert_error_params.cc",
diff --git a/gen/sources.cmake b/gen/sources.cmake index 919e0a6..4595e99 100644 --- a/gen/sources.cmake +++ b/gen/sources.cmake
@@ -1085,6 +1085,43 @@ ) set( + FUZZ_SOURCES + + fuzz/arm_cpuinfo.cc + fuzz/bn_div.cc + fuzz/bn_mod_exp.cc + fuzz/cert.cc + fuzz/client.cc + fuzz/conf.cc + fuzz/crl_getcrlstatusforcert_fuzzer.cc + fuzz/crl_parse_crl_certificatelist_fuzzer.cc + fuzz/crl_parse_crl_tbscertlist_fuzzer.cc + fuzz/crl_parse_issuing_distribution_point_fuzzer.cc + fuzz/decode_client_hello_inner.cc + fuzz/der_roundtrip.cc + fuzz/dtls_client.cc + fuzz/dtls_server.cc + fuzz/ocsp_parse_ocsp_cert_id_fuzzer.cc + fuzz/ocsp_parse_ocsp_response_data_fuzzer.cc + fuzz/ocsp_parse_ocsp_response_fuzzer.cc + fuzz/ocsp_parse_ocsp_single_response_fuzzer.cc + fuzz/parse_authority_key_identifier_fuzzer.cc + fuzz/parse_certificate_fuzzer.cc + fuzz/parse_crldp_fuzzer.cc + fuzz/pkcs12.cc + fuzz/pkcs8.cc + fuzz/privkey.cc + fuzz/read_pem.cc + fuzz/server.cc + fuzz/session.cc + fuzz/spki.cc + fuzz/ssl_ctx_api.cc + fuzz/verify_name_match_fuzzer.cc + fuzz/verify_name_match_normalizename_fuzzer.cc + fuzz/verify_name_match_verifynameinsubtree_fuzzer.cc +) + +set( PKI_SOURCES pki/cert_error_id.cc
diff --git a/gen/sources.json b/gen/sources.json index 795c3ff..c2a97d6 100644 --- a/gen/sources.json +++ b/gen/sources.json
@@ -1033,6 +1033,42 @@ "decrepit/xts/xts_test.cc" ] }, + "fuzz": { + "srcs": [ + "fuzz/arm_cpuinfo.cc", + "fuzz/bn_div.cc", + "fuzz/bn_mod_exp.cc", + "fuzz/cert.cc", + "fuzz/client.cc", + "fuzz/conf.cc", + "fuzz/crl_getcrlstatusforcert_fuzzer.cc", + "fuzz/crl_parse_crl_certificatelist_fuzzer.cc", + "fuzz/crl_parse_crl_tbscertlist_fuzzer.cc", + "fuzz/crl_parse_issuing_distribution_point_fuzzer.cc", + "fuzz/decode_client_hello_inner.cc", + "fuzz/der_roundtrip.cc", + "fuzz/dtls_client.cc", + "fuzz/dtls_server.cc", + "fuzz/ocsp_parse_ocsp_cert_id_fuzzer.cc", + "fuzz/ocsp_parse_ocsp_response_data_fuzzer.cc", + "fuzz/ocsp_parse_ocsp_response_fuzzer.cc", + "fuzz/ocsp_parse_ocsp_single_response_fuzzer.cc", + "fuzz/parse_authority_key_identifier_fuzzer.cc", + "fuzz/parse_certificate_fuzzer.cc", + "fuzz/parse_crldp_fuzzer.cc", + "fuzz/pkcs12.cc", + "fuzz/pkcs8.cc", + "fuzz/privkey.cc", + "fuzz/read_pem.cc", + "fuzz/server.cc", + "fuzz/session.cc", + "fuzz/spki.cc", + "fuzz/ssl_ctx_api.cc", + "fuzz/verify_name_match_fuzzer.cc", + "fuzz/verify_name_match_normalizename_fuzzer.cc", + "fuzz/verify_name_match_verifynameinsubtree_fuzzer.cc" + ] + }, "pki": { "srcs": [ "pki/cert_error_id.cc",
diff --git a/util/generate_build_files.py b/util/generate_build_files.py index fd9ca6c..2c601df 100644 --- a/util/generate_build_files.py +++ b/util/generate_build_files.py
@@ -629,8 +629,6 @@ bssl_sys_files = FindRustFiles(os.path.join('src', 'rust', 'bssl-sys', 'src')) bssl_crypto_files = FindRustFiles(os.path.join('src', 'rust', 'bssl-crypto', 'src')) - fuzz_c_files = FindCFiles(os.path.join('src', 'fuzz'), NoTests) - # TODO(crbug.com/boringssl/542): generate_build_files.py historically reported # all the assembly files as part of libcrypto. Merge them for now, but we # should split them out later. @@ -658,7 +656,7 @@ 'crypto_test': PrefixWithSrc(sources['crypto_test']['srcs']), 'crypto_test_data': PrefixWithSrc(sources['crypto_test']['data']), 'fips_fragments': PrefixWithSrc(sources['bcm']['internal_hdrs']), - 'fuzz': fuzz_c_files, + 'fuzz': PrefixWithSrc(sources['fuzz']['srcs']), 'pki': PrefixWithSrc(sources['pki']['srcs']), 'pki_headers': PrefixWithSrc(sources['pki']['hdrs']), 'pki_internal_headers': PrefixWithSrc(sources['pki']['internal_hdrs']),