Skip to contentSkip to conversation

tpm: securityfs support for TPM 2.0 firmware event log

PATCH Superseded Nayna Jain 4 participants 19 messages Nov 23, 2016 – Nov 26, 2016 TPM device driver

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Nayna Jain

author
#0 lore raw

v5 cover tpm: securityfs support for TPM 2.0 firmware event log

The TPM device driver defines ascii and binary methods for displaying the TPM 1.2 event log via securityfs files, which are needed for validating a TPM quote. The device driver for TPM 2.0 does not have similar support for displaying the TPM 2.0 event log. This patch set adds the support for displaying TPM 2.0 event log in binary format.

The parsing mechanism to display the TPM 2.0 event log in binary format is implemented as defined in the TPM 2.0 TCG specification[1]. If the firmware event log support exists and is successfully read, the securityfs file is created to provide the event log in binary format for both the OF device tree and ACPI.

- Patch 1 moves the common TPM 1.2 and 2.0 event log initialization functions to a new file named tpm_eventlog_init.c.
- Patch 2 adds the device tree bindings support for Physical TPM.
- Patch 3 adds the support for creating securityfs files and for displaying the TPM 2.0 crypto agile event log in binary format.

With that, this patch set splits the event log functionality into initialization functions, TPM 1.2 event log parsing and TPM 2.0 event log parsing.

[1] TCG EFI Protocol Specification, Family "2.0" - Section 5 "Event Log Structure"

Changelog History

v5:

- Upstreamed cleanup and fixes as different patchset
- Rebased to the Jarkko's latest master branch (e5be084 tpm: vtpm_proxy:
Do not access host's event log)
- Patch "tpm: enhance read_log_of() to support Physical TPM event log
- New Patch.
- Patch "tpm: add securityfs support for TPM 2.0 firmware event log"
- Moved the changes in read_log_of() to a different patch
- TPM 2.0 event log data types are declared in tpm_eventlog.h, tpm2.h is removed.
- Included other feedbacks also from Jarkko on aligment and extra line

v4:

- Includes feedbacks from Jarkko and Jason.
- Patch "tpm: define a generic open() method for ascii & bios measurements".
- Fix indentation issue.
- Patch "tpm: replace the dynamically allocated bios_dir as struct dentry array".
- Continue to use bios_dir_count variable to use is_bad() checks and to maintain correct order for securityfs_remove() during teardown.
- Reset chip->bios_dir_count in teardown() function.
- Patch "tpm: validate the eventlog access before tpm_bios_log_setup".
- Retain TPM2 check which was removed in previous patch.
- Add tpm_bios_log_setup failure handling.
- Remove use of private data from v3 version of patch. Add a new member to struct tpm_chip to achieve the same purpose.
- Patch "tpm: redefine the read_log method to check for ACPI/OF properties sequentially".
- Move replacement of CONFIG_TCG_IBMVTPM with CONFIG_OF to this patch from patch 3.
- Replace -1 error code with -ENODEV.
- Patch "tpm: replace the of_find_node_by_name() with dev of_node property".
- Uses chip->dev.parent->of_node.
- Created separate patch for cleanup of pr_err messages.
- Patch "tpm: remove printk error messages".
- New Patch.
- Patch "tpm: add the securityfs file support for TPM 2.0 eventlog".
- Parses event digests using event alg_id rather than event log header

    alg_id.

- Uses of_property_match_string to differentiate tpm/vtpm compatible

v3:

- Includes the review feedbacks as suggested by Jason.
- Split of patches into one patch per idea.
- Generic open() method for ascii/bios measurements.
- Replacement of of **bios_dir with *bios_dir[3].
- Verifying readlog() is successful before creating securityfs entries.
- Generic readlog() to check for ACPI/OF in sequence.
- read_log_of() method now uses of_node propertry rather than calling find_device_by_name.
- read_log differentiates vtpm/tpm using its compatible property.
- Cleans pr_err with dev_dbg.
- Commit msgs subject line prefixed with tpm.

v2:

- Fixes issues as given in feedback by Jason.
- Adds documentation for device tree.

