Code Layout

October 4, 2024 ยท View on GitHub

Introduction

The code layout of the repository consists of the several top-level folders. Portions of the repository are provided for example or historical reasons and are unmaintained. Pull Requests to update or fix non-maintained code are considered subject to CONTRIBUTING.md

FolderDescriptionMaintained?
docsThese documentsYES
externalWolfSSL submodule (currently not building correctly)NO
SamplesMisc Sample TPM applicationsNO
scriptsmiscellaneous scriptsYES
TPMCmdTPM Reference Code and LibraryYES

Form Follows Function

The physical directory layout of the reference code is based on achieving two simultaneous goals:

  1. to build the TCG Reference Code, Simulator, and Platform library.
  2. to allow library consumers to consume only library components while injecting changes at multiple customization points. Items designated Replaceable can be replaced with user components as described in other documents to construct a different TPM application.

In order to achieve these goals in a way that can be consumed by the greatest variety of downstream build systems, the Core Library CMake build system outputs an "install tree" consisting of headers and libraries that can be consumed by various downstream build systems as well as a set of CMake Packages that can be consumed via CMake find_package if the downstream system uses CMake.

The folder layout of the TPMCmd source tree reflects these CMake build decisions as described in CMake Build.

The remainder of this document outlines what is in the top-level folders of the repository.

Tpm Reference Code (TPMCmd folder)

The structure of TPMCmd is:

FolderDescriptionReplaceable?
PlatformThe Reference example platform libraryYES
SimulatorThe Reference test applicationYES
tpmThe TPM Core LibraryNO
TpmConfigurationThe TPM Configuration files for SimulatorYES

Tpm Core Library (TPMCmd/tpm folder)

The structure of TPMCmd/tpm:

FolderDescriptionMaintained?Replaceable?
cmakeCMake build scripts and helpersYESNO
cryptolibsCore and Sample crypto libraries (see below)VARIESVARIES
includeVarious TPM Header libraries (see below)YESNO
srcThe TPM Core LibraryYESNO

Tpm Core Library Includes (TPMCmd/tpm/include folder)

The structure of TPMCmd/tpm/include:

FolderDescriptionMaintained?Replaceable?
platform_interfaceCMake build scriptsYESNO
privateCore and Sample crypto libraries (see below)YESNO
publicVarious TPM Header libraries (see below)YESNO

Tpm Core Library CryptoLibs (TPMCmd/tpm/cryptolibs folder)

The cryptolibs folder contains both maintained code and legacy code that is kept for illustration but is not currently maintained. In particular wolf crypto implementations do not correctly build at present.

The structure of TPMCmd/tpm/cryptolibs:

FolderDescriptionMaintained?Replaceable?Requires TpmBigNum?
commonCore TPM Crypto Interface definitionsYESNON/A
OsslOpenSSL Crypto Interface layerYESYESYES
TpmBigNumThe TPM "Big Number" Math LibraryYESYESN/A
wolfWolfSSL Crypto Interface layerNOYESYES

More details about the Crypto design and customization can be found under Architecture:

Platform Library (TPMCmd/Platform folder)

FolderDescriptionMaintained?Replaceable?
includeTpm_PlatformLib headersYESYES
srcTpm_PlatformLib sourceYESYES