libtpms/src
Stefan Berger e0dceb11e5 tpm2: Add asserts to silence compiler warning due to -Wstringop-overflow=
The following error occurrs on Fedora build servers. To silence the
compiler warning add runtime asserts:

tpm2/crypto/openssl/CryptCmac.c: In function 'CryptCmacEnd':
tpm2/crypto/openssl/CryptCmac.c:194:48: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  194 |             subkey.t.buffer[subkey.t.size - 1] ^= xorVal;
      |                                                ^
tpm2/TpmTypes.h:1477:33: note: at offset -1 into destination object 'buffer' of size 16
 1477 |         BYTE                    buffer[MAX_SYM_BLOCK_SIZE];
      |                                 ^
lto1: all warnings being treated as errors

In CryptCmacStart the following initialization is done:

cState->iv.t.size = CryptGetSymmetricBlockSize(def->algorithm, def->keyBits.sym);

Also ensure that CryptGetSymmetricBlockSize in this case also always returns
a valid size to the TPM2B_IV that it is initializing, which would be the root
cause of any error.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-12-06 14:05:07 -05:00
..
tpm2 tpm2: Add asserts to silence compiler warning due to -Wstringop-overflow= 2024-12-06 14:05:07 -05:00
tpm12 tpm12: Replace include of engine.h with err.h 2024-07-08 16:45:33 -04:00
compiler.h tpm2: Remove unused function parameters or mark them as unused 2024-09-24 09:32:02 -04:00
disabled_interface.c tpm2: Remove unused function parameters or mark them as unused 2024-09-24 09:32:02 -04:00
libtpms.syms tpm2: Implement TPMLIB_WasManufactured API call 2024-08-30 16:25:47 -04:00
Makefile.am tpm2: Implement support for RuntimeAttributes (StateFormatLevel 7) 2024-09-03 10:28:55 -04:00
test.syms build-sys: work around broken linker when testing --version-script support 2018-08-30 21:45:16 +00:00
tpm_debug.c Move common debug, memory & nvfile units to src/ 2021-08-06 08:04:37 -04:00
tpm_debug.h tpm: #undef printf in case it is #define'd (OSS-Fuzz) 2022-04-08 08:35:19 -04:00
tpm_library_conf.h Fix many misspellings 2021-03-02 08:20:25 -05:00
tpm_library_intern.h tpm2: Wrap asprintf to avoid static analyzer warnings 2024-10-03 14:35:16 -04:00
tpm_library.c tpm2: Wrap asprintf to avoid static analyzer warnings 2024-10-03 14:35:16 -04:00
tpm_memory.c Move common debug, memory & nvfile units to src/ 2021-08-06 08:04:37 -04:00
tpm_nvfile.c nvfile: Free allocated memory on failure 2022-05-20 09:57:09 -04:00
tpm_nvfile.h Move common debug, memory & nvfile units to src/ 2021-08-06 08:04:37 -04:00
tpm_tpm2_interface.c tpm2: Wrap asprintf to avoid static analyzer warnings 2024-10-03 14:35:16 -04:00
tpm_tpm2_tis.c tpm2: rev155: Major refactoring of header files 2020-04-14 16:03:45 -04:00
tpm_tpm12_interface.c tpm2: Remove unused function parameters or mark them as unused 2024-09-24 09:32:02 -04:00
tpm_tpm12_tis.c Move common debug, memory & nvfile units to src/ 2021-08-06 08:04:37 -04:00