Go to file
Arthur Gautier 2d9b00c4e4 tpm2: fix GCC 15 stringop-overflow error in MakeIv
When compiling with GCC 15 using `CFLAGS=-march=x86-64-v4`, the compiler's
aggressively optimized vectorizer triggers a false-positive
-Wstringop-overflow error. Because x86-64-v4 enables wide AVX-512 registers,
the compiler misinterprets the loop unrolling and warns that a 64-byte
vector write is overflowing the destination buffer:
```
  tpm2/TPMCmd/tpm/src/crypt/AlgorithmTests.c:158:17: error: 
  writing 64 bytes into a region of size 15 [-Werror=stringop-overflow=]
    158 |             *iv = i;
```

This fixes the warning by marking the `iv` output pointer parameter as
`volatile`. This inhibits the over-aggressive loop vectorization on this
specific buffer, silencing the compiler error without changing the
underlying logic.

Signed-off-by: Arthur Gautier <arthur.gautier@arista.com>
2026-06-10 22:31:26 -04:00
.github ci: Move testing into ubuntu:26.04 containers for OpenSSL 3.5 2026-06-05 11:49:41 -04:00
debian debian: Use --disable-hardening to avoid multiple usages of -D_FORTIFY_SOURCE=. 2024-11-15 10:52:20 -05:00
dist build-sys: Build libtpms v0.11.0 2024-11-15 10:52:20 -05:00
include tpmlib: Introduce TPMPROP_TPM2_BUFFER_MAX and set it to 4096 for now 2026-05-06 22:10:01 -04:00
m4 build-sys: Require only autoconf 2.63 for older systems 2019-06-20 13:08:39 -04:00
man build-sys: Add a BSDMake target for converting pod files. 2026-06-08 11:02:00 -04:00
scripts tpm2: Adopt the directory structure of upstream code repo 2026-02-13 09:59:26 -05:00
src tpm2: fix GCC 15 stringop-overflow error in MakeIv 2026-06-10 22:31:26 -04:00
tests tpm2: Pad NV_INDEX structure for m68k 2026-03-05 21:07:15 -05:00
.clang-format tpm2: Reformat some libtpms code with clang-format from 'upstream' 2026-03-09 10:10:15 -04:00
.gitignore Remove generated tpm_library.h from repo 2025-09-23 09:19:00 -04:00
.travis.yml Travis: Downgrade to setuptools 59.6.0 to avoid error in 71.x 2024-12-06 12:56:21 -05:00
autogen.sh build-sys: add a simple autogen.sh 2018-05-26 07:41:18 -04:00
bootstrap.sh Remove config.h.in 2014-06-30 15:04:15 -04:00
CHANGES CHANGES: Updated CHANGES document for 0.10.0 2024-11-14 07:51:51 -05:00
configure.ac tpm2: Adopt the directory structure of upstream code repo 2026-02-13 09:59:26 -05:00
CREDITS Add CREDITS file 2013-10-31 16:37:33 -04:00
DCO1.1.txt Replace the CLA with the DCO, simply requiring a Signed-off-by: 2016-12-21 11:09:38 -05:00
INSTALL add pkg-config to ubuntu prerequisites 2025-08-31 14:16:37 -04:00
libtpms.pc.in build-sys: add with_tpm1/with_tpm2 variables to .pc 2021-08-06 08:04:37 -04:00
LICENSE LICENSE: Add copyright notices and BSD license for newer TPM 2 code 2026-02-13 09:59:26 -05:00
MAINTAINERS MAINTAINERS: add LibreSSL maintainer 2022-07-12 17:28:40 -04:00
Makefile.am configure: support --with-pkgconfigdir 2021-02-09 13:33:15 -05:00
README docs: Update README to include CXX=clang++ for fuzzer build 2019-11-16 15:41:09 -05:00

What is libtpms?
----------------

Libtpms is a library that targets the integration of TPM functionality
into hypervisors, primarily into Qemu. Libtpms provides a very narrow
public API for this purpose so that integration is possible. Only the
minimum of necessary APIs are made publicly available.

It is assumed that the user of libtpms is familiar with the concepts
of the Trusted Platform Module (TPM). For the interaction with libtpms
it is necessary to know how to construct valid TPM commands and to
be able to parse their results. It is not within the scope of libtpms's
documentation to provide background on this. See the section on references
below.


What files does the libtpms package provide?
--------------------------------------------

The main libtpms package provides the following files:

/usr/lib64/libtpms.so.0
/usr/lib64/libtpms.so.0.5.1
/usr/share/doc/libtpms-0.5.1
/usr/share/doc/libtpms-0.5.1/CHANGES
/usr/share/doc/libtpms-0.5.1/LICENSE
/usr/share/doc/libtpms-0.5.1/README

Applications can link with -ltpms.


What files does the libtpms development package provide?
--------------------------------------------------------

The libtpms development package (libtpms-devel) provides the following
include files for applications to use:

tpm_error.h
tpm_library.h
tpm_memory.h
tpm_nvfilename.h
tpm_tis.h
tpm_types.h

These files contain the data structures, data types and API calls supported
by libtpms. It is recommended to not use any other API calls than those
provided in these include files.

All APIs are described in man pages. The man pages are part of the libtpms
development package as well:

TPMLIB_DecodeBlob
TPMLIB_GetTPMProperty
TPMLIB_GetVersion
TPMLIB_MainInit
TPMLIB_Process
TPMLIB_RegisterCallbacks
TPMLIB_Terminate
TPMLIB_VolatileAll_Store
TPM_Free
TPM_IO_Hash_Data
TPM_IO_Hash_End
TPM_IO_Hash_Start
TPM_IO_TpmEstablished_Get
TPM_Malloc
TPM_Realloc


How to contribute?
------------------
The mailing list for libtpms is libtpms@googlegroups.com.

For patch submissions, please use a Signed-off-by: <your email> to indicate
agreement to the DCO1.1.txt.


Fuzzing
-------
Initial fuzzing is possible with clang & libfuzzer.

You have to configure the project with --enable-fuzzer
(--enable-sanitizer can also help spot more issues). Then you can
build fuzz and run it with the testing corpus.

Fuzz testing is known to work with Fedora 28 or later. It requires that the
'clang' package is installed.

Ex:
$ ./configure --with-openssl --with-tpm2 --enable-sanitizers --enable-fuzzer \
    CC=clang CXX=clang++
$ make && make -C tests fuzz
$ tests/run-fuzzer.sh

oss-fuzz builds with its own fuzzer flags, and set $LIB_FUZZING_ENGINE
to be linked with. The script run by oss-fuzz is tests/oss-fuzz.sh.

Maintainers
-----------
libtpms is currently being maintained by Stefan Berger <stefanb@us.ibm.com>.

References:
-----------

Documentation about the Trusted Platform Module (TPM) can be downloaded
from the Trusted Computing Group's website at

http://www.trustedcomputinggroup.org