aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSeiji Munetoh <seiji.munetoh@gmail.com>2006-05-31 00:25:52 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-05-31 19:27:10 -0400
commit44d7aff035118e8c3993aa3fa05d358d1008e982 (patch)
tree0b454482cde4dac8200357ddb4e0f015b8e266bb /drivers
parentde66a695bef17264b2472c06e981c068bfa0636e (diff)
[PATCH] tpm: more bios log parsing fixes
From: Seiji Munetoh <seiji.munetoh@gmail.com> Change the binary output format to actual ACPI TCPA log structure since the current format does not contain all event-data information that need to verify the PCRs in TPM. tpm_binary_bios_measurements_show() uses get_event_name() to convert the binary event-data to ascii format, and puts them as binary. However, to verify the PCRs, the event-data must be a actual binary event-data used by SHA1 calc. in BIOS. So, I think actual ACPI TCPA log is good for this binary output format. That way, any userland tools easily parse this data with reference to TCG PC specification. Signed-off-by: Seiji Munetoh <seiji.munetoh@gmail.com> Acked-by: Kylene Hall <kjhall@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/tpm/tpm_bios.c48
1 files changed, 4 insertions, 44 deletions
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
index 60380174f245..a611972024e6 100644
--- a/drivers/char/tpm/tpm_bios.c
+++ b/drivers/char/tpm/tpm_bios.c
@@ -284,53 +284,13 @@ static int get_event_name(char *dest, struct tcpa_event *event,
284 284
285static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v) 285static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v)
286{ 286{
287 struct tcpa_event *event = v;
288 char *data = v;
289 int i;
287 290
288 char *eventname; 291 for (i = 0; i < sizeof(struct tcpa_event) + event->event_size; i++)
289 char data[4];
290 u32 help;
291 int i, len;
292 struct tcpa_event *event = (struct tcpa_event *) v;
293 unsigned char *event_entry =
294 (unsigned char *) (v + sizeof(struct tcpa_event));
295
296 eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL);
297 if (!eventname) {
298 printk(KERN_ERR "%s: ERROR - No Memory for event name\n ",
299 __func__);
300 return -ENOMEM;
301 }
302
303 /* 1st: PCR used is in little-endian format (4 bytes) */
304 help = le32_to_cpu(event->pcr_index);
305 memcpy(data, &help, 4);
306 for (i = 0; i < 4; i++)
307 seq_putc(m, data[i]);
308
309 /* 2nd: SHA1 (20 bytes) */
310 for (i = 0; i < 20; i++)
311 seq_putc(m, event->pcr_value[i]);
312
313 /* 3rd: event type identifier (4 bytes) */
314 help = le32_to_cpu(event->event_type);
315 memcpy(data, &help, 4);
316 for (i = 0; i < 4; i++)
317 seq_putc(m, data[i]); 292 seq_putc(m, data[i]);
318 293
319 len = 0;
320
321 len += get_event_name(eventname, event, event_entry);
322
323 /* 4th: filename <= 255 + \'0' delimiter */
324 if (len > TCG_EVENT_NAME_LEN_MAX)
325 len = TCG_EVENT_NAME_LEN_MAX;
326
327 for (i = 0; i < len; i++)
328 seq_putc(m, eventname[i]);
329
330 /* 5th: delimiter */
331 seq_putc(m, '\0');
332
333 kfree(eventname);
334 return 0; 294 return 0;
335} 295}
336 296