From be3bc987f09eb18221a116fbb564b0e6188aad98 Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Sat, 14 Aug 2021 22:01:25 +0200 Subject: [PATCH] [bls-signatures] Fix build and support more operations (#6218) * [bls-signatures] Fix build and support more operations * [bls-signatures] Fix 32 bit build --- projects/bls-signatures/Dockerfile | 1 + projects/bls-signatures/build.sh | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/projects/bls-signatures/Dockerfile b/projects/bls-signatures/Dockerfile index f3754729f..5faedbb97 100644 --- a/projects/bls-signatures/Dockerfile +++ b/projects/bls-signatures/Dockerfile @@ -23,4 +23,5 @@ 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 https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz +RUN wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz COPY build.sh $SRC/ diff --git a/projects/bls-signatures/build.sh b/projects/bls-signatures/build.sh index eec785289..2a2b76c53 100755 --- a/projects/bls-signatures/build.sh +++ b/projects/bls-signatures/build.sh @@ -61,6 +61,8 @@ echo -n "BLS_G2_Add," >>extra_options.h echo -n "BLS_G2_Mul," >>extra_options.h echo -n "BLS_G2_IsEq," >>extra_options.h echo -n "BLS_G2_Neg," >>extra_options.h +echo -n "BLS_Aggregate_G1", >>extra_options.h +echo -n "BLS_Aggregate_G2", >>extra_options.h echo -n "BignumCalc_Mod_BLS12_381_P," >>extra_options.h echo -n "BignumCalc_Mod_BLS12_381_R," >>extra_options.h echo -n "KDF_HKDF," >>extra_options.h @@ -111,8 +113,20 @@ export BLST_INCLUDE_PATH=$(realpath bindings/) export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_BLST" # Build Chia -if [[ $CFLAGS != *sanitize=memory* && $CFLAGS != *undefined ]] +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/ @@ -189,7 +203,7 @@ make -B cd $SRC/cryptofuzz/modules/blst/ make -B -if [[ "$SANITIZER" != "memory" ]] +if [[ $CFLAGS != *sanitize=memory* && $CFLAGS != *-m32* ]] then cd $SRC/cryptofuzz/modules/chia_bls/ make -B