From 2e3212d8f0cd4c75bd5efcb37e821c3176c2086e Mon Sep 17 00:00:00 2001 From: Abhishek Arya Date: Tue, 9 Apr 2019 09:07:55 -0700 Subject: [PATCH] Revert "Remove mbed TLS fuzzer (#2278)" (#2304) This reverts commit cce2ed4d23eb65251c0cd6b44cc666d91c883803. --- projects/bignum-fuzzer/Dockerfile | 1 + projects/bignum-fuzzer/build.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/projects/bignum-fuzzer/Dockerfile b/projects/bignum-fuzzer/Dockerfile index d512b8a9f..cc31b61fe 100644 --- a/projects/bignum-fuzzer/Dockerfile +++ b/projects/bignum-fuzzer/Dockerfile @@ -26,4 +26,5 @@ RUN git clone --depth 1 https://github.com/guidovranken/bignum-fuzzer RUN git clone --depth 1 https://github.com/openssl/openssl RUN hg clone https://gmplib.org/repo/gmp/ libgmp/ RUN git clone https://boringssl.googlesource.com/boringssl +RUN git clone --depth 1 https://github.com/ARMmbed/mbedtls COPY build.sh $SRC/ diff --git a/projects/bignum-fuzzer/build.sh b/projects/bignum-fuzzer/build.sh index 8dad3b426..e17de2cff 100755 --- a/projects/bignum-fuzzer/build.sh +++ b/projects/bignum-fuzzer/build.sh @@ -97,6 +97,10 @@ LIBFUZZER_LINK="-lFuzzingEngine" make # Copy OpenSSL/libgmp fuzzer to the designated location cp $SRC/bignum-fuzzer/fuzzer $OUT/fuzzer_openssl_libgmp_num_len_1200_all_operations_num_loops_1 +# Build mbedtls +cd $SRC/mbedtls +make lib -j$(nproc) + # Build BoringSSL cd $SRC/boringssl mkdir build @@ -109,6 +113,20 @@ cd $SRC/bignum-fuzzer/modules/openssl make clean CFLAGS="$CFLAGS -DBIGNUM_FUZZER_BORINGSSL" OPENSSL_INCLUDE_PATH=$SRC/boringssl/include OPENSSL_LIBCRYPTO_A_PATH=$SRC/boringssl/build/crypto/libcrypto.a make +# Build mbedtls module +cd $SRC/bignum-fuzzer/modules/mbedtls +MBEDTLS_LIBMBEDCRYPTO_A_PATH=$SRC/mbedtls/library/libmbedcrypto.a MBEDTLS_INCLUDE_PATH=$SRC/mbedtls/include make + +# Build BoringSSL/mbedtls fuzzer +cd $SRC/bignum-fuzzer +make clean +./config-modules.sh boringssl mbedtls +CXXFLAGS="$BASE_CXXFLAGS -DBNFUZZ_FLAG_NUM_LEN=100 -DBNFUZZ_FLAG_ALL_OPERATIONS=1 -DBNFUZZ_FLAG_NUM_LOOPS=1" +LIBFUZZER_LINK="-lFuzzingEngine" make + +# Copy BoringSSL/mbedtls fuzzer to the designated location +cp $SRC/bignum-fuzzer/fuzzer $OUT/fuzzer_boringssl_mbedtls_num_len_100_all_operations_num_loops_1 + # Build BoringSSL/libmpdec fuzzer cd $SRC/bignum-fuzzer make clean @@ -124,4 +142,5 @@ cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_go_no_negative_num_len_1200_all_ope cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_rust_num_len_1200_all_operations_num_loops_1_seed_corpus.zip $OUT cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_cpp_boost_num_len_1200_all_operations_num_loops_1_seed_corpus.zip $OUT cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_libgmp_num_len_1200_all_operations_num_loops_1_seed_corpus.zip $OUT +cp $SRC/bignum-fuzzer/corpora/fuzzer_boringssl_mbedtls_num_len_100_all_operations_num_loops_1_seed_corpus.zip $OUT cp $SRC/bignum-fuzzer/corpora/fuzzer_boringssl_mbedtls_num_len_100_all_operations_num_loops_1_seed_corpus.zip $OUT/fuzzer_boringssl_libmpdec_num_len_100_all_operations_num_loops_1_seed_corpus.zip