Nayna Jain (3):
tpm: move event log init functions to tpm_eventlog_init.c
tpm: enhance read_log_of() to support Physical TPM event log
tpm: add securityfs support for TPM 2.0 firmware event log

 drivers/char/tpm/Makefile            |   2 +-
 drivers/char/tpm/tpm2_eventlog.c     | 214 +++++++++++++++++++++++++++++++++++
 drivers/char/tpm/tpm_eventlog.c      | 165 +--------------------------
 drivers/char/tpm/tpm_eventlog.h      |  72 ++++++++++++
 drivers/char/tpm/tpm_eventlog_init.c | 194 +++++++++++++++++++++++++++++++
 drivers/char/tpm/tpm_of.c            |  27 ++++-
 6 files changed, 508 insertions(+), 166 deletions(-)
 create mode 100644 drivers/char/tpm/tpm2_eventlog.c
 create mode 100644 drivers/char/tpm/tpm_eventlog_init.c
Signature · 1 line
2.5.0
author
#1 lore raw

PATCH v5 1/3 tpm: move event log init functions to tpm_eventlog_init.c

The device driver code for the event log has the init functions and TPM 1.2 parsing logic both defined in same file(tpm_eventlog.c).

Since the initialization functions are common with the TPM 2.0 event log support, this patch splits tpm_eventlog.c to have only TPM 1.2 event log parsing logic and moves the init functions into tpm_eventlog_init.c.

---
 drivers/char/tpm/Makefile            |   2 +-
 drivers/char/tpm/tpm_eventlog.c      | 165 +-----------------------------
 drivers/char/tpm/tpm_eventlog.h      |   3 +
 drivers/char/tpm/tpm_eventlog_init.c | 189 +++++++++++++++++++++++++++++++++++
 4 files changed, 197 insertions(+), 162 deletions(-)
 create mode 100644 drivers/char/tpm/tpm_eventlog_init.c
drivers/char/tpm/Makefile +1 -1
index a05b1eb..1dc2671 100644
@@ -3,7 +3,7 @@
 #
 obj-$(CONFIG_TCG_TPM) += tpm.o
 tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o tpm2-cmd.o \
-		tpm_eventlog.o
+		tpm_eventlog.o tpm_eventlog_init.o
 tpm-$(CONFIG_ACPI) += tpm_ppi.o tpm_acpi.o
 tpm-$(CONFIG_OF) += tpm_of.o
 obj-$(CONFIG_TCG_TIS_CORE) += tpm_tis_core.o
drivers/char/tpm/tpm_eventlog.c +4 -161

191 lines not on this page · raw message

drivers/char/tpm/tpm_eventlog.h +3 -0
index 1660d74..155467d 100644
@@ -73,6 +73,9 @@ enum tcpa_pc_event_ids {
 	HOST_TABLE_OF_DEVICES,
 };
 
+extern const struct seq_operations tpm_ascii_b_measurements_seqops;
+extern const struct seq_operations tpm_binary_b_measurements_seqops;
+
 #if defined(CONFIG_ACPI)
 int tpm_read_log_acpi(struct tpm_chip *chip);
 #else
drivers/char/tpm/tpm_eventlog_init.c new file +189 -0

189 lines not on this page · raw message

Signature · 1 line
2.5.0
#2 lore raw

Re: [PATCH v5 1/3] tpm: move event log init functions to tpm_eventlog_init.c

Quoted 7 lines · Nayna Jain

The device driver code for the event log has the init functions and TPM 1.2 parsing logic both defined in same file(tpm_eventlog.c).

Since the initialization functions are common with the TPM 2.0 event log support, this patch splits tpm_eventlog.c to have only TPM 1.2 event log parsing logic and moves the init functions into tpm_eventlog_init.c.

I think I'd rather see a tpm_eventlog1.c/tpm_eventlog2.c than this _init thing..

Jason

------------------------------------------------------------------------------

author
#3 lore raw

Re: [PATCH v5 1/3] tpm: move event log init functions to tpm_eventlog_init.c

Quoted 11 lines · Jason Gunthorpe
Quoted 7 lines · Nayna Jain

The device driver code for the event log has the init functions and TPM 1.2 parsing logic both defined in same file(tpm_eventlog.c).

Since the initialization functions are common with the TPM 2.0 event log support, this patch splits tpm_eventlog.c to have only TPM 1.2 event log parsing logic and moves the init functions into tpm_eventlog_init.c.

I think I'd rather see a tpm_eventlog1.c/tpm_eventlog2.c than this _init thing..

