tpm2: Check context hash algorithm with static assert

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2024-09-23 19:38:08 -04:00 committed by Stefan Berger
parent 8b3efff19e
commit 11dfb9a611
2 changed files with 2 additions and 3 deletions

View File

@ -60,6 +60,8 @@
#define TPM_HAVE_TPM2_DECLARATIONS
#include "tpm_library_intern.h"
MUST_BE(CONTEXT_INTEGRITY_HASH_ALG == TPM_ALG_SHA512);
/*
* The TPM2 maintains a pcrAllocated shadow variable; the current active one is
* in gp.pcrAllocated and the one to be active after reboot is in NVRAM. So,

View File

@ -100,9 +100,6 @@
# endif
# define CONTEXT_INTEGRITY_HASH_ALG CONCAT(TPM_ALG_, CONTEXT_HASH_ALGORITHM)
#endif
#if CONTEXT_HASH_ALGORITHM != SHA512 // libtpms: added begin
#error CONTEXT_HASH_ALGORITHM must remain SHA512
#endif // libtpms: added end
#ifndef CONTEXT_INTEGRITY_HASH_SIZE
# define CONTEXT_INTEGRITY_HASH_SIZE CONCAT(CONTEXT_HASH_ALGORITHM, _DIGEST_SIZE)