# TCMPEI

| Field       | Value                                      |
|-------------|--------------------------------------------|
| Index       | 394                                        |
| Module      | TCMPEI                                     |
| Size        | 6,116 bytes (17E4h)                        |
| Phase       | PEI                                        |
| SHA256      | ae74108b593aaea9b4be5a9406ea06f75ee32f36d115935eb9b5c08a2f9cb5a3 |
| Functions   | 42                                         |

## Overview

TCMPEI is a PEI module implementing TCM (Trusted Cryptography Module) support, the Chinese national standard TPM alternative (GM/T 002-2012). It provides TCM startup, self-test, physical presence management, and hash operations using the SM3 cryptographic hash algorithm. This module enables TPM-compatible trusted boot on platforms that use TCM instead of a standard TPM.

## Key Functions

- **TcmStartupClear** -- TCM Startup (ST_CLEAR) followed by ContinueSelfTest
- **TcmStartupState** -- TCM Startup (ST_STATE) followed by ContinueSelfTest
- **TcmPhysicalEnable** -- TCM Physical Enable and Set Active
- **TcmPhysicalSetDeactivated** -- TCM Set Deactivate and Physical Disable
- **TcmForceClear** -- TCM Force Clear
- **TcmGetFlags** -- TCM Get Permanent Flags (Pflag) and Volatile Flags (Vflag)
- **TcmSm3** -- SM3 hash initialization and processing (SM3 Chinese hash standard)
- **TcmPcrExtend** -- TCM PCR Extend command construction
- **TcmSm3CompressionFunction** -- SM3 block compression function (64 rounds)
- **TcmFifoTransmit** -- TCM command/response transport via LPC/FIFO interface

## Dependencies

- PiPei, Uefi base libraries
- TCM device (memory-mapped at FED4xxxx range)
- SM3 hash algorithm (implemented in-module)
- TCG PPI for PCR and event log operations

## Platform

- **Architecture**: IA-32 (x86)
- **Subsystem**: EFI_BOOT_SERVICE_DRIVER (0x0B)
- **Linker**: MSVS 2015
