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