summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2023-09-14 14:56:11 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-09-18 15:16:08 +0000
commita3ff9e7cdb80bf0ed3f3baf17177250a75cd8543 (patch)
tree3cc11c8e69f4842261d4fc70f9d511a80ff3e5a9
parent3df6cc9de61ba16a94b40086999ddb6a9943dc26 (diff)
security/vboot: Fix return type of extend_pcrs()
Since vboot_extend_pcr() returns vb2_error_t, the return type of extend_pcrs() should be vb2_error_t too. Also fix an assignment for vboot_locate_firmware(), which returns int instead of vb2_error_t. Change-Id: I1a2a2a66f3e594aba64d33cfc532d1bd88fa305e Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/77869 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yidi Lin <yidilin@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--src/security/vboot/vboot_logic.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/security/vboot/vboot_logic.c b/src/security/vboot/vboot_logic.c
index 9a8a9657e4..dc79fdae28 100644
--- a/src/security/vboot/vboot_logic.c
+++ b/src/security/vboot/vboot_logic.c
@@ -182,10 +182,13 @@ static vb2_error_t hash_body(struct vb2_context *ctx,
return handle_digest_result(hash_digest, hash_digest_sz);
}
-static uint32_t extend_pcrs(struct vb2_context *ctx)
+static vb2_error_t extend_pcrs(struct vb2_context *ctx)
{
- return vboot_extend_pcr(ctx, CONFIG_PCR_BOOT_MODE, BOOT_MODE_PCR) ||
- vboot_extend_pcr(ctx, CONFIG_PCR_HWID, HWID_DIGEST_PCR);
+ vb2_error_t rv;
+ rv = vboot_extend_pcr(ctx, CONFIG_PCR_BOOT_MODE, BOOT_MODE_PCR);
+ if (rv)
+ return rv;
+ return vboot_extend_pcr(ctx, CONFIG_PCR_HWID, HWID_DIGEST_PCR);
}
#define EC_EFS_BOOT_MODE_VERIFIED_RW 0x00
@@ -346,8 +349,7 @@ void verstage_main(void)
vb2_digest_size(metadata_hash->algo));
} else {
struct region_device fw_body;
- rv = vboot_locate_firmware(ctx, &fw_body);
- if (rv)
+ if (vboot_locate_firmware(ctx, &fw_body))
die_with_post_code(POSTCODE_INVALID_ROM,
"Failed to read FMAP to locate firmware");