On 07/18/2017 04:49 AM, Amarnath Valluri wrote:
This change introduces a new TPM backend driver that can communicate with
swtpm(software TPM emulator) using unix domain socket interface.
Swtpm uses two unix sockets, one for plain TPM commands and responses, and one
for out-of-band control messages.
The swtpm and associated tools can be found here:
https://github.com/stefanberger/swtpm
The swtpm's control channel protocol specification can be found here:
https://github.com/stefanberger/swtpm/wiki/Control-Channel-Specification
Usage:
# setup TPM state directory
mkdir /tmp/mytpm
chown -R tss:root /tmp/mytpm
/usr/bin/swtpm_setup --tpm-state /tmp/mytpm --createek
# Ask qemu to use TPM emulator with given tpm state directory
qemu-system-x86_64 \
[...] \
-tpmdev emulator,id=tpm0,tpmstatedir=/tmp/mytpm,logfile=/tmp/swtpm.log
\
-device tpm-tis,tpmdev=tpm0 \
[...]
In this description ',spawn,path=/usr/bin/swtpm' is missing. I had to
pass the path even with swtpm being in PATH on the command line but not
for the execv(). In case it didn't find the executable I had to
eliminate g_strfreev(argv) since it also wants to free the array itself,
so it wouldn't end up in a crash.
Stefan