File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed
Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 1313
1414#define TPM_PCR_MAX_LEN 64
1515#define HASH_DATA_CHUNK_SIZE 1024
16- #define MAX_TPM_LOG_ENTRIES 50
1716/* Assumption of 2K TCPA log size reserved for CAR/SRAM */
1817#define MAX_PRERAM_TPM_LOG_ENTRIES 15
1918
Original file line number Diff line number Diff line change 1414#include <cbmem.h>
1515#include <vb2_sha.h>
1616
17+ #define TPM_LOG_SIZE (64 * KiB)
18+ #define MAX_TPM_LOG_ENTRIES ((TPM_LOG_SIZE - sizeof(struct tpm_1_log_table)) / \
19+ sizeof(struct tpm_1_log_entry))
20+
1721void * tpm1_log_cbmem_init (void )
1822{
1923 static struct tpm_1_log_table * tclt ;
2024 if (tclt )
2125 return tclt ;
2226
2327 if (ENV_HAS_CBMEM ) {
24- size_t tpm_log_len ;
2528 struct spec_id_event_data * hdr ;
2629
2730 tclt = cbmem_find (CBMEM_ID_TCPA_TCG_LOG );
2831 if (tclt )
2932 return tclt ;
3033
31- tpm_log_len = sizeof (* tclt ) + MAX_TPM_LOG_ENTRIES * sizeof (tclt -> entries [0 ]);
32- tclt = cbmem_add (CBMEM_ID_TCPA_TCG_LOG , tpm_log_len );
34+ tclt = cbmem_add (CBMEM_ID_TCPA_TCG_LOG , TPM_LOG_SIZE );
3335 if (!tclt )
3436 return NULL ;
3537
36- memset (tclt , 0 , tpm_log_len );
38+ memset (tclt , 0 , TPM_LOG_SIZE );
3739 hdr = & tclt -> spec_id ;
3840
3941 /* Fill in first "header" entry. */
Original file line number Diff line number Diff line change 2222#include <cbmem.h>
2323#include <vb2_sha.h>
2424
25+ #define TPM_LOG_SIZE (64 * KiB)
26+ #define MAX_TPM_LOG_ENTRIES ((TPM_LOG_SIZE - sizeof(struct tpm_2_log_table)) / \
27+ sizeof(struct tpm_2_log_entry))
28+
2529struct startup_locality_event {
2630 char signature [16 ]; /* "StartupLocality" (NUL-terminated) */
2731 uint8_t startup_locality ; /* 0 or 3 */
@@ -34,20 +38,17 @@ void *tpm2_log_cbmem_init(void)
3438 return tclt ;
3539
3640 if (ENV_HAS_CBMEM ) {
37- size_t tpm_log_len ;
3841 struct tcg_efi_spec_id_event * hdr ;
3942
4043 tclt = cbmem_find (CBMEM_ID_TPM2_TCG_LOG );
4144 if (tclt )
4245 return tclt ;
4346
44- tpm_log_len = sizeof (struct tpm_2_log_table ) +
45- MAX_TPM_LOG_ENTRIES * sizeof (struct tpm_2_log_entry );
46- tclt = cbmem_add (CBMEM_ID_TPM2_TCG_LOG , tpm_log_len );
47+ tclt = cbmem_add (CBMEM_ID_TPM2_TCG_LOG , TPM_LOG_SIZE );
4748 if (!tclt )
4849 return NULL ;
4950
50- memset (tclt , 0 , tpm_log_len );
51+ memset (tclt , 0 , TPM_LOG_SIZE );
5152 hdr = & tclt -> header ;
5253
5354 hdr -> event_type = htole32 (EV_NO_ACTION );
Original file line number Diff line number Diff line change 99#include <cbmem.h>
1010#include <vb2_sha.h>
1111
12+ #define MAX_TPM_LOG_ENTRIES 50
13+
1214void * tpm_cb_log_cbmem_init (void )
1315{
1416 static struct tpm_cb_log_table * tclt ;
You can’t perform that action at this time.
0 commit comments