[cryptofuzz] Include libgcrypt, libsodium, Crypto++ in MemorySanitizer build (#3668)

This commit is contained in:
Guido Vranken 2020-04-19 04:36:46 +02:00 committed by GitHub
parent e94eb00367
commit de4f24f702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 63 additions and 59 deletions

View File

@ -93,20 +93,22 @@ export CXXFLAGS="$CXXFLAGS -I$SRC/cityhash/src"
export CRYPTOFUZZ_REFERENCE_CITY_O_PATH="$SRC/cityhash/src/city.o"
##############################################################################
# Compile cryptopp
cd $SRC/cryptopp
if [[ $CFLAGS != *sanitize=memory* ]]
then
# Compile cryptopp (with assembly)
cd $SRC/cryptopp
make -j$(nproc) >/dev/null 2>&1
else
CXXFLAGS="$CXXFLAGS -DCRYPTOPP_DISABLE_ASM=1" make -j$(nproc) >/dev/null 2>&1
fi
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_CRYPTOPP"
export LIBCRYPTOPP_A_PATH="$SRC/cryptopp/libcryptopp.a"
export CRYPTOPP_INCLUDE_PATH="$SRC/cryptopp"
# Compile Cryptofuzz cryptopp (with assembly) module
# Compile Cryptofuzz cryptopp module
cd $SRC/cryptofuzz/modules/cryptopp
make -B
fi
##############################################################################
# Compile mbed crypto
@ -149,8 +151,6 @@ cd $SRC/cryptofuzz/modules/botan
make -B
##############################################################################
if [[ $CFLAGS != *sanitize=memory* ]]
then
# Compile libgpg-error (dependency of libgcrypt)
cd $SRC/
tar jxvf libgpg-error-1.36.tar.bz2
@ -165,14 +165,17 @@ then
make install
export LINK_FLAGS="$LINK_FLAGS $SRC/libgpg-error-1.36/src/.libs/libgpg-error.a"
# Compile libgcrypt (with assembly)
# Compile libgcrypt
cd $SRC/libgcrypt
autoreconf -ivf
if [[ $CFLAGS != *-m32* ]]
if [[ $CFLAGS = *-m32* ]]
then
./configure --enable-static --disable-doc
else
./configure --enable-static --disable-doc --host=i386
elif [[ $CFLAGS = *sanitize=memory* ]]
then
./configure --enable-static --disable-doc --disable-asm
else
./configure --enable-static --disable-doc
fi
make -j$(nproc) >/dev/null 2>&1
@ -180,27 +183,28 @@ then
export LIBGCRYPT_A_PATH="$SRC/libgcrypt/src/.libs/libgcrypt.a"
export LIBGCRYPT_INCLUDE_PATH="$SRC/libgcrypt/src"
# Compile Cryptofuzz libgcrypt (with assembly) module
# Compile Cryptofuzz libgcrypt module
cd $SRC/cryptofuzz/modules/libgcrypt
make -B
fi
if [[ $CFLAGS != *sanitize=memory* ]]
then
# Compile libsodium (with assembly)
# Compile libsodium
cd $SRC/libsodium
autoreconf -ivf
if [[ $CFLAGS != *sanitize=memory* ]]
then
./configure
else
./configure --disable-asm
fi
make -j$(nproc) >/dev/null 2>&1
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_LIBSODIUM"
export LIBSODIUM_A_PATH="$SRC/libsodium/src/libsodium/.libs/libsodium.a"
export LIBSODIUM_INCLUDE_PATH="$SRC/libsodium/src/libsodium/include"
# Compile Cryptofuzz libsodium (with assembly) module
# Compile Cryptofuzz libsodium module
cd $SRC/cryptofuzz/modules/libsodium
make -B
fi
if [[ $CFLAGS != *sanitize=memory* && $CFLAGS != *-m32* ]]
then
@ -437,11 +441,11 @@ then
else
cmake -DCMAKE_CXX_FLAGS="$CXXFLAGS" -DCMAKE_C_FLAGS="$CFLAGS" -DBORINGSSL_ALLOW_CXX_RUNTIME=1 ..
fi
make -j$(nproc) crypto decrepit >/dev/null 2>&1
make -j$(nproc) crypto >/dev/null 2>&1
# Compile Cryptofuzz BoringSSL (with assembly) module
cd $SRC/cryptofuzz/modules/openssl
OPENSSL_INCLUDE_PATH="$SRC/boringssl/include" OPENSSL_LIBCRYPTO_A_PATH="$SRC/boringssl/build/crypto/libcrypto.a" CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_BORINGSSL" BORINGSSL_LIBDECREPIT_A_PATH="$SRC/boringssl/build/decrepit/libdecrepit.a" make -B
OPENSSL_INCLUDE_PATH="$SRC/boringssl/include" OPENSSL_LIBCRYPTO_A_PATH="$SRC/boringssl/build/crypto/libcrypto.a" CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_BORINGSSL" make -B
# Compile Cryptofuzz
cd $SRC/cryptofuzz
@ -464,11 +468,11 @@ cd $SRC/boringssl
rm -rf build ; mkdir build
cd build
cmake -DCMAKE_CXX_FLAGS="$CXXFLAGS" -DCMAKE_C_FLAGS="$CFLAGS" -DBORINGSSL_ALLOW_CXX_RUNTIME=1 -DOPENSSL_NO_ASM=1 ..
make -j$(nproc) crypto decrepit >/dev/null 2>&1
make -j$(nproc) crypto >/dev/null 2>&1
# Compile Cryptofuzz BoringSSL (with assembly) module
cd $SRC/cryptofuzz/modules/openssl
OPENSSL_INCLUDE_PATH="$SRC/boringssl/include" OPENSSL_LIBCRYPTO_A_PATH="$SRC/boringssl/build/crypto/libcrypto.a" CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_BORINGSSL" BORINGSSL_LIBDECREPIT_A_PATH="$SRC/boringssl/build/decrepit/libdecrepit.a" make -B
OPENSSL_INCLUDE_PATH="$SRC/boringssl/include" OPENSSL_LIBCRYPTO_A_PATH="$SRC/boringssl/build/crypto/libcrypto.a" CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_BORINGSSL" make -B
# Compile Cryptofuzz
cd $SRC/cryptofuzz