From 1058dd84f06fa2fcbdd99eb99da07dccdf5b9722 Mon Sep 17 00:00:00 2001 From: Wim Vervoorn Date: Fri, 1 Nov 2019 10:22:22 +0100 Subject: security/vboot: Removed vboot_prepare from vboot_locator When prog_locate() is called in the stage VBOOT is starting from and the image to be loaded is not the target image vboot_prepare() may be called too early. To prevent this vboot_prepare() is removed from the vboot_locator structure. This allows more control over the start of the vboot logic. To clarify the change the vboot_prepare() has been renamed to vboot_run_logic() and calls to initialize vboot have been added at the following places: postcar_loader: when VBOOT starts in ROMSTAGE romstage_loader: when VBOOT starts in BOOTBLOCK ramstage_loader: when VBOOT starts in ROMSTAGE BUG=N/A TEST=tested on facebook fbg1701 Change-Id: Id5e8fd78458c09dd3896bfd142bd49c2c3d686df Signed-off-by: Wim Vervoorn Reviewed-on: https://review.coreboot.org/c/coreboot/+/36543 Reviewed-by: Frans Hendriks Tested-by: build bot (Jenkins) --- src/lib/prog_loaders.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/lib') diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c index 183a22bff0..72c1de1e34 100644 --- a/src/lib/prog_loaders.c +++ b/src/lib/prog_loaders.c @@ -30,6 +30,7 @@ #include #include #include +#include /* Only can represent up to 1 byte less than size_t. */ const struct mem_region_device addrspace_32bit = @@ -59,6 +60,8 @@ void run_romstage(void) struct prog romstage = PROG_INIT(PROG_ROMSTAGE, CONFIG_CBFS_PREFIX "/romstage"); + vboot_run_logic(); + if (prog_locate(&romstage)) goto fail; @@ -135,6 +138,8 @@ void run_ramstage(void) !CONFIG(NO_STAGE_CACHE)) run_ramstage_from_resume(&ramstage); + vboot_run_logic(); + if (prog_locate(&ramstage)) goto fail; -- cgit v1.2.3