[cryptofuzz] Add Crypto++ and libgcrypt (#2401)

This commit is contained in:
Guido Vranken 2019-05-14 18:45:13 +02:00 committed by Kostya Serebryany
parent 3df4e14520
commit 3d4e351c0b
3 changed files with 50 additions and 1 deletions

View File

@ -17,7 +17,7 @@
FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER guidovranken@gmail.com
RUN apt-get update && apt-get install -y software-properties-common python-software-properties make autoconf automake libtool build-essential cmake libboost-all-dev
RUN apt-get update && apt-get install -y software-properties-common python-software-properties make autoconf automake libtool build-essential cmake libboost-all-dev wget
# BoringSSL needs Go to build
RUN add-apt-repository -y ppa:gophers/archive && apt-get update && apt-get install -y golang-1.9-go
@ -31,5 +31,8 @@ RUN git clone --depth 1 https://boringssl.googlesource.com/boringssl
RUN git clone --depth 1 https://github.com/libressl-portable/portable libressl
RUN cd $SRC/libressl && ./update.sh
RUN git clone --depth 1 https://github.com/jedisct1/libsodium.git
RUN git clone --depth 1 https://github.com/weidai11/cryptopp/
RUN git clone --depth 1 https://dev.gnupg.org/source/libgcrypt.git
RUN wget https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.36.tar.bz2
COPY build.sh $SRC/

View File

@ -18,6 +18,8 @@
# TODO(metzman): Switch this to LIB_FUZZING_ENGINE when it works.
# https://github.com/google/oss-fuzz/issues/2336
export LINK_FLAGS=""
# Generate lookup tables. This only needs to be done once.
cd $SRC/cryptofuzz
python gen_repository.py
@ -30,6 +32,49 @@ then
export CXXFLAGS="$CXXFLAGS -DMSAN"
fi
##############################################################################
if [[ $CFLAGS != *sanitize=memory* ]]
then
# Compile cryptopp (with assembly)
cd $SRC/cryptopp
make -j$(nproc)
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
cd $SRC/cryptofuzz/modules/cryptopp
make -B
fi
##############################################################################
if [[ $CFLAGS != *sanitize=memory* ]]
then
# Compile libgpg-error (dependency of libgcrypt)
cd $SRC/
tar jxvf libgpg-error-1.36.tar.bz2
cd libgpg-error-1.36/
./configure --enable-static
make -j$(nproc)
make install
export LINK_FLAGS="$LINK_FLAGS $SRC/libgpg-error-1.36/src/.libs/libgpg-error.a"
# Compile libgcrypt (with assembly)
cd $SRC/libgcrypt
autoreconf -ivf
./configure --enable-static --disable-doc
make -j$(nproc)
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_LIBGCRYPT"
export LIBGCRYPT_A_PATH="$SRC/libgcrypt/src/.libs/libgcrypt.a"
export LIBGCRYPT_INCLUDE_PATH="$SRC/libgcrypt/src"
# Compile Cryptofuzz libgcrypt (with assembly) module
cd $SRC/cryptofuzz/modules/libgcrypt
make -B
fi
##############################################################################
if [[ $CFLAGS != *sanitize=memory* ]]
then

View File

@ -11,6 +11,7 @@ auto_ccs:
- "joel.sing@gmail.com"
- "kinichiro.inoguchi@gmail.com"
- "github@pureftpd.org"
- "jussi.kivilinna@gmail.com"
sanitizers:
- address
- undefined