• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

dist/H17-May-2021-120112

doc/H03-May-2022-3,8093,620

include/tss2/H17-May-2021-11,1388,990

lib/H17-May-2021-2,5402,498

m4/H17-May-2021-12,29211,121

man/H17-May-2021-1,1601,074

script/H17-May-2021-1,167907

src/H17-May-2021-126,41877,106

test/H17-May-2021-62,90048,926

AUTHORSH A D17-May-20213.9 KiB101100

CHANGELOG.mdH A D17-May-202145.3 KiB997947

CONTRIBUTING.mdH A D03-Mar-20212 KiB3933

Doxyfile.inH A D26-Mar-2021112.4 KiB2,5371,985

INSTALL.mdH A D10-May-20216.8 KiB209170

LICENSEH A D03-Mar-20211.2 KiB2218

MAINTAINERSH A D10-May-202191 32

Makefile-fuzz-generated.amH A D17-May-20210

Makefile-fuzz.amH A D10-May-20211.7 KiB5140

Makefile-test.amH A D17-May-2021105.1 KiB2,0721,796

Makefile.amH A D10-May-202126.7 KiB757630

Makefile.inH A D17-May-20213.6 MiB30,28627,741

README.mdH A D10-May-202112.8 KiB219182

RELEASE.mdH A D03-May-20215.4 KiB8972

aclocal.m4H A D17-May-202143.5 KiB1,2161,104

aminclude_static.amH A D17-May-20216.6 KiB127108

compileH A D05-Feb-20207.2 KiB349259

config.guessH A D24-Feb-201843.2 KiB1,4811,288

config.h.inH A D17-May-20214.1 KiB179125

config.subH A D24-Feb-201835.3 KiB1,8021,661

configureH A D03-May-2022762.5 KiB25,89221,581

configure.acH A D17-May-202122.9 KiB550486

depcompH A D05-Feb-202023 KiB792502

install-shH A D05-Feb-202015 KiB519337

ltmain.shH A D02-Mar-2020319.6 KiB11,2528,044

missingH A D05-Feb-20206.7 KiB216143

src_vars.mkH A D17-May-202113.9 KiB1818

test-driverH A D05-Feb-20204.5 KiB14987

tpm2-tss.slnH A D03-Mar-20216.9 KiB109107

README.md

