Created
November 25, 2020 20:14
-
-
Save guidovranken/91f854daaa7504174ea0647c347eef84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export CC="clang" | |
export CXX="clang++" | |
export CFLAGS="-fsanitize=fuzzer-no-link -g -O3 -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" | |
export CXXFLAGS="-fsanitize=fuzzer-no-link -g -O3 -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" | |
# Alternatively: | |
#export CFLAGS="-fsanitize=fuzzer-no-link -g -O3 -fsanitize=address -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" | |
#export CXXFLAGS="-fsanitize=fuzzer-no-link -g -O3 -fsanitize=address -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" | |
export LDFLAGS="-fsanitize=fuzzer-no-link -fsanitize=address" | |
export LIBFUZZER_LINK="-fsanitize=fuzzer" | |
git clone --depth 1 https://github.com/bitcoin-core/secp256k1.git | |
cd secp256k1/ | |
autoreconf -ivf | |
./configure --enable-static --disable-tests --disable-benchmark --with-bignum=no --disable-exhaustive-tests --disable-valgrind | |
make | |
export SECP256K1_INCLUDE_PATH=$(realpath include) | |
export LIBSECP256K1_A_PATH=$(realpath .libs/libsecp256k1.a) | |
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_SECP256K1" | |
cd ../ | |
export CFLAGS="$CFLAGS -DHAVE_AES_ECB -DWOLFSSL_DES_ECB -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ -DWOLFSSL_ECDSA_SET_K" | |
git clone --depth 1 https://github.com/wolfSSL/wolfssl.git | |
cd wolfssl/ | |
autoreconf -ivf | |
./configure --enable-static --enable-md2 --enable-md4 --enable-ripemd --enable-blake2 --enable-blake2s --enable-pwdbased --enable-scrypt --enable-hkdf --enable-cmac --enable-arc4 --enable-camellia --enable-rabbit --enable-aesccm --enable-aesctr --enable-hc128 --enable-xts --enable-des3 --enable-idea --enable-x963kdf --enable-harden --enable-aescfb --enable-aesofb --enable-aeskeywrap --enable-keygen --enable-curve25519 --enable-curve448 --enable-shake256 --disable-crypttests --disable-examples --enable-compkey --enable-ed448 --enable-ed25519 --enable-ecccustcurves --enable-xchacha --enable-cryptocb --enable-eccencrypt | |
make -j$(nproc) | |
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_WOLFCRYPT" | |
export WOLFCRYPT_LIBWOLFSSL_A_PATH=`realpath src/.libs/libwolfssl.a` | |
export WOLFCRYPT_INCLUDE_PATH=`realpath .` | |
cd ../ | |
git clone --depth 1 https://github.com/guidovranken/cryptofuzz.git | |
cd cryptofuzz/ | |
python gen_repository.py | |
cd modules/wolfcrypt/; make -B | |
cd ../secp256k1/; make -B | |
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL" | |
cd ../../ | |
rm extra_options.h | |
echo -n '"' >>extra_options.h | |
echo -n '--force-module=secp256k1 ' >>extra_options.h | |
echo -n '--digests=NULL,SHA256 ' >>extra_options.h | |
echo -n '--curves=secp256k1 ' >>extra_options.h | |
echo -n '--operations=ECC_PrivateToPublic,ECDSA_Verify,ECDSA_Sign' >>extra_options.h | |
echo -n '"' >>extra_options.h | |
make -B -j$(nproc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment