Skip to content

Conversation

@LeviYeoReum
Copy link
Contributor

@LeviYeoReum LeviYeoReum commented Dec 5, 2025

FtpmDxe driver is a software-based TPM implementation built using the
[TPM 2.0 Reference Implementation Library][1] and the
[TPM Service Command Response Buffer Interface over FF-A][2] specification.

[The TPM 2.0 Reference Implementation Library][1] provides
the TPM functionality itself,
while [the TPM Service Command Response Buffer Interface over FF-A][2] defines
the communication mechanism between
the TPM and the system using FF-A (Firmware Framework for Arm A-profile).

With FtpmDxe driver, the platform where StandaloneMm is used
can use TPM functionality for:
- Block device encryption with LUKS using PCR.
- End-to-end measurement boot.

Patch #1-#4 add related information for FtpmDxe.
Patch #5 adds NV storage information used by FtpmDxe on VExpressPkg.
Patch #6 adds the PlatformTpmLib used by TpmLib for each platform.
Patch #7-#11 adds fTPM feature on VExpressPkg
Patch #12-#15 adds fTPM feature on JunoPkg
Patch #16-#18 adds feature for measured boot in VExpressPkg
Patch #19 adds feature for measured boot in JunoPkg
Patch #20 adds Readme.txt

Overview

Here is an overview how FtpmDxe works.

  1. with UEFI

    UEFI (Normal world) Secure World
                                |
    +--------------+            | +-----------+      +----------+
    |    Tcg2Dxe   |            | |  FtpmDxe  |<---->|  TpmLib  |
    +--------------+            | +-----------+      +----------+
            |                   |       |
            |                   |       ----------
            |                   |                |
            |                   |                |
            |                   |       +------------------+
            |                   |       | StandaloneMmCpu  |
            |                   |       +------------------+
            |                   |                |
            |                   |                |
            |                   |                |
    +----------------------+    |       +----------------------------+
    |  Tpm2InstanceFfaLib  |<---------->| StandaloneMmCoreEntryPoint |
    +----------------------+    .       |      (Misc Service)        |
                                .       +----------------------------+
                                .
                            Communicate via CRB over FF-A [0]
    
  2. with linux-kernel

    linux (Normal world) Secure World
                                |
    +----------------------+    | +-----------+      +----------+
    |  TPM infra-structure |    | |  FtpmDxe  |<---->|  TpmLib  |
    +----------------------+    | +-----------+      +----------+
            |                   |       |
            |                   |       ----------
            |                   |                |
            |                   |                |
            |                   |       +------------------+
            |                   |       | StandaloneMmCpu  |
            |                   |       +------------------+
            |                   |                |
            |                   |                |
            |                   |                |
    +----------------------+    |       +----------------------------+
    |  tpm_crb_ffa driver  |<---------->| StandaloneMmCoreEntryPoint |
    +----------------------+    .       |      (Misc Service)        |
                                .       +----------------------------+
                                .
                  Communicate via CRB over FF-A [0]
    

When a TPM command is initiated by Tpm2InstanceFfaLib or
tpm_crb_ffa driver according to
[the TPM Service Command Response Buffer Interface over FF-A][2] specitication,
FtpmDxe receives the command request and it calls the TpmLib which
is wrapper library of [The TPM 2.0 Reference Implementation Library][1]
to handle the command properly.

After TpmLib handles the TPM command via
[The TPM 2.0 Reference Implementation Library][1].
It delivers the result according to
[the TPM Service Command Response Buffer Interface over FF-A][2] specitication.

References

[1] https://github.com/TrustedComputingGroup/TPM
[2] https://developer.arm.com/documentation/den0138/latest/

To support fTPM, defines some Pcds and Protocols.

Pcds:
  PcdTpmEmuNvMemory - if true, PcdTpmNvMemoryBase is general memory address.
                      not device mapped memory address.
                      This is useful for enviroment NV image saved as file
                      and loaded in memory (i.e) StandaloneMm running in RMM

  PcdTpmNvMemoryBase - Tpm Nv storage start address.
  PcdTpmNvMemorySize - Tpm Nv storage area size.

Protocols:
  gEdkiiTpmBlockIoProtocolGuid - Tpm Nv Storage with BlockIoProtocol.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
TPM storage is required to save TPM related information.
For this, install TPM Norflash instance with BlockIoProtocol2.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
In case of ARM, TPM Crb buffer area can be separated:
(i.e) locality from 0 to 3 crb buffers allocated in normal memory area
      locality 4 crb buffers allocated in secure memory area.

So, add PcdTpmSecureCrbBase/Size pcds used by StandaloneMm.
PcdTpmBaseAddress, PcdTpmCrbRegionSize and PcdTpmMaxAddress used for
normal memory area crb buffers only.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
FtpmDxe driver is software based TPM using TpmLib.
Below is the overview how FtpmDxe handles TPM request with TpmLib:

     Normal world              |         Secure World
-------------------------------|------------------------------
                               |
   +--------------+            | +-----------+      +----------+
   |    Tcg2Dxe   |            | |  FtpmDxe  |<---->|  TpmLib  |
   +--------------+            | +-----------+      +----------+
           |                   |       |
           |                   |       ----------
           |                   |                |
           |                   |                |
           |                   |       +------------------+
           |                   |       | StandaloneMmCpu  |
           |                   |       +------------------+
           |                   |                |
           |                   |                |
           |                   |                |
   +----------------------+    |       +----------------------------+
   |  Tpm2InstanceFfaLib  |<---------->| StandaloneMmCoreEntryPoint |
   +----------------------+    .       |      (Misc Service)        |
                               .       +----------------------------+
                               .
                           Communicate via CRB over FF-A [0]

FtpmDxe driver receives the TPM request from Tpm2InstanceFfaLib
via CRB over FF-A [0] and pass its request to TpmLib to handle the
request.

Link: https://developer.arm.com/documentation/den0138/latest/ [0]
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
…rmation

add TPM NV storage information in StandaloneMm.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
PlatformTpmLib is used in TpmLib to implement software based TPM
by defining platform specific functions used by TpmLib.
PlatformArmDefaultTpmLib is library implementing PlatformTpmLib default
in Arm Platform

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
add fTPM feature for StandaloneMm.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Enable TPM function in VExpressPkg.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
To generate TPM2 acpi table, add TPM information for fTPM in
ConfigurationManager.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
To generate TPM2 acpi table, add TPM information for fTPM in
ConfigurationManager with SIP.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
For fTPM, add CRB memory area in VExpressPkg.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Enable TPM function in JunoPkg.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
To generate TPM2 acpi table, add TPM information for fTPM in
ConfigurationManager.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
For fTPM, add CRB memory area for JunoPkg.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
On Juno, the StandaloneMM Boot Firmware Volume (BFV) is not in
the Flash area. Instead it is loaded in to the RAM by TF-A.

Therefore, disable the shadow copying of the BFV in StandaloneMM.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
This patch adds support for SEC/PEI phase for VExpressPkg with
support of measured boot.
For this, some of define check of EDK2_SKIP_PEICORE to variable check,
add Tcg2Pei PEIM and includes required PEIM drivers.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Move ArmFfaLib including from ArmVExpress-FVP-AArch64.dsc into
ArmVExpress.dsc.inc

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
This patch adds feature for PeilessSec measures
  - CRTM Start event
  - Main Firmware Volume

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
This patch adds feature for PeilessSec measures
  - CRTM Start event
  - Main Firmware Volume

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Add Readme.txt file for FtmpDxe.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
@LeviYeoReum LeviYeoReum force-pushed the levi/3428_tpm_poc_upstream branch from 1bd77f7 to 03c45fe Compare December 21, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant