From aba3043190c4ab31073004143601ef2165b7f0d5 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Thu, 22 Aug 2019 16:57:42 +0200 Subject: [PATCH] [OpenSC] added fuzzing tests (#2726) --- projects/opensc/Dockerfile | 22 ++++++++++++++++++++++ projects/opensc/build.sh | 28 ++++++++++++++++++++++++++++ projects/opensc/project.yaml | 2 ++ 3 files changed, 52 insertions(+) create mode 100644 projects/opensc/Dockerfile create mode 100755 projects/opensc/build.sh diff --git a/projects/opensc/Dockerfile b/projects/opensc/Dockerfile new file mode 100644 index 000000000..eb8e30e97 --- /dev/null +++ b/projects/opensc/Dockerfile @@ -0,0 +1,22 @@ +# Copyright 2019 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder +MAINTAINER frankmorgner@gmail.com +RUN apt-get update && apt-get install -y pcscd libccid libpcsclite-dev libssl-dev libreadline-dev autoconf automake build-essential docbook-xsl xsltproc libtool pkg-config zlib1g-dev +RUN git clone --depth 1 --single-branch --branch master https://github.com/OpenSC/OpenSC opensc +WORKDIR opensc +COPY build.sh $SRC/ diff --git a/projects/opensc/build.sh b/projects/opensc/build.sh new file mode 100755 index 000000000..212d34a6b --- /dev/null +++ b/projects/opensc/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash -eu +# Copyright 2019 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +./bootstrap +# FIXME FUZZING_LIBS="$LIB_FUZZING_ENGINE" fails with some missing C++ library, I don't know how to fix this +./configure --disable-shared --disable-pcsc --enable-ctapi --enable-fuzzing FUZZING_LIBS="$LIB_FUZZING_ENGINE" +make -j4 + +cp src/tests/fuzzing/fuzz_asn1_print $OUT +cp src/tests/fuzzing/fuzz_asn1_sig_value $OUT +cp src/tests/fuzzing/fuzz_pkcs15_decode $OUT +cp src/tests/fuzzing/fuzz_pkcs15_reader $OUT + +#cp src/tests/fuzzing/fuzz_pkcs15_reader.options $OUT diff --git a/projects/opensc/project.yaml b/projects/opensc/project.yaml index e552eb3d1..7dade9c1b 100644 --- a/projects/opensc/project.yaml +++ b/projects/opensc/project.yaml @@ -4,3 +4,5 @@ auto_ccs: - "martin@martinpaljak.net" - "viktor.tarasov@gmail.com" - "ludovic.rousseau@gmail.com" +fuzzing_engines: + - libfuzzer