Do you mean tpm_eventlog1.c for TPM 1.2 and tpm_eventlog2.c for TPM 2.0
event log specific parsing ?

And if so, then which one should have the common functions for TPM 1.2 and TPM 2.0 ?

Thanks & Regards,
- Nayna

Quoted 3 lines

Jason

------------------------------------------------------------------------------

#4 lore raw

Re: [PATCH v5 1/3] tpm: move event log init functions to tpm_eventlog_init.c

Quoted 5 lines · Nayna
Quoted 5 lines
Quoted 4 lines

Since the initialization functions are common with the TPM 2.0 event log support, this patch splits tpm_eventlog.c to have only TPM 1.2 event log parsing logic and moves the init functions into tpm_eventlog_init.c.

Quoted 8 lines
Quoted 2 lines

I think I'd rather see a tpm_eventlog1.c/tpm_eventlog2.c than this _init thing..

Do you mean tpm_eventlog1.c for TPM 1.2 and tpm_eventlog2.c for TPM 2.0 event log specific parsing ?

And if so, then which one should have the common functions for TPM 1.2 and TPM 2.0?

Leave them in tpm_eventlog.c ..

Jason

------------------------------------------------------------------------------

author
#5 lore raw

Re: [PATCH v5 1/3] tpm: move event log init functions to tpm_eventlog_init.c

Quoted 10 lines · Jason Gunthorpe
Quoted 8 lines · Nayna
Quoted 7 lines
Quoted 4 lines

Since the initialization functions are common with the TPM 2.0 event log support, this patch splits tpm_eventlog.c to have only TPM 1.2 event log parsing logic and moves the init functions into tpm_eventlog_init.c.

I think I'd rather see a tpm_eventlog1.c/tpm_eventlog2.c than this _init thing..

Quoted 7 lines
Quoted 5 lines

Do you mean tpm_eventlog1.c for TPM 1.2 and tpm_eventlog2.c for TPM 2.0 event log specific parsing ?

And if so, then which one should have the common functions for TPM 1.2 and TPM 2.0?

Leave them in tpm_eventlog.c ..

Sure. I am fine with that. I just feel that it bit of mixed up the scope of tpm_eventlog.c file, where it now also refers to TPM2, but have corresponding seq functions in separate file.

Thanks & Regards,
- Nayna

Quoted 3 lines

Jason

#6 lore raw

Re: [PATCH v5 1/3] tpm: move event log init functions to tpm_eventlog_init.c

In reply to Jason Gunthorpe
Quoted 9 lines · Jason Gunthorpe
Quoted 7 lines · Nayna Jain

The device driver code for the event log has the init functions and TPM 1.2 parsing logic both defined in same file(tpm_eventlog.c).

Since the initialization functions are common with the TPM 2.0 event log support, this patch splits tpm_eventlog.c to have only TPM 1.2 event log parsing logic and moves the init functions into tpm_eventlog_init.c.

Quoted 4 lines

I think I'd rather see a tpm_eventlog1.c/tpm_eventlog2.c than this _init thing..

Jason

I would rather see tpm1-eventlog.c and tpm2-eventlog.c as we already have tpm2-cmd.c for the sake of consistency.

/Jarkko

#7 lore raw

Re: [PATCH v5 1/3] tpm: move event log init functions to tpm_eventlog_init.c

Quoted 10 lines · Jarkko Sakkinen
Quoted 9 lines · Jason Gunthorpe
Quoted 7 lines · Nayna Jain

The device driver code for the event log has the init functions and TPM 1.2 parsing logic both defined in same file(tpm_eventlog.c).

Since the initialization functions are common with the TPM 2.0 event log support, this patch splits tpm_eventlog.c to have only TPM 1.2 event log parsing logic and moves the init functions into tpm_eventlog_init.c.

Quoted 5 lines
Quoted 2 lines

I think I'd rather see a tpm_eventlog1.c/tpm_eventlog2.c than this _init thing..

I would rather see tpm1-eventlog.c and tpm2-eventlog.c as we already have tpm2-cmd.c for the sake of consistency.

+1

Jason

------------------------------------------------------------------------------

author
#8 lore raw

PATCH v5 2/3 tpm: enhance read_log_of() to support Physical TPM event log

In reply to Nayna Jain

