summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2018-01-04 17:58:01 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-09 14:14:17 -0800
commitb07b4b9c71fd54a923fa914a046fcf7183d65c22 (patch)
treec214f67512f451953a40625655c9fa9af5b3cb8f
parent98616d79c6b60c719bc3e37f7f82028e77983d94 (diff)
downloadvboot-b07b4b9c71fd54a923fa914a046fcf7183d65c22.tar.gz
firmware: Stop using vboot1 cparams internally
Now that vb2_shared_data / vb2_context provides all the same data to lower-level kernel verification code that cparams did, stop passing cparams down to those functions. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I86eb1801ee96d8b56404b74843a8d09e3122567f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852814 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
-rw-r--r--firmware/include/gbb_access.h4
-rw-r--r--firmware/lib/include/load_kernel_fw.h4
-rw-r--r--firmware/lib/include/vboot_kernel.h16
-rw-r--r--firmware/lib/vboot_api_kernel.c36
-rw-r--r--firmware/lib/vboot_kernel.c6
-rw-r--r--firmware/lib/vboot_ui.c25
-rw-r--r--firmware/lib/vboot_ui_menu.c29
-rw-r--r--firmware/linktest/main.c2
-rw-r--r--tests/ec_sync_tests.c5
-rw-r--r--tests/vboot_api_devmode_tests.c5
-rw-r--r--tests/vboot_api_kernel2_tests.c102
-rw-r--r--tests/vboot_api_kernel4_tests.c7
-rw-r--r--tests/vboot_api_kernel_tests.c5
-rw-r--r--tests/vboot_detach_menu_tests.c102
-rw-r--r--tests/vboot_display_tests.c4
-rw-r--r--tests/vboot_kernel_tests.c5
-rw-r--r--tests/verify_kernel.c5
-rw-r--r--utility/load_kernel_test.c16
18 files changed, 161 insertions, 217 deletions
diff --git a/firmware/include/gbb_access.h b/firmware/include/gbb_access.h
index 9b4e0dde..4842563b 100644
--- a/firmware/include/gbb_access.h
+++ b/firmware/include/gbb_access.h
@@ -28,7 +28,6 @@ VbError_t VbGbbReadRootKey(struct vb2_context *ctx,
* Read the recovery key from the GBB
*
* @param ctx Vboot context
- * @param cparams Vboot common parameters
* @param keyp Returns a pointer to the key. The caller must call
* free() on the key when finished with it.
* @return VBERROR_... error, VBERROR_SUCCESS on success,
@@ -46,7 +45,6 @@ VbError_t VbGbbReadRecoveryKey(struct vb2_context *ctx,
* then VBERROR_INVALID_PARAMETER is returned.
* @return VBERROR_... error, VBERROR_SUCCESS on success,
*/
-VbError_t VbGbbReadHWID(struct vb2_context *ctx, char *hwid,
- uint32_t max_size);
+VbError_t VbGbbReadHWID(struct vb2_context *ctx, char *hwid, uint32_t max_size);
#endif
diff --git a/firmware/lib/include/load_kernel_fw.h b/firmware/lib/include/load_kernel_fw.h
index 08e55787..87e0e2ab 100644
--- a/firmware/lib/include/load_kernel_fw.h
+++ b/firmware/lib/include/load_kernel_fw.h
@@ -61,12 +61,10 @@ typedef struct LoadKernelParams {
*
* @param ctx Vboot context
* @param params Params specific to loading the kernel
- * @param cparams Common parameters to vboot1 APIs
*
* Returns VBERROR_SUCCESS if successful. If unsuccessful, sets a recovery
* reason via VbNvStorage and returns an error code.
*/
-VbError_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params,
- VbCommonParams *cparams);
+VbError_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params);
#endif /* VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ */
diff --git a/firmware/lib/include/vboot_kernel.h b/firmware/lib/include/vboot_kernel.h
index 33981690..c3c4585b 100644
--- a/firmware/lib/include/vboot_kernel.h
+++ b/firmware/lib/include/vboot_kernel.h
@@ -19,17 +19,15 @@ struct vb2_context;
/**
* Attempt loading a kernel from the specified type(s) of disks.
*
- * If successful, sets p->disk_handle to the disk for the kernel and returns
+ * If successful, sets lkp.disk_handle to the disk for the kernel and returns
* VBERROR_SUCCESS.
*
* @param ctx Vboot context
- * @param cparams Vboot common params
* @param get_info_flags Flags to pass to VbExDiskGetInfo()
* @return VBERROR_SUCCESS, VBERROR_NO_DISK_FOUND if no disks of the specified
* type were found, or other non-zero VBERROR_ codes for other failures.
*/
-uint32_t VbTryLoadKernel(struct vb2_context *ctx, VbCommonParams *cparams,
- uint32_t get_info_flags);
+uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags);
/* Flags for VbUserConfirms() */
#define VB_CONFIRM_MUST_TRUST_KEYBOARD (1 << 0)
@@ -54,27 +52,27 @@ int VbUserConfirms(struct vb2_context *ctx, uint32_t confirm_flags);
/**
* Handle a normal boot.
*/
-VbError_t VbBootNormal(struct vb2_context *ctx, VbCommonParams *cparams);
+VbError_t VbBootNormal(struct vb2_context *ctx);
/**
* Handle a developer-mode boot.
*/
-VbError_t VbBootDeveloper(struct vb2_context *ctx, VbCommonParams *cparams);
+VbError_t VbBootDeveloper(struct vb2_context *ctx);
/**
* Handle a recovery-mode boot.
*/
-VbError_t VbBootRecovery(struct vb2_context *ctx, VbCommonParams *cparams);
+VbError_t VbBootRecovery(struct vb2_context *ctx);
/**
* Handle a developer-mode boot using detachable menu ui
*/
-VbError_t VbBootDeveloperMenu(struct vb2_context *ctx, VbCommonParams *cparams);
+VbError_t VbBootDeveloperMenu(struct vb2_context *ctx);
/**
* Handle a recovery-mode boot using detachable menu ui
*/
-VbError_t VbBootRecoveryMenu(struct vb2_context *ctx, VbCommonParams *cparams);
+VbError_t VbBootRecoveryMenu(struct vb2_context *ctx);
/**
* Return the current FWMP flags. Valid only inside VbSelectAndLoadKernel().
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 7976170d..02d09ad1 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -69,21 +69,7 @@ uint32_t vb2_get_fwmp_flags(void)
return fwmp.flags;
}
-/**
- * Attempt loading a kernel from the specified type(s) of disks.
- *
- * If successful, sets p->disk_handle to the disk for the kernel and returns
- * VBERROR_SUCCESS.
- *
- * @param ctx Vboot context
- * @param cparams Vboot common params
- * @param p Parameters for loading kernel
- * @param get_info_flags Flags to pass to VbExDiskGetInfo()
- * @return VBERROR_SUCCESS, VBERROR_NO_DISK_FOUND if no disks of the specified
- * type were found, or other non-zero VBERROR_ codes for other failures.
- */
-uint32_t VbTryLoadKernel(struct vb2_context *ctx, VbCommonParams *cparams,
- uint32_t get_info_flags)
+uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
{
VbError_t retval = VBERROR_UNKNOWN;
VbDiskInfo* disk_info = NULL;
@@ -136,7 +122,8 @@ uint32_t VbTryLoadKernel(struct vb2_context *ctx, VbCommonParams *cparams,
?: lkp.gpt_lba_count;
lkp.boot_flags |= disk_info[i].flags & VB_DISK_FLAG_EXTERNAL_GPT
? BOOT_FLAG_EXTERNAL_GPT : 0;
- retval = LoadKernel(ctx, &lkp, cparams);
+ retval = LoadKernel(ctx, &lkp);
+
VB2_DEBUG("VbTryLoadKernel() LoadKernel() = %d\n", retval);
/*
@@ -165,7 +152,7 @@ uint32_t VbTryLoadKernel(struct vb2_context *ctx, VbCommonParams *cparams,
return retval;
}
-VbError_t VbBootNormal(struct vb2_context *ctx, VbCommonParams *cparams)
+VbError_t VbBootNormal(struct vb2_context *ctx)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
VbSharedDataHeader *shared = sd->vbsd;
@@ -175,7 +162,7 @@ VbError_t VbBootNormal(struct vb2_context *ctx, VbCommonParams *cparams)
/* Boot from fixed disk only */
VB2_DEBUG("Entering\n");
- VbError_t rv = VbTryLoadKernel(ctx, cparams, VB_DISK_FLAG_FIXED);
+ VbError_t rv = VbTryLoadKernel(ctx, VB_DISK_FLAG_FIXED);
VB2_DEBUG("Checking if TPM kernel version needs advancing\n");
@@ -413,6 +400,9 @@ static void vb2_kernel_cleanup(struct vb2_context *ctx, VbCommonParams *cparams)
/* Stop timer */
shared->timer_vb_select_and_load_kernel_exit = VbExGetTimer();
+
+ /* Store how much shared data we used, if any */
+ cparams->shared_data_size = shared->data_used;
}
VbError_t VbSelectAndLoadKernel(VbCommonParams *cparams,
@@ -436,20 +426,20 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams *cparams,
if (ctx.flags & VB2_CONTEXT_RECOVERY_MODE) {
/* Recovery boot. This has UI. */
if (kparams->inflags & VB_SALK_INFLAGS_ENABLE_DETACHABLE_UI)
- retval = VbBootRecoveryMenu(&ctx, cparams);
+ retval = VbBootRecoveryMenu(&ctx);
else
- retval = VbBootRecovery(&ctx, cparams);
+ retval = VbBootRecovery(&ctx);
VbExEcEnteringMode(0, VB_EC_RECOVERY);
} else if (ctx.flags & VB2_CONTEXT_DEVELOPER_MODE) {
/* Developer boot. This has UI. */
if (kparams->inflags & VB_SALK_INFLAGS_ENABLE_DETACHABLE_UI)
- retval = VbBootDeveloperMenu(&ctx, cparams);
+ retval = VbBootDeveloperMenu(&ctx);
else
- retval = VbBootDeveloper(&ctx, cparams);
+ retval = VbBootDeveloper(&ctx);
VbExEcEnteringMode(0, VB_EC_DEVELOPER);
} else {
/* Normal boot */
- retval = VbBootNormal(&ctx, cparams);
+ retval = VbBootNormal(&ctx);
VbExEcEnteringMode(0, VB_EC_NORMAL);
}
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 0200dccf..8d74f997 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -427,8 +427,7 @@ int vb2_load_partition(struct vb2_context *ctx,
return VB2_SUCCESS;
}
-VbError_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params,
- VbCommonParams *cparams)
+VbError_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
VbSharedDataHeader *shared = sd->vbsd;
@@ -658,9 +657,6 @@ load_kernel_exit:
VBERROR_SUCCESS != retval ?
recovery : VB2_RECOVERY_NOT_REQUESTED);
- /* Store how much shared data we used, if any */
- cparams->shared_data_size = shared->data_used;
-
free(recovery_key);
shcall->return_code = (uint8_t)retval;
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index 93bdf65a..98cd1cd6 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -67,9 +67,9 @@ static void VbTryLegacy(int allowed)
VbExBeep(120, 400);
}
-uint32_t VbTryUsb(struct vb2_context *ctx, VbCommonParams *cparams)
+uint32_t VbTryUsb(struct vb2_context *ctx)
{
- uint32_t retval = VbTryLoadKernel(ctx, cparams, VB_DISK_FLAG_REMOVABLE);
+ uint32_t retval = VbTryLoadKernel(ctx, VB_DISK_FLAG_REMOVABLE);
if (VBERROR_SUCCESS == retval) {
VB2_DEBUG("VbBootDeveloper() - booting USB\n");
} else {
@@ -158,7 +158,7 @@ static const char dev_disable_msg[] =
"For more information, see http://dev.chromium.org/chromium-os/fwmp\n"
"\n";
-VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
+VbError_t vb2_developer_ui(struct vb2_context *ctx)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
VbSharedDataHeader *shared = sd->vbsd;
@@ -346,8 +346,7 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
* key press.
*/
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0);
- if (VBERROR_SUCCESS ==
- VbTryUsb(ctx, cparams)) {
+ if (VBERROR_SUCCESS == VbTryUsb(ctx)) {
return VBERROR_SUCCESS;
} else {
/* Show dev mode warning screen again */
@@ -372,19 +371,19 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
}
if ((use_usb && !ctrl_d_pressed) && allow_usb) {
- if (VBERROR_SUCCESS == VbTryUsb(ctx, cparams)) {
+ if (VBERROR_SUCCESS == VbTryUsb(ctx)) {
return VBERROR_SUCCESS;
}
}
/* Timeout or Ctrl+D; attempt loading from fixed disk */
VB2_DEBUG("VbBootDeveloper() - trying fixed disk\n");
- return VbTryLoadKernel(ctx, cparams, VB_DISK_FLAG_FIXED);
+ return VbTryLoadKernel(ctx, VB_DISK_FLAG_FIXED);
}
-VbError_t VbBootDeveloper(struct vb2_context *ctx, VbCommonParams *cparams)
+VbError_t VbBootDeveloper(struct vb2_context *ctx)
{
- VbError_t retval = vb2_developer_ui(ctx, cparams);
+ VbError_t retval = vb2_developer_ui(ctx);
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0);
return retval;
}
@@ -394,7 +393,7 @@ VbError_t VbBootDeveloper(struct vb2_context *ctx, VbCommonParams *cparams)
#define REC_KEY_DELAY 20 /* Check keys every 20ms */
#define REC_MEDIA_INIT_DELAY 500 /* Check removable media every 500ms */
-static VbError_t recovery_ui(struct vb2_context *ctx, VbCommonParams *cparams)
+static VbError_t recovery_ui(struct vb2_context *ctx)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
VbSharedDataHeader *shared = sd->vbsd;
@@ -438,7 +437,7 @@ static VbError_t recovery_ui(struct vb2_context *ctx, VbCommonParams *cparams)
VB2_DEBUG("VbBootRecovery() waiting for a recovery image\n");
while (1) {
VB2_DEBUG("VbBootRecovery() attempting to load kernel2\n");
- retval = VbTryLoadKernel(ctx, cparams, VB_DISK_FLAG_REMOVABLE);
+ retval = VbTryLoadKernel(ctx, VB_DISK_FLAG_REMOVABLE);
/*
* Clear recovery requests from failed kernel loading, since
@@ -532,9 +531,9 @@ static VbError_t recovery_ui(struct vb2_context *ctx, VbCommonParams *cparams)
return VBERROR_SUCCESS;
}
-VbError_t VbBootRecovery(struct vb2_context *ctx, VbCommonParams *cparams)
+VbError_t VbBootRecovery(struct vb2_context *ctx)
{
- VbError_t retval = recovery_ui(ctx, cparams);
+ VbError_t retval = recovery_ui(ctx);
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0);
return retval;
}
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 6ca602a7..b74d034a 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -68,9 +68,9 @@ static void VbTryLegacyMenu(int allowed)
VbExBeep(120, 400);
}
-uint32_t VbTryUsbMenu(struct vb2_context *ctx, VbCommonParams *cparams)
+uint32_t VbTryUsbMenu(struct vb2_context *ctx)
{
- uint32_t retval = VbTryLoadKernel(ctx, cparams, VB_DISK_FLAG_REMOVABLE);
+ uint32_t retval = VbTryLoadKernel(ctx, VB_DISK_FLAG_REMOVABLE);
if (VBERROR_SUCCESS == retval) {
VB2_DEBUG("booting USB\n");
} else {
@@ -582,10 +582,9 @@ void vb2_update_selection(uint32_t key) {
* Main function that handles developer warning menu functionality
*
* @param ctx Vboot2 context
- * @param cparams Vboot1 common params
* @return VBERROR_SUCCESS, or non-zero error code if error.
*/
-VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams)
+VbError_t vb2_developer_menu(struct vb2_context *ctx)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
VbSharedDataHeader *shared = sd->vbsd;
@@ -703,8 +702,7 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams)
* key press.
*/
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0);
- if (VBERROR_SUCCESS ==
- VbTryUsbMenu(ctx, cparams)) {
+ if (VBERROR_SUCCESS == VbTryUsbMenu(ctx)) {
return VBERROR_SUCCESS;
} else {
/* Show dev mode warning screen again */
@@ -788,7 +786,7 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams)
VbDisplayScreen(ctx,
VB_SCREEN_BLANK, 0);
if (VBERROR_SUCCESS ==
- VbTryUsbMenu(ctx, cparams)) {
+ VbTryUsbMenu(ctx)) {
return VBERROR_SUCCESS;
} else
/*
@@ -862,19 +860,19 @@ fallout:
}
if ((use_usb && !ctrl_d_pressed) && allow_usb) {
- if (VBERROR_SUCCESS == VbTryUsbMenu(ctx, cparams)) {
+ if (VBERROR_SUCCESS == VbTryUsbMenu(ctx)) {
return VBERROR_SUCCESS;
}
}
/* Timeout or Ctrl+D; attempt loading from fixed disk */
VB2_DEBUG("trying fixed disk\n");
- return VbTryLoadKernel(ctx, cparams, VB_DISK_FLAG_FIXED);
+ return VbTryLoadKernel(ctx, VB_DISK_FLAG_FIXED);
}
-VbError_t VbBootDeveloperMenu(struct vb2_context *ctx, VbCommonParams *cparams)
+VbError_t VbBootDeveloperMenu(struct vb2_context *ctx)
{
- VbError_t retval = vb2_developer_menu(ctx, cparams);
+ VbError_t retval = vb2_developer_menu(ctx);
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0);
return retval;
}
@@ -888,10 +886,9 @@ VbError_t VbBootDeveloperMenu(struct vb2_context *ctx, VbCommonParams *cparams)
* Main function that handles recovery menu functionality
*
* @param ctx Vboot2 context
- * @param cparams Vboot1 common params
* @return VBERROR_SUCCESS, or non-zero error code if error.
*/
-static VbError_t recovery_ui(struct vb2_context *ctx, VbCommonParams *cparams)
+static VbError_t recovery_ui(struct vb2_context *ctx)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
VbSharedDataHeader *shared = sd->vbsd;
@@ -948,7 +945,7 @@ static VbError_t recovery_ui(struct vb2_context *ctx, VbCommonParams *cparams)
while (1) {
VB2_DEBUG("attempting to load kernel2\n");
- retval = VbTryLoadKernel(ctx, cparams, VB_DISK_FLAG_REMOVABLE);
+ retval = VbTryLoadKernel(ctx, VB_DISK_FLAG_REMOVABLE);
/*
* Clear recovery requests from failed kernel loading, since
@@ -1126,9 +1123,9 @@ static VbError_t recovery_ui(struct vb2_context *ctx, VbCommonParams *cparams)
return VBERROR_SUCCESS;
}
-VbError_t VbBootRecoveryMenu(struct vb2_context *ctx, VbCommonParams *cparams)
+VbError_t VbBootRecoveryMenu(struct vb2_context *ctx)
{
- VbError_t retval = recovery_ui(ctx, cparams);
+ VbError_t retval = recovery_ui(ctx);
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0);
return retval;
}
diff --git a/firmware/linktest/main.c b/firmware/linktest/main.c
index a170131c..472a03a2 100644
--- a/firmware/linktest/main.c
+++ b/firmware/linktest/main.c
@@ -21,7 +21,7 @@ int main(void)
GptUpdateKernelEntry(0, 0);
/* load_kernel_fw.h */
- LoadKernel(0, 0, 0);
+ LoadKernel(0, 0);
/* rollback_index.h */
RollbackKernelRead(0);
diff --git a/tests/ec_sync_tests.c b/tests/ec_sync_tests.c
index 3dcc6803..9becb7c3 100644
--- a/tests/ec_sync_tests.c
+++ b/tests/ec_sync_tests.c
@@ -26,7 +26,6 @@
#include "vboot_struct.h"
/* Mock data */
-static VbCommonParams cparams;
static uint8_t shared_data[VB_SHARED_DATA_MIN_SIZE];
static VbSharedDataHeader *shared = (VbSharedDataHeader *)shared_data;
@@ -65,10 +64,6 @@ static int ec_aux_fw_protected;
/* Reset mock data (for use before each test) */
static void ResetMocks(void)
{
- memset(&cparams, 0, sizeof(cparams));
- cparams.shared_data_size = sizeof(shared_data);
- cparams.shared_data_blob = shared_data;
-
memset(&ctx, 0, sizeof(ctx));
ctx.workbuf = workbuf;
ctx.workbuf_size = sizeof(workbuf);
diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c
index 916cf068..9e99fc6a 100644
--- a/tests/vboot_api_devmode_tests.c
+++ b/tests/vboot_api_devmode_tests.c
@@ -94,7 +94,6 @@ test_case_t test[] = {
};
/* Mock data */
-static VbCommonParams cparams;
static uint8_t workbuf[VB2_KERNEL_WORKBUF_RECOMMENDED_SIZE];
static struct vb2_context ctx;
static struct vb2_shared_data *sd;
@@ -116,8 +115,6 @@ extern int audio_open_count;
/* Reset mock data (for use before each test) */
static void ResetMocks(void)
{
- memset(&cparams, 0, sizeof(cparams));
-
memset(&ctx, 0, sizeof(ctx));
ctx.workbuf = workbuf;
ctx.workbuf_size = sizeof(workbuf);
@@ -287,7 +284,7 @@ static void VbBootDeveloperSoundTest(void)
kbd_fire_at = test[i].keypress_at_count;
max_events = test[i].num_events;
expected_event = test[i].notes;
- (void) VbBootDeveloper(&ctx, &cparams);
+ (void) VbBootDeveloper(&ctx);
VbExBeep(0, 0); /* Dummy call to determine end time */
VB2_DEBUG("INFO: matched %d total %d expected %d\n",
matched_events, current_event, test[i].num_events);
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index 92041207..0d762aed 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -25,7 +25,6 @@
#include "vboot_struct.h"
/* Mock data */
-static VbCommonParams cparams;
static uint8_t shared_data[VB_SHARED_DATA_MIN_SIZE];
static VbSharedDataHeader *shared = (VbSharedDataHeader *)shared_data;
static LoadKernelParams lkp;
@@ -57,8 +56,6 @@ extern struct RollbackSpaceFwmp *VbApiKernelGetFwmp(void);
/* Reset mock data (for use before each test) */
static void ResetMocks(void)
{
- memset(&cparams, 0, sizeof(cparams));
-
memset(VbApiKernelGetFwmp(), 0, sizeof(struct RollbackSpaceFwmp));
memset(&shared_data, 0, sizeof(shared_data));
@@ -176,8 +173,7 @@ int vb2_audio_looping(void)
return 1;
}
-uint32_t VbTryLoadKernel(struct vb2_context *ctx, VbCommonParams *cparams,
- uint32_t get_info_flags)
+uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
{
return vbtlk_retval + get_info_flags;
}
@@ -269,7 +265,7 @@ static void VbBootTest(void)
{
ResetMocks();
VbExEcEnteringMode(0, VB_EC_NORMAL);
- TEST_EQ(VbBootNormal(&ctx, &cparams), 1002, "VbBootNormal()");
+ TEST_EQ(VbBootNormal(&ctx), 1002, "VbBootNormal()");
TEST_EQ(VbGetMode(), VB_EC_NORMAL, "vboot_mode normal");
}
@@ -280,7 +276,7 @@ static void VbBootDevTest(void)
/* Proceed after timeout */
ResetMocks();
VbExEcEnteringMode(0, VB_EC_DEVELOPER);
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Timeout");
TEST_EQ(VbGetMode(), VB_EC_DEVELOPER, "vboot_mode developer");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING,
" warning screen");
@@ -292,7 +288,7 @@ static void VbBootDevTest(void)
ResetMocks();
sd->gbb_flags |= VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY |
VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Timeout");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
/* Proceed to legacy after timeout if boot legacy and default boot
@@ -301,14 +297,14 @@ static void VbBootDevTest(void)
vb2_nv_set(&ctx, VB2_NV_DEV_DEFAULT_BOOT,
VB2_DEV_DEFAULT_BOOT_LEGACY);
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_LEGACY, 1);
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Timeout");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
/* Proceed to legacy boot mode only if enabled */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_DEFAULT_BOOT,
VB2_DEV_DEFAULT_BOOT_LEGACY);
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Timeout");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
/* Proceed to usb after timeout if boot usb and default boot
@@ -318,31 +314,31 @@ static void VbBootDevTest(void)
VB2_DEV_DEFAULT_BOOT_USB);
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_USB, 1);
vbtlk_retval = VBERROR_SUCCESS - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 0, "Ctrl+U USB");
+ TEST_EQ(VbBootDeveloper(&ctx), 0, "Ctrl+U USB");
/* Proceed to usb boot mode only if enabled */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_DEFAULT_BOOT,
VB2_DEV_DEFAULT_BOOT_USB);
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Timeout");
/* If no USB tries fixed disk */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_USB, 1);
vb2_nv_set(&ctx, VB2_NV_DEV_DEFAULT_BOOT,
VB2_DEV_DEFAULT_BOOT_USB);
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Ctrl+U enabled");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Ctrl+U enabled");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
/* Up arrow is uninteresting / passed to VbCheckDisplayKey() */
ResetMocks();
mock_keypress[0] = VB_KEY_UP;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Up arrow");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Up arrow");
/* Shutdown requested in loop */
ResetMocks();
shutdown_request_calls_left = 2;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloper(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested");
TEST_NEQ(audio_looping_calls_left, 0, " aborts audio");
@@ -350,14 +346,14 @@ static void VbBootDevTest(void)
/* Shutdown requested by keyboard in loop */
ResetMocks();
mock_keypress[0] = VB_BUTTON_POWER_SHORT_PRESS;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloper(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested by keyboard");
/* Space goes straight to recovery if no virtual dev switch */
ResetMocks();
mock_keypress[0] = ' ';
- TEST_EQ(VbBootDeveloper(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloper(&ctx),
VBERROR_LOAD_KERNEL_RECOVERY,
"Space = recovery");
TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST),
@@ -368,7 +364,7 @@ static void VbBootDevTest(void)
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
mock_keypress[0] = ' ';
mock_keypress[1] = '\r';
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), VBERROR_REBOOT_REQUIRED,
+ TEST_EQ(VbBootDeveloper(&ctx), VBERROR_REBOOT_REQUIRED,
"Space = tonorm");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING,
" warning screen");
@@ -385,7 +381,7 @@ static void VbBootDevTest(void)
mock_keypress[0] = ' ';
mock_keypress[1] = ' ';
mock_keypress[2] = 0x1b;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Space-space");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Space-space");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING,
" warning screen");
TEST_EQ(screens_displayed[1], VB_SCREEN_DEVELOPER_TO_NORM,
@@ -398,7 +394,7 @@ static void VbBootDevTest(void)
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
mock_keypress[0] = '\r';
mock_keypress[1] = '\r';
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Enter ignored");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Enter ignored");
/* Enter does if GBB flag set */
ResetMocks();
@@ -406,7 +402,7 @@ static void VbBootDevTest(void)
sd->gbb_flags |= VB2_GBB_FLAG_ENTER_TRIGGERS_TONORM;
mock_keypress[0] = '\r';
mock_keypress[1] = '\r';
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), VBERROR_REBOOT_REQUIRED,
+ TEST_EQ(VbBootDeveloper(&ctx), VBERROR_REBOOT_REQUIRED,
"Enter = tonorm");
/* Tonorm ignored if GBB forces dev switch on */
@@ -415,7 +411,7 @@ static void VbBootDevTest(void)
sd->gbb_flags |= VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON;
mock_keypress[0] = ' ';
mock_keypress[1] = '\r';
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002,
+ TEST_EQ(VbBootDeveloper(&ctx), 1002,
"Can't tonorm gbb-dev");
/* Shutdown requested at tonorm screen */
@@ -423,7 +419,7 @@ static void VbBootDevTest(void)
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
mock_keypress[0] = ' ';
shutdown_request_calls_left = 2;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloper(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested at tonorm");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING,
@@ -435,14 +431,14 @@ static void VbBootDevTest(void)
ResetMocks();
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
mock_keypress[0] = VB_BUTTON_POWER_SHORT_PRESS;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloper(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested by keyboard at nonorm");
/* Ctrl+D dismisses warning */
ResetMocks();
mock_keypress[0] = 0x04;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Ctrl+D");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Ctrl+D");
TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST), 0,
" recovery reason");
TEST_NEQ(audio_looping_calls_left, 0, " aborts audio");
@@ -452,67 +448,67 @@ static void VbBootDevTest(void)
ResetMocks();
mock_keypress[0] = 0x04;
sd->gbb_flags |= VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Ctrl+D");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Ctrl+D");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
/* Ctrl+L tries legacy boot mode only if enabled */
ResetMocks();
mock_keypress[0] = 0x0c;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Ctrl+L normal");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Ctrl+L normal");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
ResetMocks();
sd->gbb_flags |= VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
mock_keypress[0] = 0x0c;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002,
+ TEST_EQ(VbBootDeveloper(&ctx), 1002,
"Ctrl+L force legacy");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_LEGACY, 1);
mock_keypress[0] = 0x0c;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002,
+ TEST_EQ(VbBootDeveloper(&ctx), 1002,
"Ctrl+L nv legacy");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
ResetMocks();
VbApiKernelGetFwmp()->flags |= FWMP_DEV_ENABLE_LEGACY;
mock_keypress[0] = 0x0c;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002,
+ TEST_EQ(VbBootDeveloper(&ctx), 1002,
"Ctrl+L fwmp legacy");
TEST_EQ(vbexlegacy_called, 1, " fwmp legacy");
/* Ctrl+U boots USB only if enabled */
ResetMocks();
mock_keypress[0] = 0x15;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Ctrl+U normal");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Ctrl+U normal");
/* Ctrl+U enabled, with good USB boot */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_USB, 1);
mock_keypress[0] = 0x15;
vbtlk_retval = VBERROR_SUCCESS - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 0, "Ctrl+U USB");
+ TEST_EQ(VbBootDeveloper(&ctx), 0, "Ctrl+U USB");
/* Ctrl+U enabled via GBB */
ResetMocks();
sd->gbb_flags |= VB2_GBB_FLAG_FORCE_DEV_BOOT_USB;
mock_keypress[0] = 0x15;
vbtlk_retval = VBERROR_SUCCESS - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 0, "Ctrl+U force USB");
+ TEST_EQ(VbBootDeveloper(&ctx), 0, "Ctrl+U force USB");
/* Ctrl+U enabled via FWMP */
ResetMocks();
VbApiKernelGetFwmp()->flags |= FWMP_DEV_ENABLE_USB;
mock_keypress[0] = 0x15;
vbtlk_retval = VBERROR_SUCCESS - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 0, "Ctrl+U force USB");
+ TEST_EQ(VbBootDeveloper(&ctx), 0, "Ctrl+U force USB");
/* If no USB, eventually times out and tries fixed disk */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_USB, 1);
mock_keypress[0] = 0x15;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Ctrl+U enabled");
+ TEST_EQ(VbBootDeveloper(&ctx), 1002, "Ctrl+U enabled");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST), 0,
" recovery reason");
@@ -523,7 +519,7 @@ static void VbBootDevTest(void)
VbApiKernelGetFwmp()->flags |= FWMP_DEV_DISABLE_BOOT;
mock_keypress[0] = '\x1b'; /* Just causes TONORM again */
mock_keypress[1] = '\r';
- TEST_EQ(VbBootDeveloper(&ctx, &cparams), VBERROR_REBOOT_REQUIRED,
+ TEST_EQ(VbBootDeveloper(&ctx), VBERROR_REBOOT_REQUIRED,
"FWMP dev disabled");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_TO_NORM,
" tonorm screen");
@@ -539,7 +535,7 @@ static void VbBootDevTest(void)
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
VbApiKernelGetFwmp()->flags |= FWMP_DEV_DISABLE_BOOT;
shutdown_request_calls_left = 1;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloper(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested when dev disabled");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_TO_NORM,
@@ -550,7 +546,7 @@ static void VbBootDevTest(void)
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
VbApiKernelGetFwmp()->flags |= FWMP_DEV_DISABLE_BOOT;
mock_keypress[0] = VB_BUTTON_POWER_SHORT_PRESS;
- TEST_EQ(VbBootDeveloper(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloper(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested by keyboard when dev disabled");
@@ -565,7 +561,7 @@ static void VbBootRecTest(void)
ResetMocks();
shutdown_request_calls_left = 10;
VbExEcEnteringMode(0, VB_EC_RECOVERY);
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested");
TEST_EQ(VbGetMode(), VB_EC_RECOVERY, "vboot_mode recovery");
@@ -579,7 +575,7 @@ static void VbBootRecTest(void)
ResetMocks();
VbExEcEnteringMode(0, VB_EC_RECOVERY);
mock_keypress[0] = VB_BUTTON_POWER_SHORT_PRESS;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested by keyboard");
@@ -590,7 +586,7 @@ static void VbBootRecTest(void)
mock_num_disks[1] = 1;
mock_num_disks[2] = 1;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Remove");
TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN,
@@ -603,7 +599,7 @@ static void VbBootRecTest(void)
mock_num_disks[1] = 1;
shared->flags |= VBSD_BOOT_DEV_SWITCH_ON;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"No remove in dev");
TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT,
@@ -616,7 +612,7 @@ static void VbBootRecTest(void)
mock_num_disks[1] = 1;
shared->flags |= VBSD_BOOT_REC_SWITCH_ON;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"No remove in rec");
TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN,
@@ -628,7 +624,7 @@ static void VbBootRecTest(void)
mock_num_disks[0] = 0;
mock_num_disks[1] = 1;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Remove");
TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN,
@@ -640,7 +636,7 @@ static void VbBootRecTest(void)
mock_num_disks[0] = -1;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
shutdown_request_calls_left = 10;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Bad disk count");
TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN,
@@ -652,7 +648,7 @@ static void VbBootRecTest(void)
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
trust_ec = 0;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if EC not trusted");
TEST_EQ(virtdev_set, 0, " virtual dev mode off");
@@ -665,7 +661,7 @@ static void VbBootRecTest(void)
trust_ec = 1;
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if already in dev mode");
TEST_EQ(virtdev_set, 0, " virtual dev mode off");
@@ -677,7 +673,7 @@ static void VbBootRecTest(void)
trust_ec = 1;
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if recovery not manually triggered");
TEST_EQ(virtdev_set, 0, " virtual dev mode off");
@@ -689,7 +685,7 @@ static void VbBootRecTest(void)
trust_ec = 1;
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if no virtual dev switch");
TEST_EQ(virtdev_set, 0, " virtual dev mode off");
@@ -705,7 +701,7 @@ static void VbBootRecTest(void)
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
mock_switches[0] = VB_INIT_FLAG_REC_BUTTON_PRESSED;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if phys rec button is still pressed");
TEST_NEQ(screens_displayed[1], VB_SCREEN_RECOVERY_TO_DEV,
@@ -719,7 +715,7 @@ static void VbBootRecTest(void)
trust_ec = 1;
mock_keypress[0] = 0x04;
mock_keypress[1] = ' ';
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D todev abort");
TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT,
@@ -739,7 +735,7 @@ static void VbBootRecTest(void)
mock_keypress[0] = 0x04;
mock_keypress[1] = '\r';
mock_keyflags[1] = VB_KEY_FLAG_TRUSTED_KEYBOARD;
- TEST_EQ(VbBootRecovery(&ctx, &cparams), VBERROR_REBOOT_REQUIRED,
+ TEST_EQ(VbBootRecovery(&ctx), VBERROR_REBOOT_REQUIRED,
"Ctrl+D todev confirm");
TEST_EQ(virtdev_set, 1, " virtual dev mode on");
@@ -753,7 +749,7 @@ static void VbBootRecTest(void)
mock_keypress[1] = '\r';
mock_keyflags[1] = VB_KEY_FLAG_TRUSTED_KEYBOARD;
virtdev_retval = VBERROR_SIMULATED;
- TEST_EQ(VbBootRecovery(&ctx, &cparams),
+ TEST_EQ(VbBootRecovery(&ctx),
VBERROR_TPM_SET_BOOT_MODE_STATE,
"Ctrl+D todev failure");
diff --git a/tests/vboot_api_kernel4_tests.c b/tests/vboot_api_kernel4_tests.c
index 07bbfcec..2e73b8b2 100644
--- a/tests/vboot_api_kernel4_tests.c
+++ b/tests/vboot_api_kernel4_tests.c
@@ -114,8 +114,7 @@ uint32_t RollbackFwmpRead(struct RollbackSpaceFwmp *fwmp)
return rfr_retval;
}
-uint32_t VbTryLoadKernel(struct vb2_context *ctx, VbCommonParams *cparams,
- uint32_t get_info_flags)
+uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
{
shared->kernel_version_tpm = new_version;
@@ -125,7 +124,7 @@ uint32_t VbTryLoadKernel(struct vb2_context *ctx, VbCommonParams *cparams,
return vbboot_retval;
}
-VbError_t VbBootDeveloper(struct vb2_context *ctx, VbCommonParams *cparams)
+VbError_t VbBootDeveloper(struct vb2_context *ctx)
{
shared->kernel_version_tpm = new_version;
@@ -135,7 +134,7 @@ VbError_t VbBootDeveloper(struct vb2_context *ctx, VbCommonParams *cparams)
return vbboot_retval;
}
-VbError_t VbBootRecovery(struct vb2_context *ctx, VbCommonParams *cparams)
+VbError_t VbBootRecovery(struct vb2_context *ctx)
{
shared->kernel_version_tpm = new_version;
diff --git a/tests/vboot_api_kernel_tests.c b/tests/vboot_api_kernel_tests.c
index dd63bb4b..3d8f48ad 100644
--- a/tests/vboot_api_kernel_tests.c
+++ b/tests/vboot_api_kernel_tests.c
@@ -283,8 +283,7 @@ VbError_t VbExDiskFreeInfo(VbDiskInfo *infos,
return VBERROR_SUCCESS;
}
-VbError_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params,
- VbCommonParams *cparams)
+VbError_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
{
got_find_disk = (const char *)params->disk_handle;
VB2_DEBUG("%s(%d): got_find_disk = %s\n", __FUNCTION__,
@@ -315,7 +314,7 @@ static void VbTryLoadKernelTest(void)
for (i = 0; i < num_tests; i++) {
printf("Test case: %s ...\n", test[i].name);
ResetMocks(i);
- TEST_EQ(VbTryLoadKernel(&ctx, 0, test[i].want_flags),
+ TEST_EQ(VbTryLoadKernel(&ctx, test[i].want_flags),
t->expected_return_val, " return value");
TEST_EQ(got_recovery_request_val,
t->expected_recovery_request_val, " recovery_request");
diff --git a/tests/vboot_detach_menu_tests.c b/tests/vboot_detach_menu_tests.c
index db04f6ba..b5eb5146 100644
--- a/tests/vboot_detach_menu_tests.c
+++ b/tests/vboot_detach_menu_tests.c
@@ -27,7 +27,6 @@
#include "vboot_ui_menu_private.h"
/* Mock data */
-static VbCommonParams cparams;
static uint8_t shared_data[VB_SHARED_DATA_MIN_SIZE];
static VbSharedDataHeader *shared = (VbSharedDataHeader *)shared_data;
static LoadKernelParams lkp;
@@ -59,8 +58,6 @@ extern struct RollbackSpaceFwmp *VbApiKernelGetFwmp(void);
/* Reset mock data (for use before each test) */
static void ResetMocks(void)
{
- memset(&cparams, 0, sizeof(cparams));
-
memset(VbApiKernelGetFwmp(), 0, sizeof(struct RollbackSpaceFwmp));
memset(&shared_data, 0, sizeof(shared_data));
@@ -182,8 +179,7 @@ int vb2_audio_looping(void)
return 1;
}
-uint32_t VbTryLoadKernel(struct vb2_context *ctx, VbCommonParams *cparams,
- uint32_t get_info_flags)
+uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
{
return vbtlk_retval + get_info_flags;
}
@@ -224,7 +220,7 @@ static void VbBootTest(void)
{
ResetMocks();
VbExEcEnteringMode(0, VB_EC_NORMAL);
- TEST_EQ(VbBootNormal(&ctx, &cparams), 1002, "VbBootNormal()");
+ TEST_EQ(VbBootNormal(&ctx), 1002, "VbBootNormal()");
TEST_EQ(VbGetMode(), VB_EC_NORMAL, "vboot_mode normal");
}
@@ -235,7 +231,7 @@ static void VbBootDevTest(void)
/* Proceed after timeout */
ResetMocks();
VbExEcEnteringMode(0, VB_EC_DEVELOPER);
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Timeout");
TEST_EQ(VbGetMode(), VB_EC_DEVELOPER, "vboot_mode developer");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING_MENU,
" warning screen");
@@ -247,7 +243,7 @@ static void VbBootDevTest(void)
ResetMocks();
sd->gbb_flags |= GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY |
GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Timeout");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
/* Proceed to legacy after timeout if boot legacy and default boot
@@ -256,14 +252,14 @@ static void VbBootDevTest(void)
vb2_nv_set(&ctx, VB2_NV_DEV_DEFAULT_BOOT,
VB2_DEV_DEFAULT_BOOT_LEGACY);
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_LEGACY, 1);
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Timeout");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
/* Proceed to legacy boot mode only if enabled */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_DEFAULT_BOOT,
VB2_DEV_DEFAULT_BOOT_LEGACY);
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Timeout");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
/* Proceed to usb after timeout if boot usb and default boot
@@ -273,26 +269,26 @@ static void VbBootDevTest(void)
VB2_DEV_DEFAULT_BOOT_USB);
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_USB, 1);
vbtlk_retval = VBERROR_SUCCESS - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 0, "Ctrl+U USB");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 0, "Ctrl+U USB");
/* Proceed to usb boot mode only if enabled */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_DEFAULT_BOOT,
VB2_DEV_DEFAULT_BOOT_USB);
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Timeout");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Timeout");
/* If no USB tries fixed disk */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_USB, 1);
vb2_nv_set(&ctx, VB2_NV_DEV_DEFAULT_BOOT,
VB2_DEV_DEFAULT_BOOT_USB);
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Ctrl+U enabled");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Ctrl+U enabled");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
/* Shutdown requested in loop */
ResetMocks();
shutdown_request_calls_left = 2;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloperMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested");
TEST_NEQ(audio_looping_calls_left, 0, " aborts audio");
@@ -301,7 +297,7 @@ static void VbBootDevTest(void)
/* Space goes straight to recovery if no virtual dev switch */
ResetMocks();
mock_keypress[0] = ' ';
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloperMenu(&ctx),
VBERROR_LOAD_KERNEL_RECOVERY,
"Space = recovery");
TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST),
@@ -313,7 +309,7 @@ static void VbBootDevTest(void)
*/
ResetMocks();
mock_keypress[0] = 0x90; // power button
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloperMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"dev warning menu: default to power off");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING_MENU,
@@ -325,7 +321,7 @@ static void VbBootDevTest(void)
mock_keypress[0] = 0x62; // volume up
mock_keypress[1] = 0x90; // power button
mock_keypress[2] = 0x90; // power button
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), VBERROR_REBOOT_REQUIRED,
+ TEST_EQ(VbBootDeveloperMenu(&ctx), VBERROR_REBOOT_REQUIRED,
"disable developer mode");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING_MENU,
" warning screen");
@@ -347,7 +343,7 @@ static void VbBootDevTest(void)
mock_keypress[0] = ' ';
mock_keypress[1] = ' ';
mock_keypress[2] = 0x1b;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Space-space");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Space-space");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING_MENU,
" warning screen");
TEST_EQ(screens_displayed[1], VB_SCREEN_DEVELOPER_TO_NORM_MENU,
@@ -360,7 +356,7 @@ static void VbBootDevTest(void)
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
mock_keypress[0] = '\r';
mock_keypress[1] = '\r';
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Enter ignored");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Enter ignored");
/* Enter does if GBB flag set */
ResetMocks();
@@ -368,7 +364,7 @@ static void VbBootDevTest(void)
sd->gbb_flags |= GBB_FLAG_ENTER_TRIGGERS_TONORM;
mock_keypress[0] = '\r';
mock_keypress[1] = '\r';
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), VBERROR_REBOOT_REQUIRED,
+ TEST_EQ(VbBootDeveloperMenu(&ctx), VBERROR_REBOOT_REQUIRED,
"Enter = tonorm");
#endif
@@ -379,7 +375,7 @@ static void VbBootDevTest(void)
mock_keypress[0] = 0x62; // volume up
mock_keypress[1] = 0x90; // power
mock_keypress[2] = 0x90; // power
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002,
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002,
"Can't tonorm gbb-dev");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING_MENU,
" warning screen");
@@ -396,7 +392,7 @@ static void VbBootDevTest(void)
mock_keypress[0] = 0x62; // volume up
mock_keypress[1] = 0x90; // power
shutdown_request_calls_left = 2;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloperMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested at tonorm");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING_MENU,
@@ -409,7 +405,7 @@ static void VbBootDevTest(void)
/* Ctrl+D dismisses warning */
ResetMocks();
mock_keypress[0] = 0x04;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Ctrl+D");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Ctrl+D");
TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST), 0,
" recovery reason");
TEST_NEQ(audio_looping_calls_left, 0, " aborts audio");
@@ -419,34 +415,34 @@ static void VbBootDevTest(void)
ResetMocks();
mock_keypress[0] = 0x04;
sd->gbb_flags |= GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Ctrl+D");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Ctrl+D");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
/* Ctrl+L tries legacy boot mode only if enabled */
ResetMocks();
mock_keypress[0] = 0x0c;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Ctrl+L normal");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Ctrl+L normal");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
#if 0
ResetMocks();
sd->gbb_flags |= GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
mock_keypress[0] = 0x0c;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002,
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002,
"Ctrl+L force legacy");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_LEGACY, 1);
mock_keypress[0] = 0x0c;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002,
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002,
"Ctrl+L nv legacy");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
ResetMocks();
VbApiKernelGetFwmp()->flags |= FWMP_DEV_ENABLE_LEGACY;
mock_keypress[0] = 0x0c;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002,
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002,
"Ctrl+L fwmp legacy");
TEST_EQ(vbexlegacy_called, 1, " fwmp legacy");
#endif
@@ -454,28 +450,28 @@ static void VbBootDevTest(void)
/* Ctrl+U boots USB only if enabled */
ResetMocks();
mock_keypress[0] = 0x15;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Ctrl+U normal");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Ctrl+U normal");
/* Ctrl+U enabled, with good USB boot */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_USB, 1);
mock_keypress[0] = 0x15;
vbtlk_retval = VBERROR_SUCCESS - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 0, "Ctrl+U USB");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 0, "Ctrl+U USB");
/* Ctrl+U enabled via GBB */
ResetMocks();
sd->gbb_flags |= GBB_FLAG_FORCE_DEV_BOOT_USB;
mock_keypress[0] = 0x15;
vbtlk_retval = VBERROR_SUCCESS - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 0, "Ctrl+U force USB");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 0, "Ctrl+U force USB");
/* Ctrl+U enabled via FWMP */
ResetMocks();
VbApiKernelGetFwmp()->flags |= FWMP_DEV_ENABLE_USB;
mock_keypress[0] = 0x15;
vbtlk_retval = VBERROR_SUCCESS - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 0, "Ctrl+U force USB");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 0, "Ctrl+U force USB");
/* Now go to USB boot through menus */
ResetMocks();
@@ -487,8 +483,8 @@ static void VbBootDevTest(void)
mock_keypress[4] = 0x90; // power button
mock_keypress[5] = 0x90; // power button: default to USB boot
// NOTE: need to check the return value of this....
- VbBootDeveloperMenu(&ctx, &cparams);
- /* TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), */
+ VbBootDeveloperMenu(&ctx);
+ /* TEST_EQ(VbBootDeveloperMenu(&ctx), */
/* VBERROR_SHUTDOWN_REQUESTED, */
/* "go through menu to USB boot"); */
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING_MENU,
@@ -508,7 +504,7 @@ static void VbBootDevTest(void)
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_USB, 1);
mock_keypress[0] = 0x15;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), 1002, "Ctrl+U enabled");
+ TEST_EQ(VbBootDeveloperMenu(&ctx), 1002, "Ctrl+U enabled");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST), 0,
" recovery reason");
@@ -519,7 +515,7 @@ static void VbBootDevTest(void)
VbApiKernelGetFwmp()->flags |= FWMP_DEV_DISABLE_BOOT;
mock_keypress[0] = '\x1b'; /* Just causes TONORM again */
mock_keypress[1] = '\r';
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), VBERROR_REBOOT_REQUIRED,
+ TEST_EQ(VbBootDeveloperMenu(&ctx), VBERROR_REBOOT_REQUIRED,
"FWMP dev disabled");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_TO_NORM_MENU,
" tonorm screen");
@@ -535,7 +531,7 @@ static void VbBootDevTest(void)
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
VbApiKernelGetFwmp()->flags |= FWMP_DEV_DISABLE_BOOT;
shutdown_request_calls_left = 1;
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams),
+ TEST_EQ(VbBootDeveloperMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested when dev disabled");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_TO_NORM_MENU,
@@ -552,7 +548,7 @@ static void VbBootRecTest(void)
ResetMocks();
shutdown_request_calls_left = 10;
VbExEcEnteringMode(0, VB_EC_RECOVERY);
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Shutdown requested");
TEST_EQ(VbGetMode(), VB_EC_RECOVERY, "vboot_mode recovery");
@@ -569,7 +565,7 @@ static void VbBootRecTest(void)
mock_num_disks[1] = 1;
mock_num_disks[2] = 1;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Remove");
TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN,
@@ -582,7 +578,7 @@ static void VbBootRecTest(void)
mock_num_disks[1] = 1;
shared->flags |= VBSD_BOOT_DEV_SWITCH_ON;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"No remove in dev");
TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT,
@@ -595,7 +591,7 @@ static void VbBootRecTest(void)
mock_num_disks[1] = 1;
shared->flags |= VBSD_BOOT_REC_SWITCH_ON;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"No remove in rec");
TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN,
@@ -607,7 +603,7 @@ static void VbBootRecTest(void)
mock_num_disks[0] = 0;
mock_num_disks[1] = 1;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Remove");
TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN,
@@ -619,7 +615,7 @@ static void VbBootRecTest(void)
mock_num_disks[0] = -1;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
shutdown_request_calls_left = 10;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Bad disk count");
TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN,
@@ -633,7 +629,7 @@ static void VbBootRecTest(void)
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
trust_ec = 0;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if EC not trusted");
TEST_EQ(virtdev_set, 0, " virtual dev mode off");
@@ -646,7 +642,7 @@ static void VbBootRecTest(void)
trust_ec = 1;
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if already in dev mode");
TEST_EQ(virtdev_set, 0, " virtual dev mode off");
@@ -658,7 +654,7 @@ static void VbBootRecTest(void)
trust_ec = 1;
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if recovery not manually triggered");
TEST_EQ(virtdev_set, 0, " virtual dev mode off");
@@ -670,7 +666,7 @@ static void VbBootRecTest(void)
trust_ec = 1;
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if no virtual dev switch");
TEST_EQ(virtdev_set, 0, " virtual dev mode off");
@@ -686,7 +682,7 @@ static void VbBootRecTest(void)
shutdown_request_calls_left = 100;
mock_keypress[0] = 0x04;
mock_switches[0] = VB_INIT_FLAG_REC_BUTTON_PRESSED;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"Ctrl+D ignored if phys rec button is still pressed");
TEST_NEQ(screens_displayed[1], VB_SCREEN_RECOVERY_TO_DEV_MENU,
@@ -709,7 +705,7 @@ static void VbBootRecTest(void)
mock_keyflags[3] = VB_KEY_FLAG_TRUSTED_KEYBOARD;
mock_keypress[4] = 0x90; // power button
mock_keypress[5] = 0x90; // power button
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_SHUTDOWN_REQUESTED,
"go to TO_DEV screen and cancel");
TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT,
@@ -746,7 +742,7 @@ static void VbBootRecTest(void)
mock_keypress[5] = 0x62; // volume up
mock_keyflags[5] = VB_KEY_FLAG_TRUSTED_KEYBOARD;
mock_keypress[6] = 0x90; // power button
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams), VBERROR_REBOOT_REQUIRED,
+ TEST_EQ(VbBootRecoveryMenu(&ctx), VBERROR_REBOOT_REQUIRED,
"go to TO_DEV screen and confirm");
TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT,
" insert screen");
@@ -775,7 +771,7 @@ static void VbBootRecTest(void)
mock_keypress[1] = '\r';
mock_keyflags[1] = VB_KEY_FLAG_TRUSTED_KEYBOARD;
virtdev_retval = VBERROR_SIMULATED;
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams),
+ TEST_EQ(VbBootRecoveryMenu(&ctx),
VBERROR_TPM_SET_BOOT_MODE_STATE,
"Ctrl+D todev failure");
#endif
@@ -809,7 +805,7 @@ static void VbTestLanguageMenu(void)
mock_keypress[11] = 0x63; // volume down: power off
mock_keyflags[11] = VB_KEY_FLAG_TRUSTED_KEYBOARD;
mock_keypress[12] = 0x90; // power button: select power off
- TEST_EQ(VbBootRecoveryMenu(&ctx, &cparams), VBERROR_SHUTDOWN_REQUESTED,
+ TEST_EQ(VbBootRecoveryMenu(&ctx), VBERROR_SHUTDOWN_REQUESTED,
"go to language menu");
TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT,
" insert screen");
@@ -863,7 +859,7 @@ static void VbTestLanguageMenu(void)
mock_keypress[19] = 0x90; // power button: select language
mock_keypress[20] = 0x90; // power button: select current language
mock_keypress[21] = 0x90; // power button: select power off
- TEST_EQ(VbBootDeveloperMenu(&ctx, &cparams), VBERROR_SHUTDOWN_REQUESTED,
+ TEST_EQ(VbBootDeveloperMenu(&ctx), VBERROR_SHUTDOWN_REQUESTED,
" scroll through all language menus in developer options");
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING_MENU,
" warning screen: power off");
diff --git a/tests/vboot_display_tests.c b/tests/vboot_display_tests.c
index a6d2b9f4..71b66aeb 100644
--- a/tests/vboot_display_tests.c
+++ b/tests/vboot_display_tests.c
@@ -24,7 +24,6 @@
#include "vboot_kernel.h"
/* Mock data */
-static VbCommonParams cparams;
static uint8_t shared_data[VB_SHARED_DATA_MIN_SIZE];
static VbSharedDataHeader *shared = (VbSharedDataHeader *)shared_data;
static char gbb_data[4096 + sizeof(GoogleBinaryBlockHeader)];
@@ -53,9 +52,6 @@ static void ResetMocks(void)
mock_localization_count = 3;
- memset(&cparams, 0, sizeof(cparams));
- cparams.gbb_data = gbb;
- cparams.gbb_size = sizeof(gbb_data);
gbb->header_size = sizeof(*gbb);
gbb->rootkey_offset = gbb_used;
gbb->rootkey_size = 64;
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c
index c6798d2c..14bffc91 100644
--- a/tests/vboot_kernel_tests.c
+++ b/tests/vboot_kernel_tests.c
@@ -67,7 +67,6 @@ static VbSharedDataHeader *shared = (VbSharedDataHeader *)shared_data;
static LoadKernelParams lkp;
static VbKeyBlockHeader kbh;
static VbKernelPreambleHeader kph;
-static VbCommonParams cparams;
static struct RollbackSpaceFwmp fwmp;
static uint8_t mock_disk[MOCK_SECTOR_SIZE * MOCK_SECTOR_COUNT];
static GptHeader *mock_gpt_primary =
@@ -145,8 +144,6 @@ static void ResetMocks(void)
VbSharedDataInit(shared, sizeof(shared_data));
shared->kernel_version_tpm = 0x20001;
- memset(&cparams, '\0', sizeof(cparams));
-
memset(&lkp, 0, sizeof(lkp));
lkp.bytes_per_lba = 512;
lkp.streaming_lba_count = 1024;
@@ -570,7 +567,7 @@ static void ReadWriteGptTest(void)
static void TestLoadKernel(int expect_retval, char *test_name)
{
- TEST_EQ(LoadKernel(&ctx, &lkp, &cparams), expect_retval, test_name);
+ TEST_EQ(LoadKernel(&ctx, &lkp), expect_retval, test_name);
}
/**
diff --git a/tests/verify_kernel.c b/tests/verify_kernel.c
index 01c4deee..03349562 100644
--- a/tests/verify_kernel.c
+++ b/tests/verify_kernel.c
@@ -25,7 +25,6 @@ static uint8_t shared_data[VB_SHARED_DATA_MIN_SIZE];
static VbSharedDataHeader *shared = (VbSharedDataHeader *)shared_data;
static LoadKernelParams params;
-static VbCommonParams cparams;
VbError_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, void *buffer)
@@ -93,8 +92,6 @@ int main(int argc, char *argv[])
/* TODO: optional TPM current kernel version */
/* Set up params */
- cparams.shared_data_blob = shared_data;
- cparams.shared_data_size = sizeof(shared_data);
params.disk_handle = (VbExDiskHandle_t)1;
params.bytes_per_lba = 512;
params.streaming_lba_count = disk_bytes / 512;
@@ -142,7 +139,7 @@ int main(int argc, char *argv[])
vb2_nv_init(&ctx);
/* Try loading kernel */
- rv = LoadKernel(&ctx, &params, &cparams);
+ rv = LoadKernel(&ctx, &params);
if (rv != VBERROR_SUCCESS) {
fprintf(stderr, "LoadKernel() failed with code %d\n", rv);
return 1;
diff --git a/utility/load_kernel_test.c b/utility/load_kernel_test.c
index da1667b8..6606c425 100644
--- a/utility/load_kernel_test.c
+++ b/utility/load_kernel_test.c
@@ -29,7 +29,6 @@
/* Global variables for stub functions */
static LoadKernelParams lkp;
-static VbCommonParams cparams;
static FILE *image_file = NULL;
@@ -96,7 +95,6 @@ int main(int argc, char* argv[]) {
memset(&lkp, 0, sizeof(LoadKernelParams));
lkp.bytes_per_lba = LBA_BYTES;
int boot_flags = BOOT_FLAG_RECOVERY;
- memset(&cparams, 0, sizeof(VbCommonParams));
/* Parse options */
opterr = 0;
@@ -162,9 +160,9 @@ int main(int argc, char* argv[]) {
}
/* Initialize the GBB */
- cparams.gbb_size = sizeof(GoogleBinaryBlockHeader) + key_size;
- cparams.gbb_data = gbb = (GoogleBinaryBlockHeader*)malloc(cparams.gbb_size);
- memset(gbb, 0, cparams.gbb_size);
+ uint32_t gbb_size = sizeof(GoogleBinaryBlockHeader) + key_size;
+ gbb = (GoogleBinaryBlockHeader*)malloc(gbb_size);
+ memset(gbb, 0, gbb_size);
memcpy(gbb->signature, GBB_SIGNATURE, GBB_SIGNATURE_SIZE);
gbb->major_version = GBB_MAJOR_VER;
gbb->minor_version = GBB_MINOR_VER;
@@ -180,10 +178,8 @@ int main(int argc, char* argv[]) {
}
/* Initialize the shared data area */
- cparams.shared_data_blob = malloc(VB_SHARED_DATA_REC_SIZE);
- cparams.shared_data_size = VB_SHARED_DATA_REC_SIZE;
- shared = (VbSharedDataHeader*)cparams.shared_data_blob;
- if (0 != VbSharedDataInit(shared, cparams.shared_data_size)) {
+ shared = (VbSharedDataHeader*)malloc(VB_SHARED_DATA_REC_SIZE);
+ if (0 != VbSharedDataInit(shared, VB_SHARED_DATA_REC_SIZE)) {
fprintf(stderr, "Unable to init shared data\n");
return 1;
}
@@ -251,7 +247,7 @@ int main(int argc, char* argv[]) {
sd->vbsd = shared;
/* Call LoadKernel() */
- rv = LoadKernel(&ctx, &lkp, &cparams);
+ rv = LoadKernel(&ctx, &lkp);
printf("LoadKernel() returned %d\n", rv);
if (VBERROR_SUCCESS == rv) {