summaryrefslogtreecommitdiff
path: root/src/commonlib
diff options
context:
space:
mode:
authorSergii Dmytruk <sergii.dmytruk@3mdeb.com>2022-10-23 00:47:55 +0300
committerFelix Held <felix-coreboot@felixheld.de>2023-03-04 02:01:48 +0000
commit53db677586e3e7c4a874f1ef16f34a6d01c269a0 (patch)
tree21f86ad11201bc00cf5a94653417ae3f96792e94 /src/commonlib
parent4191dbf0c9a57088e7a7323d8bf02a8708eacdb9 (diff)
security/tpm: add TPM log format as per 2.0 spec
Used by default for all boards with TPM2 which don't specify log format explicitly. Change-Id: I0fac386bebab1b7104378ae3424957c6497e84e1 Ticket: https://ticket.coreboot.org/issues/422 Ticket: https://ticket.coreboot.org/issues/423 Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com> Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68748 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/commonlib')
-rw-r--r--src/commonlib/bsd/include/commonlib/bsd/tpm_log_defs.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/tpm_log_defs.h b/src/commonlib/bsd/include/commonlib/bsd/tpm_log_defs.h
index a45a212746..144d55a331 100644
--- a/src/commonlib/bsd/include/commonlib/bsd/tpm_log_defs.h
+++ b/src/commonlib/bsd/include/commonlib/bsd/tpm_log_defs.h
@@ -9,6 +9,21 @@
#define TCPA_SPEC_ID_EVENT_SIGNATURE "Spec ID Event00"
#define TCG_EFI_SPEC_ID_EVENT_SIGNATURE "Spec ID Event03"
+#define TPM2_ALG_ERROR 0x0000
+#define TPM2_ALG_HMAC 0x0005
+#define TPM2_ALG_NULL 0x0010
+#define TPM2_ALG_SHA1 0x0004
+#define TPM2_ALG_SHA256 0x000B
+#define TPM2_ALG_SHA384 0x000C
+#define TPM2_ALG_SHA512 0x000D
+#define TPM2_ALG_SM3_256 0x0012
+
+#define SHA1_DIGEST_SIZE 20
+#define SHA256_DIGEST_SIZE 32
+#define SHA384_DIGEST_SIZE 48
+#define SHA512_DIGEST_SIZE 64
+#define SM3_256_DIGEST_SIZE 32
+
#define EV_PREBOOT_CERT 0x00000000
#define EV_POST_CODE 0x00000001
#define EV_UNUSED 0x00000002
@@ -39,4 +54,26 @@ struct spec_id_event_data {
uint8_t vendor_info_size;
} __packed;
+struct tpm_digest_sizes {
+ uint16_t alg_id;
+ uint16_t digest_size;
+} __packed;
+
+struct tcg_efi_spec_id_event {
+ uint32_t pcr_index;
+ uint32_t event_type;
+ uint8_t digest[20];
+ uint32_t event_size;
+ uint8_t signature[16];
+ uint32_t platform_class;
+ uint8_t spec_version_minor;
+ uint8_t spec_version_major;
+ uint8_t spec_errata;
+ uint8_t uintn_size;
+ uint32_t num_of_algorithms;
+ struct tpm_digest_sizes digest_sizes[0]; /* variable number of members */
+ /* uint8_t vendor_info_size; */
+ /* uint8_t vendor_info[vendor_info_size]; */
+} __packed;
+
#endif