From 0a6f667e847b7e667ee29588140d40a35d972039 Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Sun, 29 Aug 2021 18:42:06 +0200 Subject: [PATCH] [bitcoin-core] Fix build (#6344) * [bitcoin-core] Fix build * [bitcoin-core] Add libsecp256k1 w20-p8 target * [bitcoin-core] Fix --- projects/bitcoin-core/Dockerfile | 8 ++---- projects/bitcoin-core/build_cryptofuzz.sh | 30 ++++++++++++++--------- projects/bitcoin-core/project.yaml | 5 ++-- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/projects/bitcoin-core/Dockerfile b/projects/bitcoin-core/Dockerfile index 9670b3c6b..6a2040a32 100644 --- a/projects/bitcoin-core/Dockerfile +++ b/projects/bitcoin-core/Dockerfile @@ -14,17 +14,13 @@ # ################################################################################ -# Using Ubuntu 16.04 because of breakage on Ubuntu 20.04. -# See https://github.com/google/oss-fuzz/issues/6291 for more details. -FROM gcr.io/oss-fuzz-base/base-builder:xenial -# Delete line above and uncomment line below to upgrade to 20.04. -# FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder # Packages taken from: # * https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md#dependency-build-instructions # * https://github.com/bitcoin/bitcoin/blob/master/depends/README.md#for-linux-including-i386-arm-cross-compilation RUN apt-get update && apt-get install -y \ - build-essential libtool autotools-dev automake pkg-config bsdmainutils python python3 \ + build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 \ make automake cmake curl g++-multilib libtool binutils-gold bsdmainutils pkg-config patch bison \ wget zip diff --git a/projects/bitcoin-core/build_cryptofuzz.sh b/projects/bitcoin-core/build_cryptofuzz.sh index 248bfb809..5d2f827a4 100755 --- a/projects/bitcoin-core/build_cryptofuzz.sh +++ b/projects/bitcoin-core/build_cryptofuzz.sh @@ -38,6 +38,10 @@ function build_libsecp256k1() { if test -f "Makefile"; then # Remove old configuration if it exists make clean + + # Prevent the error: + # "configuration mismatch, invalid ECMULT_WINDOW_SIZE. Try deleting ecmult_static_pre_g.h before the build." + rm -f src/ecmult_static_pre_g.h fi SECP256K1_CONFIGURE_PARAMS=" @@ -128,14 +132,18 @@ cd ../trezor/ make -B -j$(nproc) cd ../botan/ make -B -j$(nproc) -cd ../schnorr_fun/ -export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_SCHNORR_FUN" -if [[ $CFLAGS != *-m32* ]] -then - make -else - make -f Makefile.i386 -fi + +# schnorr_fun is currently disabled because it was causing build failures +# See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37524 +#cd ../schnorr_fun/ +#export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_SCHNORR_FUN" +#if [[ $CFLAGS != *-m32* ]] +#then +# make +#else +# make -f Makefile.i386 +#fi + cd ../../ # Build with 3 configurations of libsecp256k1 @@ -152,11 +160,11 @@ rm cryptofuzz make cp cryptofuzz $OUT/cryptofuzz-bitcoin-cryptography-w15-p4 -build_libsecp256k1 "--with-ecmult-window=24" "--with-ecmult-gen-precision=8" +build_libsecp256k1 "--with-ecmult-window=20" "--with-ecmult-gen-precision=8" cd $SRC/cryptofuzz/ rm cryptofuzz make -cp cryptofuzz $OUT/cryptofuzz-bitcoin-cryptography-w24-p8 +cp cryptofuzz $OUT/cryptofuzz-bitcoin-cryptography-w20-p8 # Convert Wycheproof test vectors to Cryptofuzz corpus format mkdir $SRC/corpus-cryptofuzz-wycheproof/ @@ -166,4 +174,4 @@ zip -j cryptofuzz-bitcoin-cryptography_seed_corpus.zip $SRC/corpus-cryptofuzz-wy # Use them as the seed corpus for each of the fuzzers cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w2-p2_seed_corpus.zip cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w15-p4_seed_corpus.zip -cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w24-p8_seed_corpus.zip +cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w20-p8_seed_corpus.zip diff --git a/projects/bitcoin-core/project.yaml b/projects/bitcoin-core/project.yaml index 9e7364175..9d6f33663 100644 --- a/projects/bitcoin-core/project.yaml +++ b/projects/bitcoin-core/project.yaml @@ -12,12 +12,11 @@ auto_ccs: sanitizers: - address - undefined -# Disabled MSAN because of https://github.com/google/oss-fuzz/issues/6294 -# - memory + - memory architectures: - x86_64 - i386 fuzzing_engines: - libfuzzer - honggfuzz - - afl \ No newline at end of file + - afl