Skip to content
Stefan Berger edited this page Oct 29, 2018 · 51 revisions

Welcome to the libtpms wiki! Build Status

Libtpms provides TPM emulation for TPM 1.2 and TPM 2.0 without tying it to a specific storage backend or an interface for receiving TPM commands. One user of libtpms is swtpm.

Note about the TPM 2 preview branch(es)

The TPM 2 preview branch(es) provide TPM 2 support for libtpms. They are experimental in so far as backwards compatibility of the state the TPM 2 writes into its NVRAM file may not be maintained and thus the state written with one version of a preview branch may not be readable by another version. Also while work is ongoing the layout of the written state may change within one branch.

To-do list branch tpm2-preview.rev146

  • TPM2: check that all state is written properly: create test cases for swtpm that have lots of state defined and make sure the state is accessible on big and little endian machines
  • TPM2: clear all FIXMEs
  • TPM2: choose #defines for max. sizes of RSA keys etc.
  • TPM2: determine final size of NVRAM: 64KB

Compile and install on Linux

# Install dependencies
sudo dnf builddep dist/libtpms.spec
./autogen.sh
./configure --with-openssl --prefix=/usr --with-tpm2
make -j4
make check
sudo make install

Build a 32bit version on x86_64 Linux (for testing)

./autogen.sh
CFLAGS="-m32" ./configure --with-openssl --prefix=/usr --with-tpm2 --libdir=/lib
make clean
make -j4
make check
sudo make install

Compile and install on Cygwin

./autogen.sh
./configure --with-openssl --prefix=/usr --with-tpm2
make -j4
make check
make install

Compile and install on OpenBSD

./autogen.sh
CFLAGS="-O2" ./configure --with-openssl --prefix=/usr --with-tpm2
gmake -j 4
gmake check
sudo gmake install

Compile and install on OS/X

LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" CC=gcc ./autogen.sh --with-openssl --prefix=/Users/adminuser/ --with-tpm2
make -j4
make check
make install

Build a package on Ubuntu

sudo apt-get -y install automake autoconf libtool gcc build-essential
./autogen.sh
make dist
dpkg-buildpackage -us -uc -j4
# Install the library and development packages
cd ..
dpkg -i libtpms_0.x.y-z..._amd64.deb libtpm-dev_0.x.y-z..._amd64.deb