diff options
author | Subrata Banik <subratabanik@google.com> | 2023-12-27 20:59:41 +0530 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2023-12-31 03:18:42 +0000 |
commit | 0f90c5d5f9faa31b53da6680175da19f9d8efbfa (patch) | |
tree | 3dc9b823907a2f6f36820fcdd2a673b0c7468e43 /src/security/tpm/tss/tcg-2.0 | |
parent | acf10d6096460874785ab951c75589c133afb66f (diff) |
security/tpm: Retrieve factory configuration for device w/ Google TPM
This patch enables retrieval of factory configuration data from
Google TPM devices (both Cr50 and Ti50).
This patch utilizes vendor-specific command
TPM2_CR50_SUB_CMD_GET_FACTORY_CONFIG (68).
The factory config space is a 64-bit, one-time programmable.
For the unprovisioned one, the read will be 0x0.
BUG=b:317880956
TEST=Able to retrieve the factory config from google/screebo.
Change-Id: Ifd0e850770152a03aa46d7f8bbb76f7520a59081
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79736
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/security/tpm/tss/tcg-2.0')
-rw-r--r-- | src/security/tpm/tss/tcg-2.0/tss_marshaling.c | 5 | ||||
-rw-r--r-- | src/security/tpm/tss/tcg-2.0/tss_structures.h | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/security/tpm/tss/tcg-2.0/tss_marshaling.c b/src/security/tpm/tss/tcg-2.0/tss_marshaling.c index f1b9522e6c..5ade6395bb 100644 --- a/src/security/tpm/tss/tcg-2.0/tss_marshaling.c +++ b/src/security/tpm/tss/tcg-2.0/tss_marshaling.c @@ -348,6 +348,9 @@ static int marshal_cr50_vendor_command(struct obuf *ob, const void *command_body case TPM2_CR50_SUB_CMD_RESET_EC: rc |= obuf_write_be16(ob, *sub_command); break; + case TPM2_CR50_SUB_CMD_GET_FACTORY_CONFIG: + rc |= obuf_write_be16(ob, *sub_command); + break; default: /* Unsupported subcommand. */ printk(BIOS_WARNING, "Unsupported cr50 subcommand: 0x%04x\n", @@ -581,6 +584,8 @@ static int unmarshal_vendor_command(struct ibuf *ib, return ibuf_read_be8(ib, &vcr->boot_mode); case TPM2_CR50_SUB_CMD_RESET_EC: break; + case TPM2_CR50_SUB_CMD_GET_FACTORY_CONFIG: + return ibuf_read_be64(ib, &vcr->factory_config); default: printk(BIOS_ERR, "%s:%d - unsupported vendor command %#04x!\n", diff --git a/src/security/tpm/tss/tcg-2.0/tss_structures.h b/src/security/tpm/tss/tcg-2.0/tss_structures.h index a73f4c48e6..f2682b1878 100644 --- a/src/security/tpm/tss/tcg-2.0/tss_structures.h +++ b/src/security/tpm/tss/tcg-2.0/tss_structures.h @@ -352,6 +352,11 @@ struct vendor_command_response { uint8_t recovery_button_state; uint8_t tpm_mode; uint8_t boot_mode; + /* + * bits 63..8 : reserved + * bits 7..0 : factory config + */ + uint64_t factory_config; }; }; |