aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-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