blob: faa2010165667c5071f49009deb74920d3e84ab1 [file] [log] [blame]
Balint Dobszayb8492472025-05-09 15:58:03 +02001TPM 2.0 service
2===============
3Overview
4--------
5A TPM is a Root of Trust component that is standardized by the Trusted Computing Group in the
6`TPM specification`_. The Trusted Services project implements the following TPM-related
7components:
8
9 * TPM Service CRB Interface Over FF-A (`DEN0138`_) RPC layer,
10 * TPM CRB provider,
11 * TPM backend using `ms-tpm-20-ref`_ library.
12
13These components are integrated as a Secure Partition in the fTPM deployment, which provides
14standard TPM 2.0 functionality to clients both in Normal World and Secure World. This service is
15suitable for platforms without discrete TPM hardware, while maintaining compatibility with software
16stacks expecting a standard TPM CRB interface.
17
18Communication with the fTPM follows the DEN0138 protocol, using shared memory for the CRB registers
19and FF-A direct messaging for signaling.
20
21.. image:: image/tpm-components.svg
22
23TPM CRB over FF-A RPC endpoint
24------------------------------
25Location: ``components/rpc/tpm_crb_ffa/endpoint/sp/tpm_crb_ffa_endpoint.c``
26
27This component handles the incoming FF-A direct requests and parses them according to the DEN0138
28specification. The functions defined by this specification fall into two categories:
29
30 * Management type functions, for controlling the TPM service frontend in the SP.
31 * Start function, to signal to the TPM backend that a locality request or command available in the
32 CRB should be processed.
33
34The management type functions are handled in this component, while the start function is passed to
35the TPM CRB provider.
36
37TPM CRB provider
38----------------
39Location: ``components/service/tpm/provider/tpm_crb_provider.c``
40
41This component provides the core logic for handling TPM CRB memory-mapped register access, it
42interprets CRB register state transitions. The two main types of events to handle are:
43
44 * Locality request: a client requests or relinquishes access to a locality.
45 * Command request: a client has placed a TPM command into a locality and requires processing of
46 the command.
47
48The locality requests are handled in this components, while the command request is passed to the
49TPM backend.
50
51TPM backend
52-----------
53Location: ``components/service/tpm/backend/ms_tpm/ms_tpm_backend.c``
54
55Currently a single type of TPM backend is supported, which is based on the ms-tpm-20-ref library.
56This is responsible for:
57
58 * Initial provisioning using ``TPM_Manufacture()``.
59 * Startup and runtime initialization of the TPM.
60 * Command execution: the memory buffer from the CRB which contains the incoming command is passed
61 to the library using ``ExecuteCommand()``, writing the response back to the same memory buffer.
62
63The platform, crypto library and build system related modifications for ms-tpm-20-ref are
64implemented in patch files found at ``external/ms_tpm/*.patch``. Summary of the modifications:
65
66 * CMake support: adds a simple CMake build system to the project which can compile the necessary
67 files into a static library an install it as a CMake package.
68 * Mbed TLS support: adds support for using hash, symmetric crypto and bignum operations from Mbed
69 TLS instead of OpenSSL.
70 * Platform porting: implements a minimal necessary platform layer to satisfy the requirements of
71 ms-tpm-20-ref. This includes:
72
73 * Non-volatile storage using PSA Storage API.
74 * Get entropy using Mbed TLS.
75
76Limitations
77-----------
78
79 * Handling of Locality 4 commands is not implemented.
80 * Hardware clock usage is not implemented, a software counter is used instead that's incremented
81 on each query.
82 * Handling of early boot measurements (from BL1 and BL2) is not implemented.
83
84--------------
85
86.. _`TPM specification`: https://trustedcomputinggroup.org/resource/tpm-library-specification/
87.. _`DEN0138`: https://developer.arm.com/documentation/den0138/latest
88.. _`ms-tpm-20-ref`: https://github.com/microsoft/ms-tpm-20-ref
89
90*Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.*
91
92SPDX-License-Identifier: BSD-3-Clause