Physical TPMs use Open Firmware Device Tree bindings that are similar to the IBM Power virtual TPM to support event log. However, these properties store the values in different endianness for Physical and Virtual TPM.

This patch fixes the endianness issue by doing appropriate conversion based on Physical or Virtual TPM.

---
 drivers/char/tpm/tpm_of.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)
drivers/char/tpm/tpm_of.c +23 -4
index 7dee42d7..646aec1 100644
@@ -27,6 +27,7 @@ int tpm_read_log_of(struct tpm_chip *chip)
 	const u32 *sizep;
 	const u64 *basep;
 	struct tpm_bios_log *log;
+	u32 log_size;
 
 	log = &chip->log;
 	if (chip->dev.parent && chip->dev.parent->of_node)
@@ -34,25 +35,43 @@ int tpm_read_log_of(struct tpm_chip *chip)
 	else
 		return -ENODEV;
 
+	/*
+	 * For both vtpm/tpm, firmware has log addr and log size in big
+	 * endian format. But in case of vtpm, there is a method called
+	 * sml-handover which is run during kernel init even before
+	 * device tree is setup. This sml-handover function takes care
+	 * of endianness and writes to sml-base and sml-size in little
+	 * endian format. For this reason, vtpm doesn't need conversion
+	 * but physical tpm needs the conversion.
+	 */
 	sizep = of_get_property(np, "linux,sml-size", NULL);
+	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0)
+		log_size = be32_to_cpup(sizep);
+	else
+		log_size = *sizep;
+
 	basep = of_get_property(np, "linux,sml-base", NULL);
 	if (sizep == NULL && basep == NULL)
 		return -ENODEV;
 	if (sizep == NULL || basep == NULL)
 		return -EIO;
 
-	if (*sizep == 0) {
+	if (log_size == 0) {
 		dev_warn(&chip->dev, "%s: Event log area empty\n", __func__);
 		return -EIO;
 	}
 
-	log->bios_event_log = kmalloc(*sizep, GFP_KERNEL);
+	log->bios_event_log = kmalloc(log_size, GFP_KERNEL);
 	if (!log->bios_event_log)
 		return -ENOMEM;
 
-	log->bios_event_log_end = log->bios_event_log + *sizep;
+	log->bios_event_log_end = log->bios_event_log + log_size;
 
-	memcpy(log->bios_event_log, __va(*basep), *sizep);
+	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0)
+		memcpy(chip->log.bios_event_log, __va(be64_to_cpup(basep)),
+		       log_size);
+	else
+		memcpy(chip->log.bios_event_log, __va(*basep), log_size);
 
 	return 0;
 }
Signature · 4 lines
2.5.0


------------------------------------------------------------------------------
#9 lore raw

Re: [PATCH v5 2/3] tpm: enhance read_log_of() to support Physical TPM event log

drivers/char/tpm/tpm_of.c int tpm_read_log_of(struct tpm_chip *chip) · line 52

Quoted 6 lines · Nayna Jain
drivers/char/tpm/tpm_of.c +5 -0
 	sizep = of_get_property(np, "linux,sml-size", NULL);
+	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0)
+		log_size = be32_to_cpup(sizep);
+	else
+		log_size = *sizep;
+

Uh, no, sizep can be null at this point:

drivers/char/tpm/tpm_of.c int tpm_read_log_of(struct tpm_chip *chip) · line 57

Quoted 5 lines
drivers/char/tpm/tpm_of.c +0 -0
 	basep = of_get_property(np, "linux,sml-base", NULL);
 	if (sizep == NULL && basep == NULL)
 		return -ENODEV;
 	if (sizep == NULL || basep == NULL)
 		return -EIO;

Move the if here.

Quoted 20 lines
drivers/char/tpm/tpm_of.c +8 -4
-	if (*sizep == 0) {
+	if (log_size == 0) {
 		dev_warn(&chip->dev, "%s: Event log area empty\n", __func__);
 		return -EIO;
 	}
 
-	log->bios_event_log = kmalloc(*sizep, GFP_KERNEL);
+	log->bios_event_log = kmalloc(log_size, GFP_KERNEL);
 	if (!log->bios_event_log)
 		return -ENOMEM;
 
-	log->bios_event_log_end = log->bios_event_log + *sizep;
+	log->bios_event_log_end = log->bios_event_log + log_size;
 
-	memcpy(log->bios_event_log, __va(*basep), *sizep);
+	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0)
+		memcpy(chip->log.bios_event_log, __va(be64_to_cpup(basep)),
+		       log_size);
+	else
+		memcpy(chip->log.bios_event_log, __va(*basep),
Quoted 1 line

log_size);

