[tpm2-tss] Integrate tpm2-tss (#2189)

Signed-off-by: John Andersen <john.s.andersen@intel.com>
This commit is contained in:
John Andersen 2019-03-01 07:10:26 -08:00 committed by jonathanmetzman
parent 231ec64fa2
commit 32d9f390e6
3 changed files with 112 additions and 0 deletions

View File

@ -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/

View File

@ -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/

View File

@ -0,0 +1,6 @@
homepage: "https://github.com/tpm2-software/tpm2-tss"
primary_contact: "tadeusz.struk@intel.com"
sanitizers:
- address
- memory
- undefined