1[![Build Status](https://github.com/tpm2-software/tpm2-tss/workflows/CI/badge.svg)](https://github.com/tpm2-software/tpm2-tss/actions)
2[![Windows Build status](https://ci.appveyor.com/api/projects/status/1bqv1y7rntqiewln?svg=true)](https://ci.appveyor.com/project/williamcroberts/tpm2-tss)
3[![FreeBSD Build status](https://api.cirrus-ci.com/github/tpm2-software/tpm2-tss.svg?branch=master)](https://cirrus-ci.com/github/tpm2-software/tpm2-tss)
4[![Coverity Scan](https://img.shields.io/coverity/scan/3997.svg)](https://scan.coverity.com/projects/tpm2-tss)
5[![Coverage Status](https://codecov.io/gh/tpm2-software/tpm2-tss/branch/master/graph/badge.svg)](https://codecov.io/gh/tpm2-software/tpm2-tss)
6[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2332/badge)](https://bestpractices.coreinfrastructure.org/projects/2332)
7[![Total alerts](https://img.shields.io/lgtm/alerts/g/tpm2-software/tpm2-tss.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tpm2-software/tpm2-tss/alerts/)
8[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/tpm2-software/tpm2-tss.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tpm2-software/tpm2-tss/context:cpp)
9[![Documentation Status](https://readthedocs.org/projects/tpm2-tss/badge/?version=latest)](https://tpm2-tss.readthedocs.io/en/latest/?badge=latest)
10[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/tpm2-tss.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:tpm2-tss)
11[![Gitter](https://badges.gitter.im/tpm2-software/community.svg)](https://gitter.im/tpm2-software/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
12
13# Overview
14This repository hosts source code implementing the Trusted Computing Group's (TCG) TPM2 Software Stack (TSS).
15This stack consists of the following layers from top to bottom:
16
17* Feature API (FAPI) as described in the [TCG Feature API (FAPI) Specification](https://trustedcomputinggroup.org/wp-content/uploads/TSS_FAPI_v0p94_r09_pub.pdf)
18along with [TCG TSS 2.0 JSON Data Types and Policy Language Specification](https://trustedcomputinggroup.org/wp-content/uploads/TSS_JSON_Policy_v0p7_r08_pub.pdf)
19This API is designed to be very high-level API, intended to make programming with the TPM as simple as possible.
20The API functions are exposed through a single library: libtss2-fapi.
21* Enhanced System API (ESAPI) as described in the [TCG TSS 2.0 Enhanced System API (ESAPI) Specification](https://trustedcomputinggroup.org/wp-content/uploads/TSS_ESAPI_v1p0_r08_pub.pdf)
22This API is a 1-to-1 mapping of the TPM2 commands documented in Part 3 of the TPM2 specification.
23Additionally there are asynchronous versions of each command.
24In addition to SAPI, the ESAPI performs tracking of meta data for TPM object and automatic calculation of session based authorization and encryption values.
25Both the synchronous and asynchronous API are exposed through a single library: libtss2-esys.
26* System API (SAPI) as described in the [TCG TSS 2.0 System Level API (SAPI) Specification](https://trustedcomputinggroup.org/wp-content/uploads/TSS_SAPI_v1p1_r29_pub_20190806.pdf)
27This API is a 1-to-1 mapping of the TPM2 commands documented in Part 3 of the TPM2 specification.
28Additionally there are asynchronous versions of each command.
29These asynchronous variants may be useful for integration into event-driven programming environments.
30Both the synchronous and asynchronous API are exposed through a single library: libtss2-sys.
31* Marshaling/Unmarshaling (MU) as described in the [TCG TSS 2.0 Marshaling/Unmarshaling API Specification](https://trustedcomputinggroup.org/wp-content/uploads/TCG_TSS_Marshaling_Unmarshaling_API_v1p0_r07_pub.pdf)
32This API provides a set of marshaling and unmarshaling functions for all data types define by the TPM library specification.
33The Marshaling/Unmarshaling API is exposed through a library called libtss2-mu.
34* TPM Command Transmission Interface (TCTI) as described in the [TCG TSS 2.0 TPM Command Transmission Interface (TCTI) API Specification](https://trustedcomputinggroup.org/wp-content/uploads/TCG_TSS_TCTI_v1p0_r18_pub.pdf).
35This API provides a standard interface to transmit / receive TPM command / response buffers.
36It is expected that any number of libraries implementing the TCTI API will be implemented as a way to abstract various platform specific IPC mechanisms.
37Currently this repository provides several TCTI implementations: libtss2-tcti-device,
38libtss2-tcti-tbs (for Windows), libtss2-tcti-swtpm and libtss2-tcti-mssim.
39The former should be used for direct access to the TPM through the Linux kernel driver.
40The latter implements the protocol exposed by the Microsoft software TPM2 simulator.
41* The [TCG TSS 2.0 Overview and Common Structures Specification](https://trustedcomputinggroup.org/wp-content/uploads/TCG_TSS_Overview_Common_Structures_v0.9_r03_published.pdf) forms the basis for all implementations in this project. NOTE: We deviate from this specification by increasing the value of TPM2_NUM_PCR_BANKS from 3 to 16 to ensure compatibility with TPM2 implementations that have enabled a larger than typical number of PCR banks. This larger value for TPM2_NUM_PCR_BANKS is expected to be included in a future revision of the specification.
42
43# Build and Installation Instructions:
44Instructions to build and install tpm2-tss are available in the [INSTALL](INSTALL.md) file.
45
46# Getting in Touch:
47If you're looking to discuss the source code in this project or get some questions answered you should join the 01.org TPM2 mailing list: https://lists.01.org/postorius/lists/tpm2.lists.01.org/.
48We also have an IRC channel set up on [FreeNode](https://freenode.net/) called \#tpm2.0-tss.
49You can also try Gitter [![Gitter](https://badges.gitter.im/tpm2-software/community.svg)](https://gitter.im/tpm2-software/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
50
51You can join a weekly online call at [TPM.dev](https://developers.tpm.dev/events/tpmdev-online-call), where we are discussing the tpm2-tss stack, the tpm2-pkcs11 project and other Linux TPM2 & TSS2-Software.
52
53In case you want to contribute to the project, please also have a look at the [Contribution Guidelines](CONTRIBUTING.md).
54
55# Documentation
56The doxygen documentation can either be built by oneself (see the [INSTALL](INSTALL.md) file) or browsed directly on [tpm2-tss.readthedocs.io](https://tpm2-tss.readthedocs.io/).
57
58# Test Suite
59This repository contains a test suite intended to exercise the TCTI, SAPI and ESAPI code.
60This test suite is *not* intended to test a TPM implementation, so this test suite should only be run against a TPM simulator.
61If this test suite is executed against a TPM other than the software simulator it may cause damage to the TPM (NV storage wear out, etc.).
62You have been warned.
63
64## Simulator
65The TPM library specification contains reference code sufficient to construct a software TPM 2.0 simulator.
66This code was provided by Microsoft and they provide a binary download for Windows [here](https://www.microsoft.com/en-us/download/details.aspx?id=52507).
67
68There are two implementations that enable building and running this code on Linux.
69Issues building or running the simulator should be reported to respective project.
70
71### Software TPM
72The Software TPM is an open-source TPM emulator with different front-end interfaces such as socket and character device. Its code is hosted [on GitHub](https://github.com/stefanberger/swtpm) and building is faciliated by the GNU Autotools.
73The TCTI module for using this simulator is called _swtpm_.
74
75Since tpm2-tss v3.0 swtpm is the default simulator used by this project.
76
77### IBM's Software Simulator
78IBM has also repackaged this code with a few Makefiles so that the Microsoft code can be built and run on Linux systems.
79The Linux version of the Microsoft TPM 2.0 simulator can be obtained
80[on SourceForge](https://downloads.sourceforge.net/project/ibmswtpm2/ibmtpm974.tar.gz).
81Once you've downloaded and successfully built and execute the simulator it will, by default, be accepting connections on the localhost, TCP ports 2321 and 2322.
82The TCTI module for using this simulator is called _mssim_.
83
84## Testing
85To test the various TCTI, SAPI and ESAPI api calls, unit and integration tests can
86be run by configuring the build to enable unit testing and running the "check"
87build target. It is recommended to use a simulator for testing, and the
88simulator will be automatically launched by the tests. Please review the
89dependency list in [INSTALL](INSTALL.md) for dependencies when building
90the test suite.
91```
92$ ./configure --enable-unit --enable-integration
93$ make -j$(nproc) check
94```
95This will generate a file called "test-suite.log" in the root of the build
96directory.
97
98Please report failures in a Github 'issue' with a full log of the test run.
99
100NOTE: The unit and integration tests can be enabled independently.
101The --enable-unit option controls unit tests, and --enable-integration
102controls the integration tests.
103
104### Running tests on physical TPM device
105To run integration tests on a physical TPM device, including a TPM hardware
106or a software TPM implemented in platform firmware the configure script
107provides two options.
108The first option is called --with-device and it is used to point to the TPM
109device interface exposed by the OS, for example:
110
111```
112  $ ./configure  --with-device=/dev/tpm0
113```
114The second option, --with-devicetests, enables a "class" of test.
115There are three classes:
1161. destructive - these tests can affect TPM capability or lifespan
1172. mandatory   - these tests check all the functionality that is mandatory
118                 per the TCG specification (default).
1193. optional    - these tests are for functionality that is optional per the
120                 TCG specification.
121
122For example to enable both mandatory and optional test cases during configure
123one needs to set this flag as follows:
124
125```
126  $ ./configure --with-devicetests="mandatory,optional"
127```
128Tht default value for the flag is "mandatory"
129Any combination of the three is valid.
130The two flags are only valid when the integration tests are enabled with
131--enable-integration flag.
132
133After that the following command is used to run the test on the configured
134TPM device:
135
136```
137  $ sudo make check-device
138```
139  or
140```
141  $ sudo make check -j 1
142```
143
144Note: The tests can not be run in paralel.
145
146### Running valgrind check
147The unit and integration tests can be run under the valgrind tool, which
148performs additional checks on the library and test code, such as memory
149leak checks etc. The following command is used to run the tests under
150valgrind:
151
152  $ make check-valgrind
153
154This command will enable all valgrind "tools" and kick off as many test
155as they support. It is possible to enable different valgrind
156tools (checks) in more granularity. This can be controlled by invoking
157different tools separately using check-valgrind-<tool>, for instance:
158
159```
160  $ make check-valgrind-memcheck
161```
162  or
163```
164  $ make check-valgrind-drd
165```
166
167Currently the the following tools are supported:
168
169memcheck - Performs memory related checks. This is the default tool.
170helgrind - Performs synchronization errors checks.
171drd      - Performs thread related checks.
172sgcheck  - Performs stack overrun related checks.
173
174Note that the valgring tool can also be invoked manually using the standard
175libtool:
176
177```
178  $ libtool exec valgrind --tool=memcheck --leak-check=full \
179    test/integration/esys-auto-session-flags.int
180```
181
182This allows for more control on what checks are performed.
183
184### Logging
185While investigating issues it might be helpful to enable extra debug/trace
186output. It can be enabled separately for different components.
187The description how to do this can be found in the [logging](doc/logging.md) file.
188
189### Fuzzing
190All system API function calls can be tested using a fuzzing library.
191The description how to do this can be found in the [fuzzing](doc/fuzzing.md) file.
192
193# Architecture/Block Diagram
194SAPI library, TAB/RM, and Test Code Block Diagram:
195![Architecture Block Diagram](doc/TSS_block_diagram.png)
196
197# Project Layout
198```
199|-- doc     : various bits of documentation\
200|-- include : header files installed in $(includedir)\
201|   +-- tss2      : all public headers for this project\
202|-- lib     : data files used by the build or installed into $(libdir)\
203|-- m4      : autoconf support macros\
204|-- man     : man pages\
205|-- script  : scripts used by the build or CI\
206|-- src     : all source files\
207|   |-- tss2-esys : enhanced system API (ESAPI) implementation\
208|   |   +-- api   : ESAPI TPM API implementation\
209|   |-- tss2-mu   : TPM2 type marshaling/unmarshaling (MU) API implementation\
210|   |-- tss2-sys  : system API (SAPI) implementation\
211|   |   +-- api   : SAPI public API implementation\
212|   |-- tss2-tcti : TCTI implementations for device and mssim\
213|   +-- util      : Internal utility library (e.g. logging framework)\
214+-- test    : test code\
215    |-- integration : integration test harness and test cases\
216    |-- tpmclient   : monolithic, legacy test application\
217    +-- unit        : unit tests
218```
219