From 6b27f9b7facf869d32a7f5d43aeaccdc2a406d80 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 10 Dec 2016 12:28:26 -0500 Subject: [PATCH] [gnutls] use an initial corpus for x509 (#164) * [gnutls] use an initial corpus for x509 and add OpenSSL's corpus for client transcripts * Use --depth=1 on clones --- projects/gnutls/Dockerfile | 23 +++++++++++++++++------ projects/gnutls/build.sh | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/projects/gnutls/Dockerfile b/projects/gnutls/Dockerfile index 6daadb568..6b0e9ae88 100644 --- a/projects/gnutls/Dockerfile +++ b/projects/gnutls/Dockerfile @@ -18,14 +18,25 @@ FROM ossfuzz/base-libfuzzer MAINTAINER alex.gaynor@gmail.com RUN apt-get install -y make autoconf automake libtool autopoint libnettle6 nettle-dev pkg-config gperf bison autogen texinfo curl -RUN git clone https://gitlab.com/gnutls/gnutls.git +RUN git clone --depth=1 https://gitlab.com/gnutls/gnutls.git RUN cd gnutls && git submodule update --init -# Using the client_corpus transcripts from boringssl, they're a decent starting point. -RUN mkdir boringssl-testcases -RUN cd boringssl-testcases/ && curl https://boringssl.googlesource.com/boringssl/+archive/master/fuzz/client_corpus.tar.gz | tar -zx -RUN cd boringssl-testcases/ && curl https://boringssl.googlesource.com/boringssl/+archive/master/fuzz/client_corpus_no_fuzzer_mode.tar.gz | tar -zx -RUN zip gnutls_client_fuzzer_seed_corpus.zip boringssl-testcases/* +# clone OpenSSL to get it's fuzzer testcases +RUN git clone --depth=1 https://github.com/openssl/openssl + +# Using the client_corpus transcripts from BoringSSL and OpenSSL, they're a +# decent starting point. +RUN mkdir client-testcases +RUN cd client-testcases/ && curl https://boringssl.googlesource.com/boringssl/+archive/master/fuzz/client_corpus.tar.gz | tar -zx +RUN cd client-testcases/ && curl https://boringssl.googlesource.com/boringssl/+archive/master/fuzz/client_corpus_no_fuzzer_mode.tar.gz | tar -zx +RUN cp openssl/fuzz/corpora/client/* client-testcases/ +RUN zip gnutls_client_fuzzer_seed_corpus.zip client-testcases/* + +# Same thing for X.509 +RUN mkdir x509-testcases +RUN cd x509-testcases/ && curl https://boringssl.googlesource.com/boringssl/+archive/master/fuzz/cert_corpus.tar.gz | tar -zx +RUN cp openssl/fuzz/corpora/x509/* x509-testcases/ +RUN zip gnutls_x509_parser_fuzzer_seed_corpus.zip x509-testcases/* WORKDIR gnutls COPY build.sh gnutls_client_fuzzer.cc gnutls_x509_parser_fuzzer.cc $SRC/ diff --git a/projects/gnutls/build.sh b/projects/gnutls/build.sh index ba66f8b3c..83e44b682 100755 --- a/projects/gnutls/build.sh +++ b/projects/gnutls/build.sh @@ -29,6 +29,6 @@ for fuzzer in $fuzzers; do "$SRC/gnutls_${fuzzer}_fuzzer.cc" -o "$OUT/gnutls_${fuzzer}_fuzzer" \ lib/.libs/libgnutls.a -lFuzzingEngine -lpthread -Wl,-Bstatic \ -lhogweed -lnettle -lgmp -Wl,-Bdynamic -done -cp "$SRC/gnutls_client_fuzzer_seed_corpus.zip" "$OUT/" + cp "$SRC/gnutls_${fuzzer}_fuzzer_seed_corpus.zip" "$OUT/" +done