# CryptoPPI

| Index | Module | Size | Phase |
|-------|--------|------|-------|
| 0410 | CryptoPPI.efi | 0x11A20 (72224 bytes) | PEI |

## Overview

This PEIM provides a PPI (PEI-to-PEI Interface) for cryptographic operations during the PEI phase. It implements RSA key generation/signing/verification (including RSA-PSS and RSA-OAEP padding schemes), X.509 certificate parsing, PKCS7 signature verification, ASN.1 DER encoding/decoding, SHA-1 hashing, big-number arithmetic with Montgomery reduction, cryptographic random number generation, and key derivation. It includes an internal memory manager (Mmgr) for heap allocation within the constrained PEI environment.

## Key Functions

- `MmgrInitHeap` / `MmgrAllocPointer` / `MmgrFreePointer` -- Internal PEI heap manager
- `BnAlloc` / `BnFree` / `BnCompare` -- Big number arithmetic primitives
- `BnMontSqr` / `IntnMontReduce` -- Montgomery multiplication/reduction
- `IntnMultiply` / `IntnMod` / `IntnShiftLeft` -- Core big integer math
- RSA signing, verification, encryption, decryption routines
- X.509 / PKCS7 / ASN.1 DER parsing functions

## Dependencies

- PiPei.h (UEFI PEI protocol headers)
- AmiCrypto.h (AMI Crypto PPI protocol definition)
- edk2 DebugLib, BaseMemoryLib, MemoryAllocationLib

## Platform

- Architecture: IA32 (32-bit)
- Machine type: x86 (0x014C)
- Subsystem: EFI Boot Service Driver (0x000B)
- Format: PE32
- Sections: .text (51KB), .rdata (18KB), .data, .reloc