Commit Graph

1401 Commits

Author SHA1 Message Date
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
542c02becc LICENSE: Add copyright notices and BSD license for newer TPM 2 code
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:23:18 -05:00
Stefan Berger
4fba21bdb5 scripts: Add help screen to meld-all and display if file is 'not upstream'
Add a help screen to meld-all and display if a file is not found in the
upstream repo.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-02-11 11:22:30 -05:00
Stefan Berger
deef2301e3 scripts: Implement meld-commit to meld by commit Id
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-01-21 11:50:56 -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
Stefan Berger
154fb6166e tpm2: Implement retrieval of updated IV after crypto operation
Implement the retrieval of the updated IV in a single function which is
to be called after a symmetric key encryption or decryption operation.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-01-19 18:16:12 -05:00
Stefan Berger
62e5303e50 tpm2: Remove retrieval of IV after crypto operations (clean file)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-01-19 18:16:12 -05:00
Stefan Berger
6c0e325a91 tpm2: Revert some minor comment changes (clean files)
To get some files into the state so that they can be easily replaced with
the BSD-licensed code, revert:

- spelling changes that were introduced by nicolas.iooss@ledger.fr in
  bbd7b75d71. Many of the changes introduced in that change were replaced
  in subsequence changes with the original spelling errors in the upstream
  code.

- LibreSSL support introduced by orbea <orbea@riseup.net> in 95fff22c9b
  and 7310725524.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-01-19 18:16:12 -05:00
Stefan Berger
dc7d694ab8 tpm2: Activate unused defines to reduce diff with upstream
To reduce the diffs with the upstream code, remove the deactivation of
ECC related defines.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-01-19 17:01:01 -05:00
Stefan Berger
7947b1b115 tpm2: Remove usage of TPM_WINDOWS
TPM_WINDOWS is not set anywhere in the build system and therefore assumed
to not be used. We can get rid of whatever assumed it may have been set.
Also rool back some other changes to Windows-specific code.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-01-19 16:41:38 -05:00
Stefan Berger
9820b0a68f tpm2: Move assert right to the result of fseek
Reduce the diff with upstream by removing the usage of variable 'irc' and
apply the assert right to the fseek statement.

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