Bug: 151691711

Clone this repo:
  1. 35da877 Enable Windows host compilation of ms-tpm-20-ref by Oystein Eftevaag · 4 months ago main master android-u-beta-1-gpl
  2. fe01fcf Merge "Add license_note" am: 1032182dd6 am: 91e293d879 am: c1d3310168 by Treehugger Robot · 1 year, 3 months ago android13-d4-release android13-d4-s1-release android13-d4-s2-release android13-dev android13-frc-odp-release android13-mainline-go-adservices-release android13-qpr2-b-s1-release android13-qpr2-release android13-qpr2-s1-release android13-qpr2-s10-release android13-qpr2-s11-release android13-qpr2-s12-release android13-qpr2-s2-release android13-qpr2-s3-release android13-qpr2-s5-release android13-qpr2-s6-release android13-qpr2-s7-release android13-qpr2-s8-release android13-qpr2-s9-release main-16k main-16k-with-phones aml_go_ads_330913000 aml_go_ads_330915000 aml_go_odp_330912000 android-13.0.0_r32 android-13.0.0_r33 android-13.0.0_r34 android-13.0.0_r35 android-13.0.0_r36 android-13.0.0_r37 android-13.0.0_r38 android-13.0.0_r39 android-13.0.0_r40 android-13.0.0_r41 android-13.0.0_r42 android-13.0.0_r43 android-13.0.0_r44 android-13.0.0_r45 android-13.0.0_r46 android-13.0.0_r47 android-13.0.0_r48 android-13.0.0_r49 t_frc_ase_330444010 t_frc_odp_330442000 t_frc_odp_330442040
  3. c1d3310 Merge "Add license_note" am: 1032182dd6 am: 91e293d879 by Treehugger Robot · 1 year, 3 months ago
  4. 91e293d Merge "Add license_note" am: 1032182dd6 by Treehugger Robot · 1 year, 3 months ago
  5. 1032182 Merge "Add license_note" by Treehugger Robot · 1 year, 3 months ago

Official TPM 2.0 Reference Implementation (by Microsoft)

Build Status

This is the official TCG reference implementation of the TPM 2.0 Specification. The project contains complete source code of the reference implementation with a Microsoft Visual Studio solution and Linux autotools build scripts.

See the definition of the SPEC_VERSION, SPEC_YEAR and SPEC_DAY_OF_YEAR values in the TpmTypes.h header for the exact revision/date of the TPM 2.0 specification, which the given source tree snapshot corresponds to.

The reference implementation can be directly used via the TPM 2.0 simulator that emulates a TPM 2.0 device and can be accessed via a custom TCP based protocol. The simplest way to work with the simulator is to use a TSS library for the programming language of your choice - C#/.Net, C++, Java, Python, JavaScript/Node.js are currently supported. The C language TSS implementing the TCG's TSS API specifiaction is available here.

Windows build

Windows build is implemented as a Visual Studio 2017 solution. Before building it:

  • Setup one or both of the following underlying cryptographic libraries:

    OpenSSL library

    1. Create TPMCmd/lib folder and place a static OpenSSL library (libcrypto.lib) built for the x86 architecture there. For the x64 architecture use the TPMCmd/lib/x64 folder.

      The static libs can be either static libraries proper, or import libraries accompanying the corresponding DLLs. In the latter case you'll need to ensure that ther is a matching copy of the OpenSSL DLL in the standard Windows search path, so that it is available when you run the simulator executable (e.g. copy it into the same folder where simulator.exe is located).

      Recommended version of OpenSSL is 1.1.1d or higher.

    2. Create TPMCmd/OsslInclude/openssl folder and copy there the contents of the openssl/include/openssl folder in the OpenSSL source tree used to build the OpenSSL library.

      If you enable SM{2,3,4} algorithms in TpmProfile.h, the build may fail because of missing SM{2,3,4}.h headers. In this case you will need to manually copy them over from OpenSSL’s include/crypt folder.

    3. Build the solution with either Debug or Release as the active configuration.

    Wolfcrypt library (wolfSSL)

    1. WolfSSL is included as a submodule. Initialize and update the submodule to fetch the project and checkout the appropriate commit.

      git submodule init git submodule update

      The current commit will point the minimum recommended version of wolfSSL. Moving to a more recent tag or commit should also be supported but might not be tested.

    2. Build the solution with either WolfDebug or WolfRelease as the active configuration, either from inside the Visual Studio or with the following command line:

      msbuild TPMCmd\simulator.sln /p:Configuration=WolfDebug

  • If necessary, update the definitions of the following macros in the VendorString.h header: MANUFACTURER, VENDOR_STRING_1, FIRMWARE_V1 and FIRMWARE_V2

Linux build

Follows the common ./bootstrap && ./configure && make convention.

Note that autotools scripts require the following prerequisite packages: autoconf-archive, pkg-config, and sometimes build-essential and automake. Their absence is not automatically detected. The build also needs gcc and libssl-dev packages.

Similarly to the Windows build, if you enable SM{2,3,4} algorithms in TpmProfile.h, the build may fail because of missing SM{2,3,4}.h headers. In this case you will need to manually copy them over from OpenSSL’s include/crypt folder.