And move the conditional swap of basep up to be along side sizep as well (ie get rid of the second of_property_match_string)

Jason

------------------------------------------------------------------------------

author
#10 lore raw

Re: [PATCH v5 2/3] tpm: enhance read_log_of() to support Physical TPM event log

Quoted 9 lines · Jason Gunthorpe

drivers/char/tpm/tpm_of.c int tpm_read_log_of(struct tpm_chip *chip) · line 52

Quoted 6 lines · Nayna Jain
  	sizep = of_get_property(np, "linux,sml-size", NULL);
drivers/char/tpm/tpm_of.c +5 -0
+	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0)
+		log_size = be32_to_cpup(sizep);
+	else
+		log_size = *sizep;
+

Uh, no, sizep can be null at this point:

Oops !! Missed the basic. Will fix it. Sorry, and Thanks for noticing.

Quoted 8 lines
Quoted 6 lines

basep = of_get_property(np, "linux,sml-base", NULL); if (sizep == NULL && basep == NULL)
return -ENODEV;
if (sizep == NULL || basep == NULL)
return -EIO;

Move the if here.

Yeah..

Quoted 15 lines
Quoted 15 lines
drivers/char/tpm/tpm_of.c +3 -3
-	if (*sizep == 0) {
+	if (log_size == 0) {
  		dev_warn(&chip->dev, "%s: Event log area empty\n", __func__);
  		return -EIO;
  	}
 
-	log->bios_event_log = kmalloc(*sizep, GFP_KERNEL);
+	log->bios_event_log = kmalloc(log_size, GFP_KERNEL);
  	if (!log->bios_event_log)
  		return -ENOMEM;
 
-	log->bios_event_log_end = log->bios_event_log + *sizep;
+	log->bios_event_log_end = log->bios_event_log + log_size;
Quoted 11 lines
Quoted 7 lines
drivers/char/tpm/tpm_of.c +5 -1
-	memcpy(log->bios_event_log, __va(*basep), *sizep);
+	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0)
+		memcpy(chip->log.bios_event_log, __va(be64_to_cpup(basep)),
+		       log_size);
+	else
+		memcpy(chip->log.bios_event_log, __va(*basep),

log_size);

And move the conditional swap of basep up to be along side sizep as well (ie get rid of the second of_property_match_string)

Yeah.. true.. Will fix this also.

Thanks & Regards,
- Nayna

Quoted 2 lines

Jason

#11 lore raw

Re: [PATCH v5 2/3] tpm: enhance read_log_of() to support Physical TPM event log

In reply to Nayna Jain

drivers/char/tpm/tpm_of.c int tpm_read_log_of(struct tpm_chip *chip) · line 74

Quoted 6 lines · Nayna Jain
drivers/char/tpm/tpm_of.c +5 -1
-	memcpy(log->bios_event_log, __va(*basep), *sizep);
+	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0)
+		memcpy(chip->log.bios_event_log, __va(be64_to_cpup(basep)),
+		       log_size);
+	else
+		memcpy(chip->log.bios_event_log, __va(*basep), log_size);

This does not look good. You should be able rearrange your code in a way that you only have only one memcpy call.

/Jarkko

------------------------------------------------------------------------------

author
#12 lore raw

PATCH v5 3/3 tpm: add securityfs support for TPM 2.0 firmware event log

In reply to Nayna Jain

Unlike the device driver support for TPM 1.2, the TPM 2.0 does not support the securityfs pseudo files for displaying the firmware event log.

This patch enables support for providing the TPM 2.0 event log in binary form. TPM 2.0 event log supports a crypto agile format that records multiple digests, which is different from TPM 1.2. This patch enables the tpm_bios_log_setup for TPM 2.0 and adds the event log parser which understand the TPM 2.0 crypto agile format.

---
 drivers/char/tpm/Makefile            |   2 +-
 drivers/char/tpm/tpm2_eventlog.c     | 214 +++++++++++++++++++++++++++++++++++
 drivers/char/tpm/tpm_eventlog.h      |  69 +++++++++++
 drivers/char/tpm/tpm_eventlog_init.c |  43 +++----
 4 files changed, 308 insertions(+), 20 deletions(-)
 create mode 100644 drivers/char/tpm/tpm2_eventlog.c
