On Fri, Mar 11, 2016 at 09:51:03PM -0500, Stefan Berger wrote:
This patch implements a proxy driver for supporting multiple emulated TPMsWith my test script [1] running on QEMU and TPM 2.0 simulator running on the
in a system.
The driver implements a device /dev/vtpmx that is used to created
a client device pair /dev/tpmX (e.g., /dev/tpm10) and a server side that
is accessed using a file descriptor returned by an ioctl.
The device /dev/tpmX is the usual TPM device created by the core TPM
driver. Applications or kernel subsystems can send TPM commands to it
and the corresponding server-side file descriptor receives these
commands and delivers them to an emulated TPM.
host side I get this:
$ python tpm2-simulator-vtpm --host=10.0.2.2
cmd
80 01 00 00 00 0c 00 00 01 44 00 00
rsp
80 01 00 00 00 0a 00 00 00 00
Traceback (most recent call last):
File "tpm2-simulator-vtpm", line 85, in <module>
main()
File "tpm2-simulator-vtpm", line 80, in main
resp = client.send_cmd(stream)
File "/home/tpmdd/tpm2-scripts/tpm2.py", line 454, in send_cmd
rsp = self.simulator.send_cmd(cmd)
File "/home/tpmdd/tpm2-scripts/tpm2.py", line 436, in send_cmd
raise SimulatorError("Empty response")
tpm2.SimulatorError: Empty response
However, the process does not exit before the read call expires:
$ python tpm2-list-handles
Traceback (most recent call last):
File "tpm2-list-handles", line 61, in <module>
main()
File "tpm2-list-handles", line 51, in main
handles += client.get_cap(tpm2.TPM2_CAP_HANDLES, tpm2.HR_LOADED_SESSION)
File "/home/tpmdd/tpm2-scripts/tpm2.py", line 782, in get_cap
next_handles, more_data = self.__get_cap_cnt(cap, pt, 1)
File "/home/tpmdd/tpm2-scripts/tpm2.py", line 766, in __get_cap_cnt
rsp = self.send_cmd(cmd)[10:]
File "/home/tpmdd/tpm2-scripts/tpm2.py", line 458, in send_cmd
rsp = f.read()
IOError: [Errno 62] Timer expired
The server side stays stuck unti this happens.