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>
This commit is contained in:
Yu-Ping Wu 2023-09-14 14:56:11 +08:00 committed by Felix Held
parent 3df6cc9de6
commit a3ff9e7cdb
1 changed files with 7 additions and 5 deletions

View File

@ -182,10 +182,13 @@ static vb2_error_t hash_body(struct vb2_context *ctx,
return handle_digest_result(hash_digest, hash_digest_sz); 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) || vb2_error_t rv;
vboot_extend_pcr(ctx, CONFIG_PCR_HWID, HWID_DIGEST_PCR); 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 #define EC_EFS_BOOT_MODE_VERIFIED_RW 0x00
@ -346,8 +349,7 @@ void verstage_main(void)
vb2_digest_size(metadata_hash->algo)); vb2_digest_size(metadata_hash->algo));
} else { } else {
struct region_device fw_body; struct region_device fw_body;
rv = vboot_locate_firmware(ctx, &fw_body); if (vboot_locate_firmware(ctx, &fw_body))
if (rv)
die_with_post_code(POSTCODE_INVALID_ROM, die_with_post_code(POSTCODE_INVALID_ROM,
"Failed to read FMAP to locate firmware"); "Failed to read FMAP to locate firmware");