summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2021-04-22 21:11:50 +0800
committerCommit Bot <commit-bot@chromium.org>2021-06-15 19:35:55 +0000
commitda50d8587ae24b1a5e7528dde1ead5523e78f6b2 (patch)
tree36f5fa76495c54d6421d8221b25146a86670f9ec
parent43fa783cbf6014d23d8b23b5eb7b4e63b17864ec (diff)
downloadvboot-da50d8587ae24b1a5e7528dde1ead5523e78f6b2.tar.gz
vboot/vboot_kernel: remove LoadKernelParams struct
LoadKernelParams struct is identical to VbSelectAndLoadKernelParams. Remove it, and use the public interface internally. 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: I8b820d18c1e9a66404a7a091aa3ccc1b050a559d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2846282 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/include/vboot_api.h7
-rw-r--r--firmware/lib/include/load_kernel_fw.h32
-rw-r--r--firmware/lib/include/vboot_test.h4
-rw-r--r--firmware/lib/vboot_api_kernel.c4
-rw-r--r--firmware/lib/vboot_kernel.c5
-rw-r--r--tests/vboot_api_kernel_tests.c5
-rw-r--r--tests/vboot_kernel_tests.c2
-rw-r--r--tests/verify_kernel.c2
-rw-r--r--utility/load_kernel_test.c4
9 files changed, 16 insertions, 49 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 43752e4a..98cbd9bc 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -44,7 +44,6 @@ typedef struct VbSharedDataHeader VbSharedDataHeader;
*/
typedef void *VbExDiskHandle_t;
-/* Data used only by VbSelectAndLoadKernel() */
typedef struct VbSelectAndLoadKernelParams {
/* Inputs to VbSelectAndLoadKernel() */
/* Destination buffer for kernel (normally at 0x100000 on x86) */
@@ -68,12 +67,6 @@ typedef struct VbSelectAndLoadKernelParams {
uint8_t partition_guid[16];
/* Flags set by signer */
uint32_t flags;
- /*
- * TODO: in H2C, all that pretty much just gets passed to the
- * bootloader as KernelBootloaderOptions, though the disk handle is
- * passed as an index instead of a handle. Is that used anymore now
- * that we're passing partition_guid?
- */
} VbSelectAndLoadKernelParams;
/**
diff --git a/firmware/lib/include/load_kernel_fw.h b/firmware/lib/include/load_kernel_fw.h
index b4661c3a..96c8f864 100644
--- a/firmware/lib/include/load_kernel_fw.h
+++ b/firmware/lib/include/load_kernel_fw.h
@@ -11,35 +11,6 @@
#include "vboot_api.h"
-struct vb2_context;
-
-/* Interface provided by verified boot library to BDS */
-
-typedef struct LoadKernelParams {
- /* Inputs to LoadKernel() */
- /* Disk handle for current device */
- VbExDiskHandle_t disk_handle;
- /* Destination buffer for kernel (normally at 0x100000) */
- void *kernel_buffer;
- /* Size of kernel buffer in bytes */
- uint64_t kernel_buffer_size;
-
- /*
- * Outputs from LoadKernel(); valid only if LoadKernel() returns
- * LOAD_KERNEL_SUCCESS
- */
- /* Partition number to boot on current device (1...M) */
- uint32_t partition_number;
- /* Address of bootloader image in RAM */
- uint64_t bootloader_address;
- /* Size of bootloader image in bytes */
- uint32_t bootloader_size;
- /* UniquePartitionGuid for boot partition */
- uint8_t partition_guid[16];
- /* Flags passed in by signer */
- uint32_t flags;
-} LoadKernelParams;
-
/**
* Attempt to load the kernel from the current device.
*
@@ -48,7 +19,8 @@ typedef struct LoadKernelParams {
*
* Returns VB2_SUCCESS if successful. If unsuccessful, returns an error code.
*/
-vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params,
+vb2_error_t LoadKernel(struct vb2_context *ctx,
+ VbSelectAndLoadKernelParams *params,
VbDiskInfo *disk_info);
#endif /* VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ */
diff --git a/firmware/lib/include/vboot_test.h b/firmware/lib/include/vboot_test.h
index 3cfe6377..41e8e5d9 100644
--- a/firmware/lib/include/vboot_test.h
+++ b/firmware/lib/include/vboot_test.h
@@ -11,7 +11,7 @@
/****************************************************************************
* vboot_api_kernel.c */
-struct LoadKernelParams;
-struct LoadKernelParams *VbApiKernelGetParams(void);
+struct VbSelectAndLoadKernelParams;
+struct VbSelectAndLoadKernelParams *VbApiKernelGetParams(void);
#endif /* VBOOT_REFERENCE_TEST_API_H_ */
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index f1e191a1..541cd028 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -21,11 +21,11 @@
#include "vboot_test.h"
/* Global variables */
-static LoadKernelParams lkp;
+static VbSelectAndLoadKernelParams lkp;
#ifdef CHROMEOS_ENVIRONMENT
/* Global variable accessor for unit tests */
-struct LoadKernelParams *VbApiKernelGetParams(void)
+struct VbSelectAndLoadKernelParams *VbApiKernelGetParams(void)
{
return &lkp;
}
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 75b40c4e..05458b09 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -343,7 +343,7 @@ enum vb2_load_partition_flags {
*/
static vb2_error_t vb2_load_partition(
struct vb2_context *ctx, VbExStream_t stream, uint32_t flags,
- LoadKernelParams *params)
+ VbSelectAndLoadKernelParams *params)
{
uint32_t read_ms = 0, start_ts;
struct vb2_workbuf wb;
@@ -456,7 +456,8 @@ static vb2_error_t vb2_load_partition(
return VB2_SUCCESS;
}
-vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params,
+vb2_error_t LoadKernel(struct vb2_context *ctx,
+ VbSelectAndLoadKernelParams *params,
VbDiskInfo *disk_info)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
diff --git a/tests/vboot_api_kernel_tests.c b/tests/vboot_api_kernel_tests.c
index b5e1e7c3..9904770b 100644
--- a/tests/vboot_api_kernel_tests.c
+++ b/tests/vboot_api_kernel_tests.c
@@ -312,7 +312,7 @@ static void ResetMocks(int i)
TEST_SUCC(vb2api_init(workbuf, sizeof(workbuf), &ctx),
"vb2api_init failed");
- memset(VbApiKernelGetParams(), 0, sizeof(LoadKernelParams));
+ memset(VbApiKernelGetParams(), 0, sizeof(VbSelectAndLoadKernelParams));
memset(&mock_disks, 0, sizeof(mock_disks));
load_kernel_calls = 0;
@@ -395,7 +395,8 @@ vb2_error_t VbExDiskFreeInfo(VbDiskInfo *infos,
return VB2_SUCCESS;
}
-vb2_error_t LoadKernel(struct vb2_context *c, LoadKernelParams *params,
+vb2_error_t LoadKernel(struct vb2_context *c,
+ VbSelectAndLoadKernelParams *params,
VbDiskInfo *disk_info)
{
got_find_disk = (const char *)params->disk_handle;
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c
index 6bfb3ae8..486602c0 100644
--- a/tests/vboot_kernel_tests.c
+++ b/tests/vboot_kernel_tests.c
@@ -54,7 +54,7 @@ static int gpt_flag_external;
static struct vb2_gbb_header gbb;
static VbExDiskHandle_t handle;
-static LoadKernelParams lkp;
+static VbSelectAndLoadKernelParams lkp;
static VbDiskInfo disk_info;
static struct vb2_keyblock kbh;
static struct vb2_kernel_preamble kph;
diff --git a/tests/verify_kernel.c b/tests/verify_kernel.c
index 7c2ce917..8fe969ef 100644
--- a/tests/verify_kernel.c
+++ b/tests/verify_kernel.c
@@ -23,7 +23,7 @@ static struct vb2_shared_data *sd;
static uint8_t *diskbuf;
-static LoadKernelParams params;
+static VbSelectAndLoadKernelParams params;
static VbDiskInfo disk_info;
vb2_error_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
diff --git a/utility/load_kernel_test.c b/utility/load_kernel_test.c
index c8f38f5b..cad82fd0 100644
--- a/utility/load_kernel_test.c
+++ b/utility/load_kernel_test.c
@@ -26,7 +26,7 @@ static struct vb2_context *ctx;
static struct vb2_shared_data *sd;
/* Global variables for stub functions */
-static LoadKernelParams lkp;
+static VbSelectAndLoadKernelParams lkp;
static VbDiskInfo disk_info;
static FILE *image_file = NULL;
@@ -100,7 +100,7 @@ int main(int argc, char* argv[])
int errorcnt = 0;
char *e = 0;
- memset(&lkp, 0, sizeof(LoadKernelParams));
+ memset(&lkp, 0, sizeof(VbSelectAndLoadKernelParams));
disk_info.bytes_per_lba = LBA_BYTES;
int boot_flags = BOOT_FLAG_RECOVERY;