Build and installation on Linux - mrcdb/ms-tpm-20-ref GitHub Wiki

Build Microsoft TPM 2.0 Simulator

This section covers the steps to manually build and install the TPM 2.0 Simulator on a x86_64 Linux Ubuntu 18.04 LTS distribution. The steps to automate the process via Docker are described too.

Manual build

Clone the repository as follows:

$ git clone https://github.com/mrcdb/ms-tpm-20-ref.git
$ cd ms-tpm-20-ref
$ git checkout linux-build

You can compile the Microsoft TPM 2.0 Simulator binary with the following commands. First, install required dependencies:

# apt update && apt install -y --no-install-recommends \
    make git build-essential libpthread-workqueue-dev ca-certificates

Then, move to the TPMCmd directory and run the following commands:

# openssl/build.sh
# make -j5

The tpm_server binary will be available under the TPMCmd/build directory.

Docker-based build

Just run the following command to build the MS TPM 2.0:

$ docker-compose up --build

When the process ends, the tpm_server binary is available under the build directory.

Install and run the MS TPM 2.0 Reference Implementation

The tpm_server binary requires super-user rights to run. You can run it from the build folder or copy it in a system-wide execution directory as follows:

# cp build/tpm_server /usr/sbin/

Now, the tpm_server application can be run as follows:

$ tpm_server

If the instantiation succeeds, you will see an output like this:

TPM command server listening on port 2321
Platform server listening on port 2322

The following command shows the helper of the vTPM simulator:

$ tpm_server -h

which shows that it only accepts a single optional parameter, i.e. the TCP port for the vTPM command server. The TPM also allocates the next port for the platform server.

N.B The MS TPM 2.0 Reference Implementation creates a file named NVChip with the vTPM context data in the current directory.