Philipp Deppenwiese has submitted this change and it was merged. ( https://review.coreboot.org/27757 )
Change subject: security/tpm/tspi: Set return type of tcpa_log_add_table_entry as void
......................................................................
security/tpm/tspi: Set return type of tcpa_log_add_table_entry as void
Change f849972 (security/vboot: Enable TCPA log extension) enabled
support for adding TCPA log to CBMEM. However, if CBMEM is not online,
this function doesn't do anything and returns early. This condition is
not really a valid error condition as it depends on when the call to
tcpa_log_add_table_entry is made. Since tcpa_log_add_table_entry
returns -1 when cbmem is not online, tpm_extend_pcr prints an error
message with prefix "ERROR:". This can confuse any scripts trying to
catch errors in boot flow.
This CL makes the following changes:
1. Removes the print in tpm_extend_pcr since tcpa_log_add_table_entry
already prints out appropriate ERROR messages in case of failure to
add log entry.
2. Since the return value of tcpa_log_add_table_entry is not used
anymore, return type for tcpa_log_add_table_entry is changed to void.
BUG=b:112030232
Change-Id: I32d313609a3e57845e67059b3747b81b5c8adb2a
Signed-off-by: Furquan Shaikh <furquan(a)google.com>
Reviewed-on: https://review.coreboot.org/27757
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki(a)gmail.com>
Reviewed-by: Justin TerAvest <teravest(a)chromium.org>
---
M src/security/tpm/tspi.h
M src/security/tpm/tspi/log.c
M src/security/tpm/tspi/tspi.c
3 files changed, 10 insertions(+), 13 deletions(-)
Approvals:
build bot (Jenkins): Verified
Philipp Deppenwiese: Looks good to me, approved
Justin TerAvest: Looks good to me, approved
diff --git a/src/security/tpm/tspi.h b/src/security/tpm/tspi.h
index 43254c1..94b53b0 100644
--- a/src/security/tpm/tspi.h
+++ b/src/security/tpm/tspi.h
@@ -28,8 +28,9 @@
/**
* Add table entry for cbmem TCPA log.
*/
-int tcpa_log_add_table_entry(const char *name, const uint32_t pcr,
- const uint8_t *digest, const size_t digest_length);
+void tcpa_log_add_table_entry(const char *name, const uint32_t pcr,
+ const uint8_t *digest,
+ const size_t digest_length);
/**
* Ask vboot for a digest and extend a TPM PCR with it.
diff --git a/src/security/tpm/tspi/log.c b/src/security/tpm/tspi/log.c
index 6091dfe..8ec4c6d 100644
--- a/src/security/tpm/tspi/log.c
+++ b/src/security/tpm/tspi/log.c
@@ -44,24 +44,24 @@
printk(BIOS_DEBUG, "TCPA log created at %p\n", tclt);
}
-int tcpa_log_add_table_entry(const char *name, const uint32_t pcr,
- const uint8_t *digest, const size_t digest_length)
+void tcpa_log_add_table_entry(const char *name, const uint32_t pcr,
+ const uint8_t *digest, const size_t digest_length)
{
MAYBE_STATIC struct tcpa_table *tclt = NULL;
struct tcpa_entry *tce;
if (!cbmem_possibly_online())
- return -1;
+ return;
tclt = cbmem_find(CBMEM_ID_TCPA_LOG);
if (!tclt) {
printk(BIOS_ERR, "ERROR: No TCPA log table found\n");
- return -1;
+ return;
}
if (tclt->num_entries == tclt->max_entries) {
printk(BIOS_WARNING, "ERROR: TCPA log table is full\n");
- return -1;
+ return;
}
tce = &tclt->entries[tclt->num_entries++];
@@ -70,6 +70,4 @@
tce->pcr = pcr;
memcpy(tce->digest, digest, digest_length);
tce->digest_length = digest_length;
-
- return 0;
}
diff --git a/src/security/tpm/tspi/tspi.c b/src/security/tpm/tspi/tspi.c
index 48b6219..950e930 100644
--- a/src/security/tpm/tspi/tspi.c
+++ b/src/security/tpm/tspi/tspi.c
@@ -190,9 +190,7 @@
if (result != TPM_SUCCESS)
return result;
- result = tcpa_log_add_table_entry(name, pcr, digest, digest_len);
- if (result != 0)
- printk(BIOS_ERR, "ERROR: Couldn't create TCPA log entry\n");
+ tcpa_log_add_table_entry(name, pcr, digest, digest_len);
- return 0;
+ return TPM_SUCCESS;
}
--
To view, visit https://review.coreboot.org/27757
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I32d313609a3e57845e67059b3747b81b5c8adb2a
Gerrit-Change-Number: 27757
Gerrit-PatchSet: 2
Gerrit-Owner: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Aaron Durbin <adurbin(a)chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Justin TerAvest <teravest(a)chromium.org>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/27757 )
Change subject: security/tpm/tspi: Set return type of tcpa_log_add_table_entry as void
......................................................................
Patch Set 1:
Ah I see if the verstage is loaded from the bootblock.
--
To view, visit https://review.coreboot.org/27757
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I32d313609a3e57845e67059b3747b81b5c8adb2a
Gerrit-Change-Number: 27757
Gerrit-PatchSet: 1
Gerrit-Owner: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Aaron Durbin <adurbin(a)chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Justin TerAvest <teravest(a)chromium.org>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Tue, 31 Jul 2018 21:58:34 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: No
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/27757 )
Change subject: security/tpm/tspi: Set return type of tcpa_log_add_table_entry as void
......................................................................
Patch Set 1:
@Furquan Do we conditions where measurements are done but cbmem isn't available ?
--
To view, visit https://review.coreboot.org/27757
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I32d313609a3e57845e67059b3747b81b5c8adb2a
Gerrit-Change-Number: 27757
Gerrit-PatchSet: 1
Gerrit-Owner: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Aaron Durbin <adurbin(a)chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Justin TerAvest <teravest(a)chromium.org>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Tue, 31 Jul 2018 21:54:21 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: No