aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nickolay Olshevsky <o.nickolay@gmail.com>2020-09-02 20:26:26 +0300
committerGravatar GitHub <noreply@github.com>2020-09-02 10:26:26 -0700
commite02f4c2e63dd00b9472fed34c7226acc4fa9417d (patch)
tree8006e812de1a57cfc5a338a71a56e0f57fd17487
parenta6af9885b0473d1e6e6cdc627e13e3a9499cafa9 (diff)
[rnp] add more fuzzers and update build script. (#4391)
* [rnp] remove verbose flag during botan unpacking. * [rnp] use as much make jobs, as available. * [rnp] stick to the $SRC folder during the build. * [rnp] automatically detect fuzzers and ignore possible chrpath error.
-rwxr-xr-xprojects/rnp/Dockerfile2
-rwxr-xr-xprojects/rnp/build.sh26
2 files changed, 14 insertions, 14 deletions
diff --git a/projects/rnp/Dockerfile b/projects/rnp/Dockerfile
index ce149a4a..bd2f6f62 100755
--- a/projects/rnp/Dockerfile
+++ b/projects/rnp/Dockerfile
@@ -31,5 +31,5 @@ RUN apt-get install -y \
wget
RUN git clone --depth 1 https://github.com/rnpgp/rnp.git rnp
-WORKDIR rnp/..
+WORKDIR $SRC
COPY build.sh $SRC/
diff --git a/projects/rnp/build.sh b/projects/rnp/build.sh
index bee2e13e..cf22dca7 100755
--- a/projects/rnp/build.sh
+++ b/projects/rnp/build.sh
@@ -15,28 +15,27 @@
#
################################################################################
-ORIG_DIR=$(pwd)
+cd $SRC
-wget -qO- https://botan.randombit.net/releases/Botan-2.12.1.tar.xz | tar xvJ
+wget -qO- https://botan.randombit.net/releases/Botan-2.12.1.tar.xz | tar xJ
cd Botan-2.12.1
./configure.py --prefix=/usr --cc-bin=$CXX --cc-abi-flags="$CXXFLAGS" \
--disable-modules=locking_allocator \
--unsafe-fuzzer-mode --build-fuzzers=libfuzzer \
--with-fuzzer-lib='FuzzingEngine'
-make
+make -j$(nproc)
make install
-cd $ORIG_DIR
+cd $SRC
mkdir fuzzing_corpus
-cd rnp/src/tests/data
-find . -type f -print0 | xargs -0 -I bob -- cp bob $ORIG_DIR/fuzzing_corpus/
-
-cd $ORIG_DIR
+cd $SRC/rnp/src/tests/data
+find . -type f -print0 | xargs -0 -I bob -- cp bob $SRC/fuzzing_corpus/
# -DENABLE_SANITIZERS=0 because oss-fuzz will add the sanitizer flags in CFLAGS
# See https://github.com/google/oss-fuzz/pull/4189 to explain CMAKE_C_LINK_EXECUTABLE
+cd $SRC
mkdir rnp-build
cd rnp-build
cmake \
@@ -49,14 +48,15 @@ cmake \
-DBUILD_SHARED_LIBS=on \
-DBUILD_TESTING=off \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
- ../rnp/
-make
+ $SRC/rnp
+make -j$(nproc)
-FUZZERS="fuzz_dump fuzz_keyring"
+FUZZERS=`find src/fuzzing -maxdepth 1 -type f -name "fuzz_*" -exec basename {} \;`
+printf "Detected fuzzers: \n$FUZZERS\n"
for f in $FUZZERS; do
cp src/fuzzing/$f "${OUT}/"
- chrpath -r '$ORIGIN/lib' "${OUT}/$f"
- zip -j -r "${OUT}/${f}_seed_corpus.zip" $ORIG_DIR/fuzzing_corpus/
+ chrpath -r '$ORIGIN/lib' "${OUT}/$f" || echo "chrpath failed with $?, ignoring."
+ zip -j -r "${OUT}/${f}_seed_corpus.zip" $SRC/fuzzing_corpus/
done
mkdir -p "${OUT}/lib"