From f4ede81eed29e6140374177d1f2808248c5b5650 Mon Sep 17 00:00:00 2001 From: Amarnath Valluri Date: Fri, 29 Sep 2017 14:10:20 +0300 Subject: tpm: Added support for TPM emulator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change introduces a new TPM backend driver that can communicate with swtpm(software TPM emulator) using unix domain socket interface. QEMU talks to the TPM emulator using QEMU's socket-based chardev backend device. Swtpm uses two Unix sockets for communications, one for plain TPM commands and responses, and one for out-of-band control messages. QEMU passes the data socket to be used over the control channel. 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 \ [...] \ -chardev socket,id=chrtpm,path=/tmp/swtpm-sock \ -tpmdev emulator,id=tpm0,chardev=chrtpm \ -device tpm-tis,tpmdev=tpm0 \ [...] Signed-off-by: Amarnath Valluri Reviewed-by: Marc-André Lureau Tested-by: Stefan Berger Signed-off-by: Stefan Berger --- configure | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'configure') diff --git a/configure b/configure index 6587e8014b..3c733f1a53 100755 --- a/configure +++ b/configure @@ -3495,6 +3495,12 @@ else tpm_passthrough=no fi +# TPM emulator is for all posix systems +if test "$mingw32" != "yes"; then + tpm_emulator=$tpm +else + tpm_emulator=no +fi ########################################## # attr probe @@ -5412,6 +5418,7 @@ echo "gcov enabled $gcov" echo "TPM support $tpm" echo "libssh2 support $libssh2" echo "TPM passthrough $tpm_passthrough" +echo "TPM emulator $tpm_emulator" echo "QOM debugging $qom_cast_debug" echo "Live block migration $live_block_migration" echo "lzo support $lzo" @@ -6011,12 +6018,16 @@ if test "$live_block_migration" = "yes" ; then echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak fi -# TPM passthrough support? if test "$tpm" = "yes"; then echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak + # TPM passthrough support? if test "$tpm_passthrough" = "yes"; then echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak fi + # TPM emulator support? + if test "$tpm_emulator" = "yes"; then + echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak + fi fi echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak -- cgit v1.2.1