summaryrefslogtreecommitdiff
path: root/firmware/lib/vboot_api_kernel.c
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-05-21 12:20:38 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-05-28 21:10:45 -0700
commitde2cae6b4d6ae864f2c90e6be73f683bad5f2f2f (patch)
tree023d1581f9054c6a54b9631be45f5277b721a23c /firmware/lib/vboot_api_kernel.c
parent236bfb0bc3bd0aa37bd06702c25993446f9b6dba (diff)
downloadvboot-de2cae6b4d6ae864f2c90e6be73f683bad5f2f2f.tar.gz
vboot: save GBB header in workbuf during firmware verification
Since GBB header will be needed for subsequent GBB reads later on (in kernel verification stage), and since GBB header is relatively small (128 bytes), save the full GBB header onto workbuf during firmware verification stage, and store an offset pointer to it in vb2_shared_data. vb2_gbb_header object may be accessed via the vb2_get_gbb function. Additionally, update functions in firmware/lib/region-init.c to read GBB data from flash, rather than using cparams passed in by depthcharge, which is slated for deprecation. BUG=b:124141368, chromium:954774 TEST=make clean && make runtests BRANCH=none Change-Id: I6e6218231299ce3a5b383663bc3480b20f929840 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1585500 Reviewed-on: https://chromium-review.googlesource.com/1627430 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'firmware/lib/vboot_api_kernel.c')
-rw-r--r--firmware/lib/vboot_api_kernel.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 2be3e938..5d4c7c09 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -261,6 +261,7 @@ static VbError_t vb2_kernel_setup(struct vb2_context *ctx,
vb2_nv_init(ctx);
struct vb2_shared_data *sd = vb2_get_sd(ctx);
+ struct vb2_gbb_header *gbb = vb2_get_gbb(ctx);
sd->recovery_reason = shared->recovery_reason;
/*
@@ -294,11 +295,6 @@ static VbError_t vb2_kernel_setup(struct vb2_context *ctx,
kparams->flags = 0;
memset(kparams->partition_guid, 0, sizeof(kparams->partition_guid));
- /* Point to GBB data from cparams */
- sd->gbb = cparams->gbb_data;
- sd->gbb_size = cparams->gbb_size;
- sd->gbb_flags = sd->gbb->flags;
-
/* Read kernel version from the TPM. Ignore errors in recovery mode. */
if (RollbackKernelRead(&shared->kernel_version_tpm)) {
VB2_DEBUG("Unable to get kernel versions from TPM\n");
@@ -311,7 +307,7 @@ static VbError_t vb2_kernel_setup(struct vb2_context *ctx,
shared->kernel_version_tpm_start = shared->kernel_version_tpm;
/* Read FWMP. Ignore errors in recovery mode. */
- if (sd->gbb_flags & VB2_GBB_FLAG_DISABLE_FWMP) {
+ if (gbb->flags & VB2_GBB_FLAG_DISABLE_FWMP) {
memset(&fwmp, 0, sizeof(fwmp));
} else if (RollbackFwmpRead(&fwmp)) {
VB2_DEBUG("Unable to get FWMP from TPM\n");
@@ -473,6 +469,7 @@ VbError_t VbVerifyMemoryBootImage(
goto fail;
struct vb2_shared_data *sd = vb2_get_sd(ctx);
+ struct vb2_gbb_header *gbb = vb2_get_gbb(ctx);
VbSharedDataHeader *shared = sd->vbsd;
if ((boot_image == NULL) || (image_size == 0)) {
@@ -495,7 +492,7 @@ VbError_t VbVerifyMemoryBootImage(
vb2_nv_get(ctx, VB2_NV_DEV_BOOT_FASTBOOT_FULL_CAP);
if (0 == allow_fastboot_full_cap) {
- allow_fastboot_full_cap = !!(sd->gbb_flags &
+ allow_fastboot_full_cap = !!(gbb->flags &
VB2_GBB_FLAG_FORCE_DEV_BOOT_FASTBOOT_FULL_CAP);
}