{"id":13641146,"url":"https://github.com/tpm2-software/tpm2-tss","last_synced_at":"2025-05-14T05:10:48.885Z","repository":{"id":34392719,"uuid":"38320020","full_name":"tpm2-software/tpm2-tss","owner":"tpm2-software","description":"OSS implementation of the TCG TPM2 Software Stack (TSS2)","archived":false,"fork":false,"pushed_at":"2025-04-17T14:03:42.000Z","size":25303,"stargazers_count":793,"open_issues_count":132,"forks_count":369,"subscribers_count":66,"default_branch":"master","last_synced_at":"2025-04-18T04:51:03.267Z","etag":null,"topics":["esapi","linux","sapi","system-api","tcg","tpm","tpm2","tss","tss2"],"latest_commit_sha":null,"homepage":"https://tpm2-software.github.io","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpm2-software.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-06-30T16:21:57.000Z","updated_at":"2025-04-17T20:35:49.000Z","dependencies_parsed_at":"2023-02-16T20:46:23.548Z","dependency_job_id":"d8c7c441-4ca1-4984-b6be-adf3a886d6f1","html_url":"https://github.com/tpm2-software/tpm2-tss","commit_stats":{"total_commits":2730,"total_committers":140,"mean_commits":19.5,"dds":0.7864468864468864,"last_synced_commit":"6c46325b466f35d40c2ed1043bfdfcfb8a367a34"},"previous_names":[],"tags_count":71,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpm2-software%2Ftpm2-tss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpm2-software%2Ftpm2-tss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpm2-software%2Ftpm2-tss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpm2-software%2Ftpm2-tss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpm2-software","download_url":"https://codeload.github.com/tpm2-software/tpm2-tss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esapi","linux","sapi","system-api","tcg","tpm","tpm2","tss","tss2"],"created_at":"2024-08-02T01:01:18.218Z","updated_at":"2025-05-14T05:10:48.752Z","avatar_url":"https://github.com/tpm2-software.png","language":"C","funding_links":[],"categories":["Software Tools","C"],"sub_categories":["Root of Trust and TPM"],"readme":"[![Build Status](https://github.com/tpm2-software/tpm2-tss/workflows/CI/badge.svg)](https://github.com/tpm2-software/tpm2-tss/actions)\n[![Windows Build status](https://ci.appveyor.com/api/projects/status/1bqv1y7rntqiewln?svg=true)](https://ci.appveyor.com/project/williamcroberts/tpm2-tss)\n[![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)\n[![Coverity Scan](https://img.shields.io/coverity/scan/3997.svg)](https://scan.coverity.com/projects/tpm2-tss)\n[![Coverage Status](https://codecov.io/gh/tpm2-software/tpm2-tss/branch/master/graph/badge.svg)](https://codecov.io/gh/tpm2-software/tpm2-tss)\n[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2332/badge)](https://bestpractices.coreinfrastructure.org/projects/2332)\n[![Total alerts](https://img.shields.io/lgtm/alerts/g/tpm2-software/tpm2-tss.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/tpm2-software/tpm2-tss/alerts/)\n[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/tpm2-software/tpm2-tss.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/tpm2-software/tpm2-tss/context:cpp)\n[![Documentation Status](https://readthedocs.org/projects/tpm2-tss/badge/?version=latest)](https://tpm2-tss.readthedocs.io/en/latest/?badge=latest)\n[![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\u0026can=1\u0026q=proj:tpm2-tss)\n[![Gitter](https://badges.gitter.im/tpm2-software/community.svg)](https://gitter.im/tpm2-software/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\n# Overview\n\nThis repository hosts source code implementing the Trusted Computing Group's (TCG) TPM2 Software Stack (TSS).\nThis stack consists of the following layers from top to bottom:\n\n| Name | Libraries |  \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Description\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; | Specifications |\n|---|---|---|---|\n| Feature API (FAPI) | libtss2\u0026#x2011;fapi | High-level API for simple TPM usage | [TCG Feature API (FAPI) Specification](https://trustedcomputinggroup.org/wp-content/uploads/TSS_FAPI_v0p94_r09_pub.pdf),\u003cbr\u003e[TCG TSS 2.0 JSON Data Types and Policy Language Specification](https://trustedcomputinggroup.org/wp-content/uploads/TSS_JSON_Policy_v0p7_r08_pub.pdf) |\n| Enhanced System API (ESAPI,\u0026nbsp;sometimes\u0026nbsp;ESYS) | libtss2\u0026#x2011;esys | 1-to-1 mapping of the TPM2 commands\u003cul\u003e\u003cli\u003e Session handling\u003c/li\u003e\u003cli\u003eTracks meta data for TPM objects\u003c/li\u003e\u003cli\u003eAsynchronous calls\u003c/li\u003e\u003c/ul\u003e | [TCG TSS 2.0 Enhanced System API (ESAPI) Specification](https://trustedcomputinggroup.org/wp-content/uploads/TSS_ESAPI_v1p0_r08_pub.pdf) |\n| System API (SAPI,\u0026nbsp;sometimes\u0026nbsp;SYS) | libtss2\u0026#x2011;sys | 1-to-1 mapping of the TPM2 commands\u003cul\u003e\u003cli\u003eAsynchronous calls\u003c/li\u003e\u003c/ul\u003e | [TCG TSS 2.0 System Level API (SAPI) Specification](https://trustedcomputinggroup.org/wp-content/uploads/TSS_SAPI_v1p1_r29_pub_20190806.pdf) |\n| Marshaling/Unmarshaling (MU) | libtss2\u0026#x2011;mu | (Un)marshaling all data types in the TPM library specification | [TCG TSS 2.0 Marshaling/Unmarshaling API Specification](https://trustedcomputinggroup.org/wp-content/uploads/TCG_TSS_Marshaling_Unmarshaling_API_v1p0_r07_pub.pdf) |\n| TPM Command Transmission Interface (TCTI) | libtss2\u0026#x2011;tcti\u0026#x2011;device\u003cbr\u003elibtss2\u0026#x2011;tcti\u0026#x2011;tbs\u003cbr\u003e libtss2\u0026#x2011;tctildr\u003cbr\u003elibtss2\u0026#x2011;tcti\u0026#x2011;swtpm\u003cbr\u003e\u0026#8230; | Standard API to transmit/receive TPM commands and responses\u003cbr\u003e\u003cbr\u003eSee [doc/tcti.md](doc/tcti.md) | [TCG TSS 2.0 TPM Command Transmission Interface (TCTI) API Specification](https://trustedcomputinggroup.org/wp-content/uploads/TCG_TSS_TCTI_v1p0_r18_pub.pdf) |\n||| Basis for all implementations in this project. [1] | [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) |\n\n[1] We currently deviate from the 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 is expected to be included in a future revision of the specification.\n\n# Build and Installation Instructions:\nInstructions to build and install tpm2-tss are available in the [INSTALL](INSTALL.md) file.\n\n# Getting in Touch:\nIf you're looking to discuss the source code in this project or get some questions answered you should join the TPM2 mailing list:\n  - [https://lore.kernel.org/tpm2/](https://lore.kernel.org/tpm2/)\n  - To subscribe write an email to [tpm2+subscribe@lists.linux.dev](tpm2+subscribe@lists.linux.dev) see also [here](https://subspace.kernel.org/subscribing.html)\n  - The old list https://lists.linuxfoundation.org/mailman/listinfo/tpm2 was decomissioned by Linux\n\nWe also have an IRC channel set up on [FreeNode](https://freenode.net/) called \\#tpm2.0-tss.\nYou can also try Gitter [![Gitter](https://badges.gitter.im/tpm2-software/community.svg)](https://gitter.im/tpm2-software/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\nYou 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 \u0026 TSS2-Software.\n\nIn case you want to contribute to the project, please also have a look at the [Contribution Guidelines](CONTRIBUTING.md).\n\n# Documentation\nThe 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/).\n\n# Test Suite\nThis repository contains a test suite intended to exercise the TCTI, SAPI and ESAPI code.\nThis test suite is *not* intended to test a TPM implementation, so this test suite should only be run against a TPM simulator.\nIf 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.).\nYou have been warned.\n\n## Simulator\nThe TPM library specification contains reference code sufficient to construct a software TPM 2.0 simulator.\nThis 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).\n\nThere are two implementations that enable building and running this code on Linux.\nIssues building or running the simulator should be reported to respective project.\n\n### Software TPM\nThe 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.\nThe TCTI module for using this simulator is called _swtpm_.\n\nSince tpm2-tss v3.0 swtpm is the default simulator used by this project.\n\n### IBM's Software Simulator\nIBM has also repackaged this code with a few Makefiles so that the Microsoft code can be built and run on Linux systems.\nThe Linux version of the Microsoft TPM 2.0 simulator can be obtained\n[on SourceForge](https://downloads.sourceforge.net/project/ibmswtpm2/ibmtpm974.tar.gz).\nOnce 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.\nThe TCTI module for using this simulator is called _mssim_.\n\n## Testing\nTo test the various TCTI, SAPI and ESAPI api calls, unit and integration tests can\nbe run by configuring the build to enable unit testing and running the \"check\"\nbuild target. It is recommended to use a simulator for testing, and the\nsimulator will be automatically launched by the tests. Please review the\ndependency list in [INSTALL](INSTALL.md) for dependencies when building\nthe test suite.\n```\n$ ./configure --enable-unit --enable-integration\n$ make -j$(nproc) check\n```\nThis will generate a file called \"test-suite.log\" in the root of the build\ndirectory.\n\nPlease report failures in a Github 'issue' with a full log of the test run.\n\nNOTE: The unit and integration tests can be enabled independently.\nThe --enable-unit option controls unit tests, and --enable-integration\ncontrols the integration tests.\n\n### Running tests on physical TPM device\nTo run integration tests on a physical TPM device, including a TPM hardware\nor a software TPM implemented in platform firmware the configure script\nprovides two options.\nThe first option is called --with-device and it is used to point to the TPM\ndevice interface exposed by the OS, for example:\n\n```\n  $ ./configure  --with-device=/dev/tpm0\n```\nThe second option, --with-devicetests, enables a \"class\" of test.\nThere are three classes:\n1. destructive - these tests can affect TPM capability or lifespan\n2. mandatory   - these tests check all the functionality that is mandatory\n                 per the TCG specification (default).\n3. optional    - these tests are for functionality that is optional per the\n                 TCG specification.\n\nFor example to enable both mandatory and optional test cases during configure\none needs to set this flag as follows:\n\n```\n  $ ./configure --with-devicetests=\"mandatory,optional\"\n```\nTht default value for the flag is \"mandatory\"\nAny combination of the three is valid.\nThe two flags are only valid when the integration tests are enabled with\n--enable-integration flag.\n\nAfter that the following command is used to run the test on the configured\nTPM device:\n\n```\n  $ sudo make check-device\n```\n  or\n```\n  $ sudo make check -j 1\n```\n\nNote: The tests can not be run in paralel.\n\n### Running valgrind check\nThe unit and integration tests can be run under the valgrind tool, which\nperforms additional checks on the library and test code, such as memory\nleak checks etc. The following command is used to run the tests under\nvalgrind:\n\n  $ make check-valgrind\n\nThis command will enable all valgrind \"tools\" and kick off as many test\nas they support. It is possible to enable different valgrind\ntools (checks) in more granularity. This can be controlled by invoking\ndifferent tools separately using check-valgrind-\u0026lt;tool\u0026gt;, for instance:\n\n```\n  $ make check-valgrind-memcheck\n```\n  or\n```\n  $ make check-valgrind-drd\n```\n\nCurrently the the following tools are supported:\n\nmemcheck - Performs memory related checks. This is the default tool.\nhelgrind - Performs synchronization errors checks.\ndrd      - Performs thread related checks.\nsgcheck  - Performs stack overrun related checks.\n\nNote that the valgring tool can also be invoked manually using the standard\nlibtool:\n\n```\n  $ libtool exec valgrind --tool=memcheck --leak-check=full \\\n    test/integration/esys-auto-session-flags.int\n```\n\nThis allows for more control on what checks are performed.\n\n### Logging\nWhile investigating issues it might be helpful to enable extra debug/trace\noutput. It can be enabled separately for different components.\nThe description how to do this can be found in the [logging](doc/logging.md) file.\n\n### Fuzzing\nAll system API function calls can be tested using a fuzzing library.\nThe description how to do this can be found in the [fuzzing](doc/fuzzing.md) file.\n\n# Architecture/Block Diagram\nSAPI library, TAB/RM, and Test Code Block Diagram:\n![Architecture Block Diagram](doc/TSS_block_diagram.png)\n\n# Project Layout\n```\n|-- doc     : various bits of documentation\\\n|-- include : header files installed in $(includedir)\\\n|   +-- tss2      : all public headers for this project\\\n|-- lib     : data files used by the build or installed into $(libdir)\\\n|-- m4      : autoconf support macros\\\n|-- man     : man pages\\\n|-- script  : scripts used by the build or CI\\\n|-- src     : all source files\\\n|   |-- tss2-esys : enhanced system API (ESAPI) implementation\\\n|   |   +-- api   : ESAPI TPM API implementation\\\n|   |-- tss2-mu   : TPM2 type marshaling/unmarshaling (MU) API implementation\\\n|   |-- tss2-sys  : system API (SAPI) implementation\\\n|   |   +-- api   : SAPI public API implementation\\\n|   |-- tss2-tcti : TCTI implementations for device and mssim\\\n|   +-- util      : Internal utility library (e.g. logging framework)\\\n+-- test    : test code\\\n    |-- integration : integration test harness and test cases\\\n    |-- tpmclient   : monolithic, legacy test application\\\n    +-- unit        : unit tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpm2-software%2Ftpm2-tss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpm2-software%2Ftpm2-tss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpm2-software%2Ftpm2-tss/lists"}