[PATCH V2] tpmevlog: print out the TPM event log format type
Ivan Hu
ivan.hu at canonical.com
Thu Apr 8 09:35:07 UTC 2021
Helps to understand the log implemented by following which version of TPM spec.
Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
src/tpm/tpmevlog/tpmevlog.c | 6 ++++--
src/tpm/tpmevlogdump/tpmevlogdump.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/tpm/tpmevlog/tpmevlog.c b/src/tpm/tpmevlog/tpmevlog.c
index 1b952820..a0dbe7f6 100644
--- a/src/tpm/tpmevlog/tpmevlog.c
+++ b/src/tpm/tpmevlog/tpmevlog.c
@@ -460,9 +460,11 @@ static int tpmevlog_test1(fwts_framework *fw)
return FWTS_ABORTED;
} else {
/* check if the TPM2 eventlog */
- if (strstr((char *)(data + sizeof(fwts_pc_client_pcr_event)), FWTS_TPM_EVENTLOG_V2_SIGNATURE))
+ if (strstr((char *)(data + sizeof(fwts_pc_client_pcr_event)), FWTS_TPM_EVENTLOG_V2_SIGNATURE)) {
+ fwts_log_info_verbatim(fw, "Crypto agile log format (TPM2.0):");
tpmevlog_v2_check(fw, data, length);
- else {
+ } else {
+ fwts_log_info_verbatim(fw, "SHA1 log format (TPM1.2):");
tpmevlog_check(fw, data, length);
}
diff --git a/src/tpm/tpmevlogdump/tpmevlogdump.c b/src/tpm/tpmevlogdump/tpmevlogdump.c
index 612c1e4e..4650188f 100644
--- a/src/tpm/tpmevlogdump/tpmevlogdump.c
+++ b/src/tpm/tpmevlogdump/tpmevlogdump.c
@@ -489,9 +489,11 @@ static int tpmevlogdump_test1(fwts_framework *fw)
return FWTS_ABORTED;
} else {
/* check if the TPM2 eventlog */
- if (strstr((char *)(data + sizeof(fwts_pc_client_pcr_event)), FWTS_TPM_EVENTLOG_V2_SIGNATURE))
+ if (strstr((char *)(data + sizeof(fwts_pc_client_pcr_event)), FWTS_TPM_EVENTLOG_V2_SIGNATURE)) {
+ fwts_log_info_verbatim(fw, "Crypto agile log format (TPM2.0):");
tpmevlogdump_parser(fw, data, length);
- else {
+ } else {
+ fwts_log_info_verbatim(fw, "SHA1 log format (TPM1.2):");
(void)tpmevlogdump_event_dump(fw, data, length);
}
free(data);
--
2.25.1
More information about the fwts-devel
mailing list