Commit Graph

1195 Commits

Author SHA1 Message Date
Stefan Berger
4b1bba7353 Sync: Remove some unused files
Some checks failed
Coverity Scan / coverity (push) Has been cancelled
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
84e57a9f04 Sync: Move many files to BSD-2-Clause license
Move many files to the BSD-2-clause license that either
- have no modifications in them at all
- where all modifictions are from 'me'
- where I have permission to move the modifications by 3rd parties under
  the new license

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
7aca56fde2 Sync: Sync minor changes in several files with upstream
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
f944381cd4 tpm2: Split off TDES related parts from TpmToOsslSym.h and adjust licenses
Sync the whitespace differences in TpmToOsslSym.h with upstream.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
d92e58c94b Sync: Add include to simulator_sysheaders.h
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
a69ab4d813 Sync: Fix and extend compile-time testing of NUM_AUTHVALUE_PCR_GROUP
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
e9b2c0513e Sync: Fix masking-out of unneeded bits in TpmMath_GetRandomBits
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
e91b1dd595 tpm2: Adopt the directory structure of upstream code repo
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
a086bb78b2 Sync: Implement platform function to determine enabled self tests
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
2e6d3f2902 Sync: Introduce platform functions for accessing NV indices
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
f96d435823 Sync: Replace a printf with DEBUG_PRINT in BnToOsslMath.c
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
f73011daea Sync: Add another fallthrough hint for static analysis tools
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
26d3cca572 Sync: Fix comments
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
090111cb5b Sync: Only build x509 related functions if CC_CertifyX509 is '1'
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
767972759d Sync: Add more buffer size checks to CryptParameterDecryption
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
9d2ab05d82 Sync: Add NOT_REFERENCED to avoid build error
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
72d7e976be Sync: Throw a build error if CC_AC_GetCapability is enabled
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
b31147da07 Sync: Reformat comments in Global.h
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
6dadfbcff0 Sync: Format TpmProfile_CommandList.h
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
e5f0f7c721 Sync: Report versioning information using a structe passed to a function
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
c5c282887a Sync: Check for NULL pointers in CommandDispatcher
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
ceb69bd02b Sync: Add checks for locator == (NV_REF)0
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:19 -05:00
Stefan Berger
5fc6a4a2c3 Sync: Fix code comments and function descriptions and trivial changes
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
1db34c9177 Sync: Rework failure handling and replace g_inFailureMode
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
c96d721e59 Sync: Adjust pAssert variant being used depending on function return type
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
2c01c2d865 Sync: Have PolicyContextUpdate return TPM_RC
Split-out those TPM 2 command functions that need to be adapted due to the
functions they call returning an error code. Split them out into their own
files so they can be synchronized easier.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
60783bd058 Sync: Have Object and PCR related functions return TPM_RC
Split-out those TPM 2 command functions that need to be adapted due to the
functions they call returning an error code. Split them out into their own
files so they can be synchronized easier.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
6d0071882f Sync: Have ComputeCommandHMAC return TPM_RC
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
fb53a5cbe0 Sync: Rework some NVRAM functions to return TPM_RC and adjust pAsserts
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
f17c7d8511 Sync: Add pAsserts after many HandleToObject calls
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
c153741b44 Sync: Put pAssert after every SessionGet
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
14ceaaff58 Sync: Have several crypto functions return TPM_RC now
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
2a16261650 Sync: Have _TPM_Hash_Start/Data/End and FlushObject return error codes
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
ddc610eaa6 Sync: Implemented debugging macros and enable with build switch
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
d94eb5644c Sync: Improve platform initialization
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
2434752b6d Sync: Add options for simulator (unused)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
3b84957b46 Sync: Move vendor commands support into own directory
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
0126131766 tpm2: Include stdint.h/def.h in BaseTypes.h and some other changes
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
ed2b79d556 Sync: Fix some build issues, reformat code and add more comments
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
d8b0639716 Sync: Use clang-format 19.1.4 to reformat sources
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
02dad542a9 Sync: Reformat some files
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
ef41366e24 Sync: Introduce PolicyTransportSPDM command but do not activate it
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
a968a53c92 Sync: Introduce ReadOnlyControl command but do not activate it
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
3433a7fcf5 Sync: Sync on white space changes
Resolve only white space changes on a previously applied patch resolving a
CVE where my version looked slightly different.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
8592c6384a Sync: Remove TABLE_DRIVEN_DISPATCH build switch
Remove the TABLE_DRIVEN_DISPATCH build switch that was set to 'YES'.
Remove code that assumed it to be set to 'NO'.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
f9d285f483 tpm2: Get rid of IS_IMPLEMENTED flag for CC attributes
Upstream has gotten rid of the IS_IMPLEMENTED flag but upstream is also
using compressed lists where each element in the command lists represents
an implemented command. Libtpms does not use compressed lists but we may
have a list with gaps in it due to unimplemented commands where this flag
may be the only one set and help identify an implemented command. However,
since profiles indicate enablement and implementation of commands, and
nearly all tests for the IS_IMPLEMENTED flag are paired with a check on
the profile with RuntimeCommandsCheckEnabled(), we can get rid of tests for
IS_IMPLEMENTED and finally the flag altogether since it is redundant.

Also get rid of NOT_IMPLEMENTED flag that was not used anywhere.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
c489b289f8 Sync: Remove USE_MARSHALING_DEFINES build switch
The build swtich was not used anywhere else.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
83f5656ecb Sync: Remove USE_BIT_FIELD_STRUCTURES build switch and bit fields
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
c2a8109f8b tpm2: Change license of some non-TCG files to BSD-2-clause
Now that Helpers.c is clean of contributions, change its license to
BSD-2-clause. Change license in some other files as well.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-01-19 18:16:12 -05:00
Stefan Berger
363b4989d9 tpm2: Remove ALG_TDES conditional compilation (clean files)
Remove the contributed conditional compilation of a TDES related function
and fields in a structure based on definition of ALG_TDES.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-01-19 18:16:12 -05:00