1#!/usr/bin/env sh
2# The copyright in this software is being made available under the BSD License,
3# included below. This software may be subject to other third party and
4# contributor rights, including patent rights, and no such rights are granted
5# under this license.
6#
7# Copyright (c) Intel Corporation
8#
9# All rights reserved.
10#
11# BSD License
12#
13# Redistribution and use in source and binary forms, with or without modification,
14# are permitted provided that the following conditions are met:
15#
16# Redistributions of source code must retain the above copyright notice, this list
17# of conditions and the following disclaimer.
18#
19# Redistributions in binary form must reproduce the above copyright notice, this
20# list of conditions and the following disclaimer in the documentation and/or
21# other materials provided with the distribution.
22#
23# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
24# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34# Script will build tpm2-simulator by using DeviceID.
35# CAUTION: Endorsement seed derived from device unique IDs are guaranteed to remain the same as long as the reference
36#   implementation manufactures its NV state on the same device. It relies on publicly accessible values
37#   storage device serial numbers and networking card MAC address), it can only be used for the simulation purposes,
38#   as it cannot be used to produce a secret value.
39
40basedir=$1
41
42# Copy needed tpm simulator reference implementation source code files.
43cp -r -n -v $basedir/TPMCmd/* $basedir/Samples/TPMCmd-DeviceID
44
45cd $basedir/Samples/TPMCmd-DeviceID
46
47./bootstrap
48./configure --enable-usedeviceid=yes
49make -j2
50
51cd $basedir
52
53