drivers/char/tpm/Makefile +1 -1
index 1dc2671..f185a6a5 100644
@@ -3,7 +3,7 @@
 #
 obj-$(CONFIG_TCG_TPM) += tpm.o
 tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o tpm2-cmd.o \
-		tpm_eventlog.o tpm_eventlog_init.o
+		tpm_eventlog.o tpm_eventlog_init.o tpm2_eventlog.o
 tpm-$(CONFIG_ACPI) += tpm_ppi.o tpm_acpi.o
 tpm-$(CONFIG_OF) += tpm_of.o
 obj-$(CONFIG_TCG_TIS_CORE) += tpm_tis_core.o
drivers/char/tpm/tpm2_eventlog.c new file +214 -0

214 lines not on this page · raw message

drivers/char/tpm/tpm_eventlog.h +69 -0

83 lines not on this page · raw message

drivers/char/tpm/tpm_eventlog_init.c +24 -19

61 lines not on this page · raw message

Signature · 4 lines
2.5.0


------------------------------------------------------------------------------
#13 lore raw

Re: [PATCH v5 3/3] tpm: add securityfs support for TPM 2.0 firmware event log

Quoted 11 lines · Nayna Jain

Unlike the device driver support for TPM 1.2, the TPM 2.0 does not support the securityfs pseudo files for displaying the firmware event log.

This patch enables support for providing the TPM 2.0 event log in binary form. TPM 2.0 event log supports a crypto agile format that records multiple digests, which is different from TPM 1.2. This patch enables the tpm_bios_log_setup for TPM 2.0 and adds the event log parser which understand the TPM 2.0 crypto agile format.

I don't want to say much about this before I've tested it. I wonder what cheap hardware I could use to test this. Any advice is on this from anyone is much appreciated.

/Jarkko

------------------------------------------------------------------------------

Tested-by
#14 lore raw

Re: [tpmdd-devel] [PATCH v5 3/3] tpm: add securityfs support for TPM 2.0 firmware event log

Quoted 11 lines · Jarkko Sakkinen
Quoted 10 lines · Nayna Jain

Unlike the device driver support for TPM 1.2, the TPM 2.0 does not support the securityfs pseudo files for displaying the firmware event log.

This patch enables support for providing the TPM 2.0 event log in binary form. TPM 2.0 event log supports a crypto agile format that records multiple digests, which is different from TPM 1.2. This patch enables the tpm_bios_log_setup for TPM 2.0 and adds the event log parser which understand the TPM 2.0 crypto agile format.

Quoted 4 lines
Quoted 1 line

I don't want to say much about this before I've tested it. I wonder what cheap hardware I could use to test this. Any advice is on this from anyone is much appreciated.

Virtual hardware would be cheap :-)

I tested this series with QEMU + vTPM + SeaBIOS with TPM 1.2 + TPM 2 support (basing the log on ACPI). I had to fix an endianess issue on the SeaBIOS side, which made it work. So for this version of the patches I can give it my tested-by:

Quoted 9 lines

/Jarkko

------------------------------------------------------------------------------
_______________________________________________
tpmdd-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

#15 lore raw

Re: [tpmdd-devel] [PATCH v5 3/3] tpm: add securityfs support for TPM 2.0 firmware event log

Quoted 17 lines · Stefan Berger
Quoted 11 lines · Jarkko Sakkinen
Quoted 10 lines · Nayna Jain

Unlike the device driver support for TPM 1.2, the TPM 2.0 does not support the securityfs pseudo files for displaying the firmware event log.

This patch enables support for providing the TPM 2.0 event log in binary form. TPM 2.0 event log supports a crypto agile format that records multiple digests, which is different from TPM 1.2. This patch enables the tpm_bios_log_setup for TPM 2.0 and adds the event log parser which understand the TPM 2.0 crypto agile format.

Quoted 4 lines
Quoted 1 line

I don't want to say much about this before I've tested it. I wonder what cheap hardware I could use to test this. Any advice is on this from anyone is much appreciated.

Quoted 8 lines

Virtual hardware would be cheap :-)

