1#!/bin/sh
2# Copyright 2019 Google Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17
18cd $SRC/tpm2-tss/
19
20export LD_LIBRARY_PATH=/usr/local/bin
21
22export GEN_FUZZ=1
23
24./bootstrap
25./configure \
26  CC=$CC \
27  CXX=$CXX \
28  --enable-debug \
29  --with-fuzzing=ossfuzz \
30  --enable-tcti-fuzzing \
31  --disable-tcti-device \
32  --disable-tcti-mssim \
33  --disable-tcti-swtpm \
34  --disable-doxygen-doc \
35  --disable-shared \
36  --disable-fapi
37
38sed -i 's/@DX_RULES@/# @DX_RULES@/g' Makefile
39make -j $(nproc) fuzz-targets
40
41for filename in $(ls test/fuzz/*.fuzz); do
42  cp -v $filename $OUT/$(echo $(basename $filename .fuzz))
43done
44