diff --git a/projects/bls-signatures/Dockerfile b/projects/bls-signatures/Dockerfile index aeaaf43cbeaa..c5ed1cf2ee87 100644 --- a/projects/bls-signatures/Dockerfile +++ b/projects/bls-signatures/Dockerfile @@ -18,13 +18,13 @@ FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get update && apt-get install -y make autoconf automake libtool wget python lzip libgmp-dev RUN git clone --depth 1 https://github.com/guidovranken/cryptofuzz RUN git clone --depth 1 https://github.com/supranational/blst -RUN git clone --depth 1 https://github.com/Chia-Network/bls-signatures.git RUN git clone --depth 1 https://github.com/herumi/mcl.git RUN git clone --depth 1 https://github.com/randombit/botan.git -RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2 -RUN wget --no-check-certificate https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz -RUN test "$(sha256sum gmp-6.2.1.tar.lz)" = "2c7f4f0d370801b2849c48c9ef3f59553b5f1d3791d070cffb04599f9fc67b41 gmp-6.2.1.tar.lz" -RUN wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz +RUN git clone --depth 1 https://github.com/mratsim/constantine +RUN wget -q https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2 +RUN wget -q https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.lz +RUN wget -q https://nim-lang.org/download/nim-1.6.12-linux_x64.tar.xz +RUN wget -q https://nim-lang.org/download/nim-1.6.12-linux_x32.tar.xz COPY build.sh $SRC/ # This is to fix Fuzz Introspector build by using LLVM old pass manager # re https://github.com/ossf/fuzz-introspector/issues/305 diff --git a/projects/bls-signatures/build.sh b/projects/bls-signatures/build.sh index 45992d20a8bf..d0ea5d97557e 100755 --- a/projects/bls-signatures/build.sh +++ b/projects/bls-signatures/build.sh @@ -91,6 +91,31 @@ then export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_ARKWORKS_ALGEBRA" fi +# Build Constantine +if [[ "$SANITIZER" != "memory" ]] +then + cd $SRC/ + if [[ $CFLAGS != *-m32* ]] + then + tar Jxf nim-1.6.12-linux_x64.tar.xz + else + tar Jxf nim-1.6.12-linux_x32.tar.xz + fi + export NIM_PATH=$(realpath nim-1.6.12) + + export CONSTANTINE_PATH=$SRC/constantine/ + + cd $SRC/cryptofuzz/modules/constantine/ + if [[ $CFLAGS != *-m32* ]] + then + make + else + make -f Makefile-i386 + fi + + export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_CONSTANTINE" +fi + if [[ $CFLAGS = *-m32* ]] then # Build and install libgmp @@ -128,42 +153,6 @@ cp -R $SRC/blst/ $SRC/blst_normal/ cd $SRC/blst_normal/ build_blst -# Build Chia -if [[ $CFLAGS != *sanitize=memory* && $CFLAGS != *-m32* ]] -then - # Build and install libsodium - cd $SRC/ - mkdir $SRC/libsodium-install - tar zxf libsodium-1.0.18-stable.tar.gz - cd $SRC/libsodium-stable/ - autoreconf -ivf - ./configure --prefix="$SRC/libsodium-install/" - make -j$(nproc) - make install - export CXXFLAGS="$CXXFLAGS -I $SRC/libsodium-install/include/" - export LINK_FLAGS="$LINK_FLAGS $SRC/libsodium-install/lib/libsodium.a" - - cd $SRC/bls-signatures/ - mkdir build/ - cd build/ - if [[ $CFLAGS = *-m32* ]] - then - export CHIA_ARCH="X86" - else - export CHIA_ARCH="X64" - fi - cmake .. -DBUILD_BLS_PYTHON_BINDINGS=0 -DBUILD_BLS_TESTS=0 -DBUILD_BLS_BENCHMARKS=0 -DARCH=$CHIA_ARCH - make -j$(nproc) - export CHIA_BLS_LIBBLS_A_PATH=$(realpath src/libbls.a) - export CHIA_BLS_LIBRELIC_S_A_PATH=$(realpath _deps/relic-build/lib/librelic_s.a) - export CHIA_BLS_LIBSODIUM_A_PATH=$(realpath _deps/sodium-build/libsodium.a) - export CHIA_BLS_INCLUDE_PATH=$(realpath ../src/) - export CHIA_BLS_RELIC_INCLUDE_PATH_1=$(realpath _deps/relic-build/include/) - export CHIA_BLS_RELIC_INCLUDE_PATH_2=$(realpath _deps/relic-src/include/) - export LINK_FLAGS="$LINK_FLAGS -lgmp" - export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_CHIA_BLS" -fi - # Build mcl if [[ "$SANITIZER" != "memory" && $CFLAGS != *-m32* ]] then @@ -222,12 +211,6 @@ make -B cd $SRC/cryptofuzz/modules/blst/ make -B -if [[ $CFLAGS != *sanitize=memory* && $CFLAGS != *-m32* ]] -then - cd $SRC/cryptofuzz/modules/chia_bls/ - make -B -fi - if [[ $CFLAGS != *sanitize=memory* && $CFLAGS != *-m32* ]] then cd $SRC/cryptofuzz/modules/mcl/