mirror of https://github.com/google/oss-fuzz.git
[wolfssl] Add heapmath fuzzer (#9636)
'heapmath' is yet another bignum implementation in wolfssl that we would like to test.
This commit is contained in:
parent
16de98e2cf
commit
bdd0eaa992
|
@ -18,7 +18,7 @@
|
||||||
# Please fix failure and upgrade.
|
# Please fix failure and upgrade.
|
||||||
FROM gcr.io/oss-fuzz-base/base-builder@sha256:111d6b9d3a52bd3392602c71dc8936c628607a7a9bc86d381db7586f9b1e840f
|
FROM gcr.io/oss-fuzz-base/base-builder@sha256:111d6b9d3a52bd3392602c71dc8936c628607a7a9bc86d381db7586f9b1e840f
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y make autoconf automake libtool zip wget python bsdmainutils
|
RUN apt-get update && apt-get install -y make autoconf automake libtool zip wget python bsdmainutils libcrypt-dev:i386
|
||||||
RUN git clone https://github.com/wolfssl/wolfssl --depth 1 $SRC/wolfssl
|
RUN git clone https://github.com/wolfssl/wolfssl --depth 1 $SRC/wolfssl
|
||||||
RUN git clone --depth 1 https://github.com/wolfSSL/wolfssh.git
|
RUN git clone --depth 1 https://github.com/wolfSSL/wolfssh.git
|
||||||
RUN git clone --depth 1 https://github.com/guidovranken/fuzzing-headers.git
|
RUN git clone --depth 1 https://github.com/guidovranken/fuzzing-headers.git
|
||||||
|
|
|
@ -87,6 +87,7 @@ then
|
||||||
# Configure Cryptofuzz
|
# Configure Cryptofuzz
|
||||||
cd $SRC/cryptofuzz/
|
cd $SRC/cryptofuzz/
|
||||||
python gen_repository.py
|
python gen_repository.py
|
||||||
|
|
||||||
rm extra_options.h
|
rm extra_options.h
|
||||||
echo -n '"' >>extra_options.h
|
echo -n '"' >>extra_options.h
|
||||||
echo -n '--force-module=wolfCrypt ' >>extra_options.h
|
echo -n '--force-module=wolfCrypt ' >>extra_options.h
|
||||||
|
@ -245,6 +246,29 @@ then
|
||||||
unset WOLFCRYPT_LIBWOLFSSL_A_PATH
|
unset WOLFCRYPT_LIBWOLFSSL_A_PATH
|
||||||
unset WOLFCRYPT_INCLUDE_PATH
|
unset WOLFCRYPT_INCLUDE_PATH
|
||||||
|
|
||||||
|
# Build heapmath fuzzer
|
||||||
|
cp -R $SRC/cryptofuzz/ $SRC/cryptofuzz-heapmath/
|
||||||
|
cp -R $SRC/wolfssl/ $SRC/wolfssl-heapmath/
|
||||||
|
cd $SRC/wolfssl-heapmath/
|
||||||
|
autoreconf -ivf
|
||||||
|
CFLAGS="$CFLAGS -DHAVE_AES_ECB -DWOLFSSL_DES_ECB -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ -DWOLFSSL_ECDSA_SET_K -DWOLFSSL_ECDSA_SET_K_ONE_LOOP"
|
||||||
|
./configure $WOLFCRYPT_CONFIGURE_PARAMS --enable-heapmath
|
||||||
|
make -j$(nproc)
|
||||||
|
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT -DCRYPTOFUZZ_BOTAN"
|
||||||
|
export WOLFCRYPT_LIBWOLFSSL_A_PATH="$SRC/wolfssl-heapmath/src/.libs/libwolfssl.a"
|
||||||
|
export WOLFCRYPT_INCLUDE_PATH="$SRC/wolfssl-heapmath/"
|
||||||
|
cd $SRC/cryptofuzz-heapmath/modules/wolfcrypt
|
||||||
|
make -j$(nproc)
|
||||||
|
cd $SRC/cryptofuzz-heapmath/modules/botan
|
||||||
|
make -j$(nproc)
|
||||||
|
cd $SRC/cryptofuzz-heapmath/
|
||||||
|
LIBFUZZER_LINK="$LIB_FUZZING_ENGINE" make -B -j$(nproc)
|
||||||
|
cp cryptofuzz $OUT/cryptofuzz-heapmath
|
||||||
|
CFLAGS="$OLD_CFLAGS"
|
||||||
|
CXXFLAGS="$OLD_CXXFLAGS"
|
||||||
|
unset WOLFCRYPT_LIBWOLFSSL_A_PATH
|
||||||
|
unset WOLFCRYPT_INCLUDE_PATH
|
||||||
|
|
||||||
mkdir $SRC/cryptofuzz-seed-corpus/
|
mkdir $SRC/cryptofuzz-seed-corpus/
|
||||||
|
|
||||||
# Convert Wycheproof test vectors to Cryptofuzz corpus format
|
# Convert Wycheproof test vectors to Cryptofuzz corpus format
|
||||||
|
@ -298,7 +322,7 @@ then
|
||||||
|
|
||||||
# Pack it
|
# Pack it
|
||||||
cd $SRC/cryptofuzz_seed_corpus
|
cd $SRC/cryptofuzz_seed_corpus
|
||||||
zip -r $SRC/cryptofuzz_seed_corpus.zip .
|
zip -r $SRC/cryptofuzz_seed_corpus.zip . >/dev/null
|
||||||
|
|
||||||
# Use it as the seed corpus for each Cryptofuzz-based fuzzer
|
# Use it as the seed corpus for each Cryptofuzz-based fuzzer
|
||||||
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-normal-math_seed_corpus.zip
|
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-normal-math_seed_corpus.zip
|
||||||
|
@ -306,6 +330,7 @@ then
|
||||||
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-sp-math-all-8bit_seed_corpus.zip
|
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-sp-math-all-8bit_seed_corpus.zip
|
||||||
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-sp-math_seed_corpus.zip
|
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-sp-math_seed_corpus.zip
|
||||||
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-fastmath_seed_corpus.zip
|
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-fastmath_seed_corpus.zip
|
||||||
|
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-heapmath_seed_corpus.zip
|
||||||
|
|
||||||
# Remove files that are no longer needed to prevent running out of disk space
|
# Remove files that are no longer needed to prevent running out of disk space
|
||||||
rm -rf $SRC/botan-p256-corpus/
|
rm -rf $SRC/botan-p256-corpus/
|
||||||
|
|
Loading…
Reference in New Issue