Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion configs/config.emulation_qemu_x86_q35_uefi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ CONFIG_DRIVERS_EFI_MAIN_FW_LSV=0x00020101
CONFIG_DRIVERS_EFI_UPDATE_CAPSULES=y
CONFIG_TPM1=y
CONFIG_TPM2=y
CONFIG_TPM_HASH_SHA256=y
CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0=y
# CONFIG_CONSOLE_USE_LOGLEVEL_PREFIX is not set
# CONFIG_CONSOLE_USE_ANSI_ESCAPES is not set
Expand Down
1 change: 0 additions & 1 deletion configs/config.emulation_qemu_x86_q35_uefi_all_menus
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ CONFIG_UDK_202005_BINDING=y
CONFIG_DRIVERS_EFI_VARIABLE_STORE=y
CONFIG_TPM1=y
CONFIG_TPM2=y
CONFIG_TPM_HASH_SHA256=y
CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0=y
# CONFIG_CONSOLE_USE_LOGLEVEL_PREFIX is not set
# CONFIG_CONSOLE_USE_ANSI_ESCAPES is not set
Expand Down
21 changes: 6 additions & 15 deletions src/lib/cbfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,12 @@ static bool cbfs_file_hash_mismatch(const void *buffer, size_t size,
}

if (CONFIG(TPM_MEASURED_BOOT) && !ENV_SMM) {
struct vb2_hash calculated_hash;

/* No need to re-hash file if we already have it from verification. */
if (!hash || hash->algo != tpm_log_alg()) {
if (vb2_hash_calculate(vboot_hwcrypto_allowed(), buffer, size,
tpm_log_alg(), &calculated_hash))
hash = NULL;
else
hash = &calculated_hash;
}

if (!hash ||
tspi_cbfs_measurement(mdata->h.filename, be32toh(mdata->h.type), hash))
ERROR("failed to measure '%s' into TPM log\n", mdata->h.filename);
/* We intentionally continue to boot on measurement errors. */
tpm_result_t rc = tspi_cbfs_measurement(mdata->h.filename, buffer, size,
be32toh(mdata->h.type), hash);
if (rc != TPM_SUCCESS)
ERROR("failed to measure '%s' into TPM log, error %#x\n",
mdata->h.filename, rc);
/* We intentionally continue to boot on measurement errors. */
}

return false;
Expand Down
Loading