summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-07-30 10:07:45 +0800
committerCommit Bot <commit-bot@chromium.org>2019-12-06 21:19:42 +0000
commit09f6670674639ef81eb695802a347b8be2dac20a (patch)
tree35a98219e504d5e33ecc391b45143a3c803c7e8d
parent99b15d64f9b15a487fd871fcd527d00c3641509c (diff)
downloadvboot-09f6670674639ef81eb695802a347b8be2dac20a.tar.gz
vboot: migrate GBB-related error handling to vboot2
Pass on values returned from vb2_gbb_* functions instead of using VBERROR_INVALID_GBB on error. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I66b99393f0fcc9eabe629d08b35247764cfbcefb Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1728296 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--firmware/2lib/include/2return_codes.h2
-rw-r--r--firmware/lib/vboot_kernel.c12
2 files changed, 5 insertions, 9 deletions
diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h
index 0d344476..b51bab3d 100644
--- a/firmware/2lib/include/2return_codes.h
+++ b/firmware/2lib/include/2return_codes.h
@@ -69,8 +69,6 @@ enum vb2_return_code {
VBERROR_TPM_LOCK_KERNEL = 0x1000C,
/* Calling firmware requested shutdown via VbExIsShutdownRequested() */
VBERROR_SHUTDOWN_REQUESTED = 0x1000D,
- /* Invalid Google binary block */
- VBERROR_INVALID_GBB = 0x10013,
/* Invalid bitmap volume */
VBERROR_INVALID_BMPFV = 0x10014,
/* Invalid screen index */
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 48d03448..a354a8d5 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -444,7 +444,6 @@ vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
VbSharedDataKernelCall *shcall = NULL;
int found_partitions = 0;
uint32_t lowest_version = LOWEST_TPM_VERSION;
- vb2_error_t retval = VB2_ERROR_UNKNOWN;
vb2_error_t rv;
vb2_workbuf_from_ctx(ctx, &wb);
@@ -475,7 +474,6 @@ vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
rv = vb2_gbb_read_recovery_key(ctx, &kernel_subkey, NULL, &wb);
if (VB2_SUCCESS != rv) {
VB2_DEBUG("GBB read recovery key failed.\n");
- retval = VBERROR_INVALID_GBB;
goto load_kernel_exit;
}
} else {
@@ -652,16 +650,16 @@ gpt_done:
shared->kernel_version_tpm = lowest_version;
/* Success! */
- retval = VB2_SUCCESS;
+ rv = VB2_SUCCESS;
} else if (found_partitions > 0) {
shcall->check_result = VBSD_LKC_CHECK_INVALID_PARTITIONS;
- retval = VB2_ERROR_LK_INVALID_KERNEL_FOUND;
+ rv = VB2_ERROR_LK_INVALID_KERNEL_FOUND;
} else {
shcall->check_result = VBSD_LKC_CHECK_NO_PARTITIONS;
- retval = VB2_ERROR_LK_NO_KERNEL_FOUND;
+ rv = VB2_ERROR_LK_NO_KERNEL_FOUND;
}
load_kernel_exit:
- shcall->return_code = (uint8_t)retval;
- return retval;
+ shcall->return_code = (uint8_t)rv;
+ return rv;
}