aboutsummaryrefslogtreecommitdiff
path: root/projects/tpm2-tss
diff options
context:
space:
mode:
authorJohn Andersen <johnandersenpdx@gmail.com>2019-03-01 07:10:26 -0800
committerjonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2019-03-01 07:10:26 -0800
commit32d9f390e63c88ffa7c1bb82504ece7684f15378 (patch)
tree548768c99456073ed06daf50b75ae3a683d63d02 /projects/tpm2-tss
parent231ec64fa2b2e35a035cea7447f9cab802c08480 (diff)
downloadoss-fuzz-32d9f390e63c88ffa7c1bb82504ece7684f15378.tar.gz
[tpm2-tss] Integrate tpm2-tss (#2189)
Signed-off-by: John Andersen <john.s.andersen@intel.com>
Diffstat (limited to 'projects/tpm2-tss')
-rw-r--r--projects/tpm2-tss/Dockerfile69
-rw-r--r--projects/tpm2-tss/build.sh37
-rw-r--r--projects/tpm2-tss/project.yaml6
3 files changed, 112 insertions, 0 deletions
diff --git a/projects/tpm2-tss/Dockerfile b/projects/tpm2-tss/Dockerfile
new file mode 100644
index 000000000..c4ec77fab
--- /dev/null
+++ b/projects/tpm2-tss/Dockerfile
@@ -0,0 +1,69 @@
+# 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
+
+RUN apt-get update && \
+ apt-get install -y \
+ autoconf \
+ autoconf-archive \
+ automake \
+ build-essential \
+ doxygen \
+ g++ \
+ gcc \
+ git \
+ gnulib \
+ libssl-dev \
+ libtool \
+ m4 \
+ net-tools \
+ pkg-config \
+ wget \
+ libcmocka0 \
+ libcmocka-dev \
+ libgcrypt20-dev \
+ libtool \
+ liburiparser-dev \
+ uthash-dev
+
+# OpenSSL
+ARG openssl_name=openssl-1.1.0h
+WORKDIR /tmp
+RUN wget --quiet --show-progress --progress=dot:giga https://www.openssl.org/source/$openssl_name.tar.gz \
+ && tar xvf $openssl_name.tar.gz \
+ && rm /tmp/$openssl_name.tar.gz
+WORKDIR $openssl_name
+RUN ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl \
+ && make -j$(nproc) \
+ && make install \
+ && openssl version
+
+# IBM's Software TPM 2.0
+ARG ibmtpm_name=ibmtpm1119
+WORKDIR /tmp
+RUN wget --quiet --show-progress --progress=dot:giga "https://downloads.sourceforge.net/project/ibmswtpm2/$ibmtpm_name.tar.gz" \
+ && sha256sum $ibmtpm_name.tar.gz | grep ^b9eef79904e276aeaed2a6b9e4021442ef4d7dfae4adde2473bef1a6a4cd10fb \
+ && mkdir -p $ibmtpm_name \
+ && tar xvf $ibmtpm_name.tar.gz -C $ibmtpm_name \
+ && rm $ibmtpm_name.tar.gz
+WORKDIR $ibmtpm_name/src
+RUN CFLAGS="-I/usr/local/openssl/include" make -j$(nproc) \
+ && cp tpm_server /usr/local/bin
+
+RUN git clone --depth 1 \
+ https://github.com/tpm2-software/tpm2-tss $SRC/tpm2-tss/
+WORKDIR $SRC/tpm2-tss/
+COPY build.sh $SRC/
diff --git a/projects/tpm2-tss/build.sh b/projects/tpm2-tss/build.sh
new file mode 100644
index 000000000..53524b4b6
--- /dev/null
+++ b/projects/tpm2-tss/build.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# 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.
+#
+################################################################################
+
+cd $SRC/tpm2-tss/
+
+export LD_LIBRARY_PATH=/usr/local/bin
+
+GEN_FUZZ=1 ./bootstrap
+./configure \
+ CC=clang \
+ CXX=clang++ \
+ --enable-debug \
+ --with-fuzzing=ossfuzz \
+ --enable-tcti-fuzzing \
+ --enable-tcti-device=no \
+ --enable-tcti-mssim=no \
+ --disable-doxygen-doc \
+ --disable-shared
+
+sed -i 's/@DX_RULES@/# @DX_RULES@/g' Makefile
+make -j $(nproc) fuzz-targets
+
+cp -v test/fuzz/*.fuzz $OUT/
diff --git a/projects/tpm2-tss/project.yaml b/projects/tpm2-tss/project.yaml
new file mode 100644
index 000000000..c7061578c
--- /dev/null
+++ b/projects/tpm2-tss/project.yaml
@@ -0,0 +1,6 @@
+homepage: "https://github.com/tpm2-software/tpm2-tss"
+primary_contact: "tadeusz.struk@intel.com"
+sanitizers:
+ - address
+ - memory
+ - undefined