Build OpenSSL+Rust target (#1222)

This commit is contained in:
Guido Vranken 2018-03-10 02:59:41 +01:00 committed by Abhishek Arya
parent df573a03e2
commit c5f13b4ce5
2 changed files with 24 additions and 8 deletions

View File

@ -16,10 +16,13 @@
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 wget
RUN apt-get update && apt-get install -y software-properties-common python-software-properties wget curl sudo
RUN add-apt-repository -y ppa:gophers/archive && apt-get update && apt-get install -y golang-1.9-go
RUN ln -s /usr/lib/go-1.9/bin/go /usr/bin/go
# Install Rust nightly
RUN curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly
RUN git clone --depth 1 https://github.com/guidovranken/bignum-fuzzer
RUN git clone --depth 1 https://github.com/openssl/openssl
COPY build.sh $SRC/

View File

@ -3,7 +3,7 @@ if [[ $CFLAGS = *sanitize=memory* ]]
then
CFLAGS+=" -DOPENSSL_NO_ASM=1"
fi
./config $CFLAGS
./config
make -j$(nproc)
# Build OpenSSL module
@ -14,18 +14,31 @@ OPENSSL_INCLUDE_PATH=$SRC/openssl/include OPENSSL_LIBCRYPTO_A_PATH=$SRC/openssl/
cd $SRC/bignum-fuzzer/modules/go
make
CXXFLAGS+=" -DBNFUZZ_FLAG_NO_NEGATIVE=1 -DBNFUZZ_FLAG_NUM_LEN=1200 -DBNFUZZ_FLAG_ALL_OPERATIONS=1"
# Build Rust module
cd $SRC/bignum-fuzzer/modules/rust
make
# Build fuzzer
BASE_CXXFLAGS=$CXXFLAGS
# Build OpenSSL/Go fuzzer
cd $SRC/bignum-fuzzer
./config-modules.sh openssl go
CXXFLAGS="$BASE_CXXFLAGS -DBNFUZZ_FLAG_NO_NEGATIVE=1 -DBNFUZZ_FLAG_NUM_LEN=1200 -DBNFUZZ_FLAG_ALL_OPERATIONS=1"
LIBFUZZER_LINK="-lFuzzingEngine" make
cd $SRC
# Copy fuzzer to the designated location
# Copy OpenSSL/Go fuzzer to the designated location
cp $SRC/bignum-fuzzer/fuzzer $OUT/fuzzer_openssl_go_no_negative_num_len_1200_all_operations
# Build OpenSSL/Rust fuzzer
cd $SRC/bignum-fuzzer
make clean
./config-modules.sh openssl rust
CXXFLAGS="$BASE_CXXFLAGS -DBNFUZZ_FLAG_NUM_LEN=1200 -DBNFUZZ_FLAG_ALL_OPERATIONS=1 -DBNFUZZ_FLAG_NUM_LOOPS=1"
LIBFUZZER_LINK="-lFuzzingEngine" make
# Copy seed corpus to the designated location
# Copy OpenSSL/Rust fuzzer to the designated location
cp $SRC/bignum-fuzzer/fuzzer $OUT/fuzzer_openssl_rust_num_len_1200_all_operations_num_loops_1
# Copy seed corpora to the designated location
cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_go_no_negative_num_len_1200_all_operations_seed_corpus.zip $OUT
cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_rust_num_len_1200_all_operations_num_loops_1_seed_corpus.zip $OUT