diff options
author | Jon Murphy <jpmurphy@google.com> | 2023-09-05 11:36:43 -0600 |
---|---|---|
committer | Raul Rangel <rrangel@chromium.org> | 2023-09-28 16:54:37 +0000 |
commit | d7b8dc9cf5978809912dcffefce2eda5937c9653 (patch) | |
tree | 56befbc9563ce2baca6f31ccbfb041e99fb858d6 /src/vendorcode/eltan/security/verified_boot | |
parent | 53fc667943052bd592b8406bdf4bf652c6c9cd3a (diff) |
treewide: convert to tpm_result_t
Convert TPM functions to return TPM error codes(referred to as
tpm_result_t) values to match the TCG standard.
BUG=b:296439237
TEST=build and boot to Skyrim
BRANCH=None
Change-Id: Ifdf9ff6c2a1f9b938dbb04d245799391115eb6b1
Signed-off-by: Jon Murphy <jpmurphy@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77666
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/vendorcode/eltan/security/verified_boot')
-rw-r--r-- | src/vendorcode/eltan/security/verified_boot/vboot_check.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/vendorcode/eltan/security/verified_boot/vboot_check.c b/src/vendorcode/eltan/security/verified_boot/vboot_check.c index 9ea31b877c..9d610064c4 100644 --- a/src/vendorcode/eltan/security/verified_boot/vboot_check.c +++ b/src/vendorcode/eltan/security/verified_boot/vboot_check.c @@ -5,6 +5,7 @@ #include <bootmode.h> #include <cbfs.h> #include <fmap_config.h> +#include <security/tpm/tss_errors.h> #include <vboot_check.h> #include <vboot_common.h> #include <vb2_internals_please_do_not_use.h> @@ -115,24 +116,24 @@ fail: * @retval TPM_SUCCESS Operation completed successfully. * @retval TPM_IOERROR Unexpected device behavior. */ -static int measure_item(uint32_t pcr, uint8_t *hashData, uint32_t hashDataLen, +static tpm_result_t measure_item(uint32_t pcr, uint8_t *hashData, uint32_t hashDataLen, int8_t *event_msg, TCG_EVENTTYPE eventType) { - int status = TPM_SUCCESS; + tpm_result_t rc = TPM_SUCCESS; TCG_PCR_EVENT2_HDR tcgEventHdr; memset(&tcgEventHdr, 0, sizeof(tcgEventHdr)); tcgEventHdr.pcrIndex = pcr; tcgEventHdr.eventType = eventType; if (event_msg) { - status = mboot_hash_extend_log(MBOOT_HASH_PROVIDED, hashData, + rc = mboot_hash_extend_log(MBOOT_HASH_PROVIDED, hashData, hashDataLen, &tcgEventHdr, (uint8_t *)event_msg); - if (status == TPM_SUCCESS) + if (rc == TPM_SUCCESS) printk(BIOS_INFO, "%s: Success! %s measured to pcr %d.\n", __func__, event_msg, pcr); } - return status; + return rc; } static void verified_boot_check_buffer(const char *name, void *start, size_t size, @@ -140,6 +141,7 @@ static void verified_boot_check_buffer(const char *name, void *start, size_t siz { uint8_t digest[DIGEST_SIZE]; vb2_error_t status; + tpm_result_t rc = TPM_SUCCESS; printk(BIOS_DEBUG, "%s: %s HASH verification buffer %p size %d\n", __func__, name, start, (int)size); @@ -166,10 +168,11 @@ static void verified_boot_check_buffer(const char *name, void *start, size_t siz if (pcr != -1) { printk(BIOS_DEBUG, "%s: measuring %s\n", __func__, name); - if (measure_item(pcr, digest, sizeof(digest), - (int8_t *)name, 0)) - printk(BIOS_DEBUG, "%s: measuring failed!\n", - __func__); + rc = measure_item(pcr, digest, sizeof(digest), + (int8_t *)name, 0); + if (rc) + printk(BIOS_DEBUG, "%s: measuring failed with error %#x!\n", + __func__, rc); } } if (CONFIG(VENDORCODE_ELTAN_VBOOT)) |