mrc_cache: Add tpm_hash_index field to cache_region struct
Pull selection of tpm hash index logic into cache_region struct. This CL also enables the storing of the MRC hash into the TPM NVRAM space for both recovery and non-recovery cases. This will affect all platforms with TPM2 enabled and use the MRC_CACHE driver. BUG=b:150502246 BRANCH=None TEST=make sure memory training still works on nami and lazor Change-Id: I1a744d6f40f062ca3aab6157b3747e6c1f6977f9 Signed-off-by: Shelley Chen <shchen@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46514 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
parent
df0481e9e1
commit
c1040f3ef4
2 changed files with 18 additions and 15 deletions
|
|
@ -24,10 +24,6 @@ void mrc_cache_update_hash(uint32_t index, const uint8_t *data, size_t size)
|
|||
};
|
||||
const uint8_t *hash_ptr = data_hash;
|
||||
|
||||
/* We do not store normal mode data hash in TPM. */
|
||||
if (!vboot_recovery_mode_enabled())
|
||||
return;
|
||||
|
||||
/* Initialize TPM driver. */
|
||||
if (tlcl_lib_init() != VB2_SUCCESS) {
|
||||
printk(BIOS_ERR, "MRC: TPM driver initialization failed.\n");
|
||||
|
|
@ -64,10 +60,6 @@ int mrc_cache_verify_hash(uint32_t index, const uint8_t *data, size_t size)
|
|||
uint8_t data_hash[VB2_SHA256_DIGEST_SIZE];
|
||||
uint8_t tpm_hash[VB2_SHA256_DIGEST_SIZE];
|
||||
|
||||
/* We do not store normal mode data hash in TPM. */
|
||||
if (!vboot_recovery_mode_enabled())
|
||||
return 1;
|
||||
|
||||
/* Calculate hash of data read from MRC_CACHE. */
|
||||
if (vb2_digest_buffer(data, size, VB2_HASH_SHA256, data_hash,
|
||||
sizeof(data_hash))) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue