aboutsummaryrefslogtreecommitdiffstats
path: root/src/std/tcg.h
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2016-08-05 11:07:11 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-08-10 15:01:04 -0400
commita99de5c35df0419ed630437c31031e145351dbc8 (patch)
treec0f882a8f9bf64bd80bc14d283459b70789a5f3a /src/std/tcg.h
parent3b97efad61e39cf430286b6cb85db64069c0a951 (diff)
downloadseabios-a99de5c35df0419ed630437c31031e145351dbc8.tar.gz
seabios-a99de5c35df0419ed630437c31031e145351dbc8.tar.xz
seabios-a99de5c35df0419ed630437c31031e145351dbc8.zip
tpm: Extend tpm20_extend to support extending to multiple PCR banks
Extend the tpm20_extend function to support extending a hash to multiple PCR banks. The sha1 hash that's being extended into the sha256 bank for example, will be filled with zero-bytes to the size of a sha256 hash. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/std/tcg.h')
-rw-r--r--src/std/tcg.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/std/tcg.h b/src/std/tcg.h
index 730b39c..401b20b 100644
--- a/src/std/tcg.h
+++ b/src/std/tcg.h
@@ -100,6 +100,10 @@ enum irq_ids {
#define EV_IPL_PARTITION_DATA 14
#define SHA1_BUFSIZE 20
+#define SHA256_BUFSIZE 32
+#define SHA384_BUFSIZE 48
+#define SHA512_BUFSIZE 64
+#define SM3_256_BUFSIZE 32
/* Input and Output blocks for the TCG BIOS commands */
@@ -381,6 +385,10 @@ struct tpm_res_sha1complete {
#define TPM2_RH_PLATFORM 0x4000000c
#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
/* TPM 2 command tags */
#define TPM2_ST_NO_SESSIONS 0x8001
@@ -441,18 +449,12 @@ struct tpm2_req_hierarchychangeauth {
struct tpm2b_20 newAuth;
} PACKED;
-struct tpm2_digest_value {
- u16 hashalg; /* TPM2_ALG_SHA1 */
- u8 sha1[SHA1_BUFSIZE];
-} PACKED;
-
struct tpm2_req_extend {
struct tpm_req_header hdr;
u32 pcrindex;
u32 authblocksize;
struct tpm2_authblock authblock;
- u32 count;
- struct tpm2_digest_value digest;
+ u8 digest[0];
} PACKED;
struct tpm2_req_clearcontrol {
@@ -506,6 +508,22 @@ struct tpml_pcr_selection {
/* TPM 2 log entry */
+struct tpm2_digest_value {
+ u16 hashAlg;
+ u8 hash[0]; /* size depends on hashAlg */
+} PACKED;
+
+struct tpm2_digest_values {
+ u32 count;
+ struct tpm2_digest_value digest[0];
+} PACKED;
+
+struct tpm_log_header {
+ u32 pcrindex;
+ u32 eventtype;
+ u8 digest[0];
+} PACKED;
+
struct tpml_digest_values_sha1 {
u32 count; /* number of digests */
u16 hashtype;