Commit de66a695 authored by Seiji Munetoh's avatar Seiji Munetoh Committed by Linus Torvalds

[PATCH] tpm: bios log parsing fixes

From: Seiji Munetoh <seiji.munetoh@gmail.com>

Fix "tcpa_pc_event" misalignment between enum, strings and TCG PC spec and
output of the event which contains a hash data.
Signed-off-by: default avatarSeiji Munetoh <seiji.munetoh@gmail.com>
Acked-by: default avatarKylene Hall <kjhall@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 25a6df95
...@@ -105,6 +105,12 @@ static const char* tcpa_event_type_strings[] = { ...@@ -105,6 +105,12 @@ static const char* tcpa_event_type_strings[] = {
"Non-Host Info" "Non-Host Info"
}; };
struct tcpa_pc_event {
u32 event_id;
u32 event_size;
u8 event_data[0];
};
enum tcpa_pc_event_ids { enum tcpa_pc_event_ids {
SMBIOS = 1, SMBIOS = 1,
BIS_CERT, BIS_CERT,
...@@ -114,14 +120,15 @@ enum tcpa_pc_event_ids { ...@@ -114,14 +120,15 @@ enum tcpa_pc_event_ids {
NVRAM, NVRAM,
OPTION_ROM_EXEC, OPTION_ROM_EXEC,
OPTION_ROM_CONFIG, OPTION_ROM_CONFIG,
OPTION_ROM_MICROCODE, OPTION_ROM_MICROCODE = 10,
S_CRTM_VERSION, S_CRTM_VERSION,
S_CRTM_CONTENTS, S_CRTM_CONTENTS,
POST_CONTENTS, POST_CONTENTS,
HOST_TABLE_OF_DEVICES,
}; };
static const char* tcpa_pc_event_id_strings[] = { static const char* tcpa_pc_event_id_strings[] = {
"" "",
"SMBIOS", "SMBIOS",
"BIS Certificate", "BIS Certificate",
"POST BIOS ", "POST BIOS ",
...@@ -130,11 +137,12 @@ static const char* tcpa_pc_event_id_strings[] = { ...@@ -130,11 +137,12 @@ static const char* tcpa_pc_event_id_strings[] = {
"NVRAM", "NVRAM",
"Option ROM", "Option ROM",
"Option ROM config", "Option ROM config",
"Option ROM microcode", "",
"Option ROM microcode ",
"S-CRTM Version", "S-CRTM Version",
"S-CRTM Contents", "S-CRTM Contents ",
"S-CRTM POST Contents", "POST Contents ",
"POST Contents", "Table of Devices",
}; };
/* returns pointer to start of pos. entry of tcg log */ /* returns pointer to start of pos. entry of tcg log */
...@@ -206,7 +214,7 @@ static int get_event_name(char *dest, struct tcpa_event *event, ...@@ -206,7 +214,7 @@ static int get_event_name(char *dest, struct tcpa_event *event,
const char *name = ""; const char *name = "";
char data[40] = ""; char data[40] = "";
int i, n_len = 0, d_len = 0; int i, n_len = 0, d_len = 0;
u32 event_id; struct tcpa_pc_event *pc_event;
switch(event->event_type) { switch(event->event_type) {
case PREBOOT: case PREBOOT:
...@@ -235,31 +243,32 @@ static int get_event_name(char *dest, struct tcpa_event *event, ...@@ -235,31 +243,32 @@ static int get_event_name(char *dest, struct tcpa_event *event,
} }
break; break;
case EVENT_TAG: case EVENT_TAG:
event_id = be32_to_cpu(*((u32 *)event_entry)); pc_event = (struct tcpa_pc_event *)event_entry;
/* ToDo Row data -> Base64 */ /* ToDo Row data -> Base64 */
switch (event_id) { switch (pc_event->event_id) {
case SMBIOS: case SMBIOS:
case BIS_CERT: case BIS_CERT:
case CMOS: case CMOS:
case NVRAM: case NVRAM:
case OPTION_ROM_EXEC: case OPTION_ROM_EXEC:
case OPTION_ROM_CONFIG: case OPTION_ROM_CONFIG:
case OPTION_ROM_MICROCODE:
case S_CRTM_VERSION: case S_CRTM_VERSION:
case S_CRTM_CONTENTS: name = tcpa_pc_event_id_strings[pc_event->event_id];
case POST_CONTENTS:
name = tcpa_pc_event_id_strings[event_id];
n_len = strlen(name); n_len = strlen(name);
break; break;
/* hash data */
case POST_BIOS_ROM: case POST_BIOS_ROM:
case ESCD: case ESCD:
name = tcpa_pc_event_id_strings[event_id]; case OPTION_ROM_MICROCODE:
case S_CRTM_CONTENTS:
case POST_CONTENTS:
name = tcpa_pc_event_id_strings[pc_event->event_id];
n_len = strlen(name); n_len = strlen(name);
for (i = 0; i < 20; i++) for (i = 0; i < 20; i++)
d_len += sprintf(data, "%02x", d_len += sprintf(&data[2*i], "%02x",
event_entry[8 + i]); pc_event->event_data[i]);
break; break;
default: default:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment