Skip to content

Commit e19e079

Browse files
SergiiDmytrukkrystian-hebel
authored andcommitted
arch/x86/tpm.c: fix appending to event log of TPM1
Just like TPM2 case this code path also needs extra handling on AMD because TXT-compatible data prepared by SKL is stored inside of vendor data field of TCG header. Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
1 parent bf433b3 commit e19e079

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

xen/arch/x86/tpm.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,21 @@ struct TPM12_PCREvent {
276276
uint8_t Data[];
277277
};
278278

279+
struct tpm1_spec_id_event {
280+
uint32_t pcrIndex;
281+
uint32_t eventType;
282+
uint8_t digest[20];
283+
uint32_t eventSize;
284+
uint8_t signature[16];
285+
uint32_t platformClass;
286+
uint8_t specVersionMinor;
287+
uint8_t specVersionMajor;
288+
uint8_t specErrata;
289+
uint8_t uintnSize;
290+
uint8_t vendorInfoSize;
291+
uint8_t vendorInfo[0]; /* variable number of members */
292+
} __packed;
293+
279294
struct txt_ev_log_container_12 {
280295
char Signature[20]; /* "TXT Event Container", null-terminated */
281296
uint8_t Reserved[12];
@@ -409,6 +424,15 @@ static void *create_log_event12(struct txt_ev_log_container_12 *evt_log,
409424
{
410425
struct TPM12_PCREvent *new_entry;
411426

427+
if ( is_amd_cpu() ) {
428+
/*
429+
* On AMD, TXT-compatible structure is stored as vendor data of
430+
* TCG-defined event log header.
431+
*/
432+
struct tpm1_spec_id_event *spec_id = (void *)evt_log;
433+
evt_log = (struct txt_ev_log_container_12 *)&spec_id->vendorInfo[0];
434+
}
435+
412436
new_entry = (void *)(((uint8_t *)evt_log) + evt_log->NextEventOffset);
413437

414438
/*

0 commit comments

Comments
 (0)