I tested this series with QEMU + vTPM + SeaBIOS with TPM 1.2 + TPM 2 support (basing the log on ACPI). I had to fix an endianess issue on the SeaBIOS side, which made it work. So for this version of the patches I can give it my tested-by:

Thanks.

/Jarkko

#16 lore raw

Re: [tpmdd-devel] [PATCH v5 3/3] tpm: add securityfs support for TPM 2.0 firmware event log

In reply to Stefan Berger
Quoted 17 lines · Stefan Berger
Quoted 11 lines · Jarkko Sakkinen
Quoted 10 lines · Nayna Jain

Unlike the device driver support for TPM 1.2, the TPM 2.0 does not support the securityfs pseudo files for displaying the firmware event log.

This patch enables support for providing the TPM 2.0 event log in binary form. TPM 2.0 event log supports a crypto agile format that records multiple digests, which is different from TPM 1.2. This patch enables the tpm_bios_log_setup for TPM 2.0 and adds the event log parser which understand the TPM 2.0 crypto agile format.

Quoted 4 lines
Quoted 1 line

I don't want to say much about this before I've tested it. I wonder what cheap hardware I could use to test this. Any advice is on this from anyone is much appreciated.

Quoted 8 lines

Virtual hardware would be cheap :-)

I tested this series with QEMU + vTPM + SeaBIOS with TPM 1.2 + TPM 2 support (basing the log on ACPI). I had to fix an endianess issue on the SeaBIOS side, which made it work. So for this version of the patches I can give it my tested-by:

Your Tested-by is much appreciated because the 4.10 release cycle has shown how important it is to exercise code changes with tpm_vtpm_proxy to catch all the regressions. I still would like to run these changes with a real hardware to be able to trust them, though.

/Jarkko

------------------------------------------------------------------------------

#17 lore raw

Re: [PATCH v5 3/3] tpm: add securityfs support for TPM 2.0 firmware event log

In reply to Jarkko Sakkinen
Quoted 11 lines · Jarkko Sakkinen
Quoted 10 lines · Nayna Jain

Unlike the device driver support for TPM 1.2, the TPM 2.0 does not support the securityfs pseudo files for displaying the firmware event log.

This patch enables support for providing the TPM 2.0 event log in binary form. TPM 2.0 event log supports a crypto agile format that records multiple digests, which is different from TPM 1.2. This patch enables the tpm_bios_log_setup for TPM 2.0 and adds the event log parser which understand the TPM 2.0 crypto agile format.

Quoted 5 lines
Quoted 1 line

I don't want to say much about this before I've tested it. I wonder what cheap hardware I could use to test this. Any advice is on this from anyone is much appreciated.

If you found a small ARM system with TPM you could customize the uboot to build an event log and pass it in via DT.

Not sure how much work that would be, does uboot have tpm code already?

Jason

------------------------------------------------------------------------------

#18 lore raw

Re: [PATCH v5 3/3] tpm: add securityfs support for TPM 2.0 firmware event log

Quoted 18 lines · Jason Gunthorpe
Quoted 11 lines · Jarkko Sakkinen
Quoted 10 lines · Nayna Jain

Unlike the device driver support for TPM 1.2, the TPM 2.0 does not support the securityfs pseudo files for displaying the firmware event log.

This patch enables support for providing the TPM 2.0 event log in binary form. TPM 2.0 event log supports a crypto agile format that records multiple digests, which is different from TPM 1.2. This patch enables the tpm_bios_log_setup for TPM 2.0 and adds the event log parser which understand the TPM 2.0 crypto agile format.

Quoted 5 lines
Quoted 1 line

I don't want to say much about this before I've tested it. I wonder what cheap hardware I could use to test this. Any advice is on this from anyone is much appreciated.

Quoted 5 lines

If you found a small ARM system with TPM you could customize the uboot to build an event log and pass it in via DT.

Not sure how much work that would be, does uboot have tpm code already?

I have BeagleBoard Rev C (omap3530 arm board) and it has GPIOs but at the moment I do not possess a spare dTPM module. I'll ask my employer for one. It's quite old (2009), which is a good thing because of range of support I would presume...

If I get the spare dTPM I can do I2C/SPI through GPIOs as long as I find a way to inject stuff to DT. Hmm.. that said I've never done this before. I guess you can ask I2C/SPI driver somehow to use GPIOs?

Quoted 1 line

Jason

/Jarkko