summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2021-05-10 12:53:02 +0800
committerCommit Bot <commit-bot@chromium.org>2021-06-15 19:35:53 +0000
commit39ea3ade28b733521b480da161c61848764a3096 (patch)
treec88e136f8940059608bfb04a0d672c19e79c253a
parentc6cf8890532a7b78b6cb3dc534145f500444dae2 (diff)
downloadvboot-39ea3ade28b733521b480da161c61848764a3096.tar.gz
vboot/vboot_kernel: move workbuf init into vb2_load_partition
Not needed prior to that. This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ia60aa05384384bc1e2981266c33b960115734fae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2882527 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/lib/vboot_kernel.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index e2a71caa..53e8b129 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -339,18 +339,19 @@ enum vb2_load_partition_flags {
* @param stream Stream to load kernel from
* @param flags Flags (one or more of vb2_load_partition_flags)
* @param params Load-kernel parameters
- * @param wb Workbuf for data storage
* @return VB2_SUCCESS, or non-zero error code.
*/
static vb2_error_t vb2_load_partition(
struct vb2_context *ctx, VbExStream_t stream, uint32_t flags,
- LoadKernelParams *params, struct vb2_workbuf *wb)
+ LoadKernelParams *params)
{
uint32_t read_ms = 0, start_ts;
- struct vb2_workbuf wblocal = *wb;
+ struct vb2_workbuf wb;
+
+ vb2_workbuf_from_ctx(ctx, &wb);
/* Allocate kernel header buffer in workbuf */
- uint8_t *kbuf = vb2_workbuf_alloc(&wblocal, KBUF_SIZE);
+ uint8_t *kbuf = vb2_workbuf_alloc(&wb, KBUF_SIZE);
if (!kbuf)
return VB2_ERROR_LOAD_PARTITION_WORKBUF;
@@ -361,7 +362,7 @@ static vb2_error_t vb2_load_partition(
}
read_ms += vb2ex_mtime() - start_ts;
- if (vb2_verify_kernel_vblock(ctx, kbuf, KBUF_SIZE, &wblocal)) {
+ if (vb2_verify_kernel_vblock(ctx, kbuf, KBUF_SIZE, &wb)) {
return VB2_ERROR_LOAD_PARTITION_VERIFY_VBLOCK;
}
@@ -435,7 +436,7 @@ static vb2_error_t vb2_load_partition(
/* Verify kernel data */
if (vb2_verify_data(kernbuf, kernbuf_size, &preamble->body_signature,
- &data_key, &wblocal)) {
+ &data_key, &wb)) {
VB2_DEBUG("Kernel data verification failed.\n");
return VB2_ERROR_LOAD_PARTITION_VERIFY_BODY;
}
@@ -458,13 +459,10 @@ static vb2_error_t vb2_load_partition(
vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
- struct vb2_workbuf wb;
int found_partitions = 0;
uint32_t lowest_version = LOWEST_TPM_VERSION;
vb2_error_t rv;
- vb2_workbuf_from_ctx(ctx, &wb);
-
/* Clear output params in case we fail */
params->partition_number = 0;
params->bootloader_address = 0;
@@ -520,7 +518,7 @@ vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
lpflags |= VB2_LOAD_PARTITION_VBLOCK_ONLY;
}
- rv = vb2_load_partition(ctx, stream, lpflags, params, &wb);
+ rv = vb2_load_partition(ctx, stream, lpflags, params);
VbExStreamClose(stream);
if (rv) {