tpm_vtpm_proxy.rst 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. =============================================
  2. Virtual TPM Proxy Driver for Linux Containers
  3. =============================================
  4. | Authors:
  5. | Stefan Berger <stefanb@linux.vnet.ibm.com>
  6. This document describes the virtual Trusted Platform Module (vTPM)
  7. proxy device driver for Linux containers.
  8. Introduction
  9. ============
  10. The goal of this work is to provide TPM functionality to each Linux
  11. container. This allows programs to interact with a TPM in a container
  12. the same way they interact with a TPM on the physical system. Each
  13. container gets its own unique, emulated, software TPM.
  14. Design
  15. ======
  16. To make an emulated software TPM available to each container, the container
  17. management stack needs to create a device pair consisting of a client TPM
  18. character device ``/dev/tpmX`` (with X=0,1,2...) and a 'server side' file
  19. descriptor. The former is moved into the container by creating a character
  20. device with the appropriate major and minor numbers while the file descriptor
  21. is passed to the TPM emulator. Software inside the container can then send
  22. TPM commands using the character device and the emulator will receive the
  23. commands via the file descriptor and use it for sending back responses.
  24. To support this, the virtual TPM proxy driver provides a device ``/dev/vtpmx``
  25. that is used to create device pairs using an ioctl. The ioctl takes as
  26. an input flags for configuring the device. The flags for example indicate
  27. whether TPM 1.2 or TPM 2 functionality is supported by the TPM emulator.
  28. The result of the ioctl are the file descriptor for the 'server side'
  29. as well as the major and minor numbers of the character device that was created.
  30. Besides that the number of the TPM character device is returned. If for
  31. example ``/dev/tpm10`` was created, the number (``dev_num``) 10 is returned.
  32. Once the device has been created, the driver will immediately try to talk
  33. to the TPM. All commands from the driver can be read from the file descriptor
  34. returned by the ioctl. The commands should be responded to immediately.
  35. UAPI
  36. ====
  37. .. kernel-doc:: include/uapi/linux/vtpm_proxy.h
  38. .. kernel-doc:: drivers/char/tpm/tpm_vtpm_proxy.c
  39. :functions: vtpmx_ioc_new_dev