summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2021-01-18 16:05:19 +0800
committerCommit Bot <commit-bot@chromium.org>2021-01-28 03:52:01 +0000
commitb1395179b67272394c059940d8f7933339840b55 (patch)
tree5a47dd0e9961c9d84447711daea5716f570600d5
parent37ae620756c93f68e7e643bbf924350e60423cac (diff)
downloadvboot-b1395179b67272394c059940d8f7933339840b55.tar.gz
vboot: collect auxfw/EC-related stubs in vboot2 namespace
Collect all auxfw and EC-related stubs in the vboot2 namespace within 2lib/2stub.c. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: If09a13df10aa78deee696f4422615b635238f3cf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2635675 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
-rw-r--r--firmware/2lib/2stub.c88
-rw-r--r--firmware/stub/vboot_api_stub.c84
2 files changed, 81 insertions, 91 deletions
diff --git a/firmware/2lib/2stub.c b/firmware/2lib/2stub.c
index c5f7bbf5..1454f77e 100644
--- a/firmware/2lib/2stub.c
+++ b/firmware/2lib/2stub.c
@@ -26,6 +26,13 @@ void vb2ex_printf(const char *func, const char *fmt, ...)
}
__attribute__((weak))
+void vb2ex_abort(void)
+{
+ /* Stub simply exits. */
+ abort();
+}
+
+__attribute__((weak))
vb2_error_t vb2ex_tpm_clear_owner(struct vb2_context *ctx)
{
fprintf(stderr, "%s: function not implemented\n", __func__);
@@ -48,30 +55,97 @@ vb2_error_t vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val)
return VB2_ERROR_EX_UNIMPLEMENTED;
}
+/*****************************************************************************/
+/* auxfw and EC-related stubs */
+
__attribute__((weak))
-vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity)
+int vb2ex_ec_trusted(void)
{
- *severity = VB2_AUXFW_NO_UPDATE;
+ return 1;
+}
+
+__attribute__((weak))
+vb2_error_t vb2ex_ec_running_rw(int *in_rw)
+{
+ *in_rw = 0;
return VB2_SUCCESS;
}
__attribute__((weak))
-vb2_error_t vb2ex_auxfw_update(void)
+vb2_error_t vb2ex_ec_jump_to_rw(void)
{
return VB2_SUCCESS;
}
__attribute__((weak))
-vb2_error_t vb2ex_auxfw_finalize(struct vb2_context *ctx)
+vb2_error_t vb2ex_ec_disable_jump(void)
{
return VB2_SUCCESS;
}
__attribute__((weak))
-void vb2ex_abort(void)
+vb2_error_t vb2ex_ec_hash_image(enum vb2_firmware_selection select,
+ const uint8_t **hash, int *hash_size)
{
- /* Stub simply exits. */
- abort();
+ static const uint8_t fake_hash[32] = {1, 2, 3, 4};
+
+ *hash = fake_hash;
+ *hash_size = sizeof(fake_hash);
+ return VB2_SUCCESS;
+}
+
+__attribute__((weak))
+vb2_error_t vb2ex_ec_get_expected_image_hash(enum vb2_firmware_selection select,
+ const uint8_t **hash, int *hash_size)
+{
+ static const uint8_t fake_hash[32] = {1, 2, 3, 4};
+
+ *hash = fake_hash;
+ *hash_size = sizeof(fake_hash);
+ return VB2_SUCCESS;
+}
+
+__attribute__((weak))
+vb2_error_t vb2ex_ec_update_image(enum vb2_firmware_selection select)
+{
+ return VB2_SUCCESS;
+}
+
+__attribute__((weak))
+vb2_error_t vb2ex_ec_protect(enum vb2_firmware_selection select)
+{
+ return VB2_SUCCESS;
+}
+
+__attribute__((weak))
+vb2_error_t vb2ex_ec_vboot_done(struct vb2_context *ctx)
+{
+ return VB2_SUCCESS;
+}
+
+__attribute__((weak))
+vb2_error_t vb2ex_ec_battery_cutoff(void)
+{
+ return VB2_SUCCESS;
+}
+
+__attribute__((weak))
+vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity)
+{
+ *severity = VB2_AUXFW_NO_UPDATE;
+ return VB2_SUCCESS;
+}
+
+__attribute__((weak))
+vb2_error_t vb2ex_auxfw_update(void)
+{
+ return VB2_SUCCESS;
+}
+
+__attribute__((weak))
+vb2_error_t vb2ex_auxfw_finalize(struct vb2_context *ctx)
+{
+ return VB2_SUCCESS;
}
/*****************************************************************************/
diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c
index 521ca4e4..a0da9ae1 100644
--- a/firmware/stub/vboot_api_stub.c
+++ b/firmware/stub/vboot_api_stub.c
@@ -37,90 +37,6 @@ uint32_t VbExIsShutdownRequested(void)
}
__attribute__((weak))
-int vb2ex_ec_trusted(void)
-{
- return 1;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_ec_running_rw(int *in_rw)
-{
- *in_rw = 0;
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_ec_jump_to_rw(void)
-{
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_ec_disable_jump(void)
-{
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_ec_hash_image(enum vb2_firmware_selection select,
- const uint8_t **hash, int *hash_size)
-{
- static const uint8_t fake_hash[32] = {1, 2, 3, 4};
-
- *hash = fake_hash;
- *hash_size = sizeof(fake_hash);
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_ec_get_expected_image_hash(enum vb2_firmware_selection select,
- const uint8_t **hash, int *hash_size)
-{
- static const uint8_t fake_hash[32] = {1, 2, 3, 4};
-
- *hash = fake_hash;
- *hash_size = sizeof(fake_hash);
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_ec_update_image(enum vb2_firmware_selection select)
-{
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_ec_protect(enum vb2_firmware_selection select)
-{
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_ec_vboot_done(struct vb2_context *ctx)
-{
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_ec_battery_cutoff(void)
-{
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity)
-{
- *severity = VB2_AUXFW_NO_UPDATE;
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_auxfw_update(void)
-{
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
vb2_error_t VbExLegacy(enum VbAltFwIndex_t altfw_num)
{
return VB2_SUCCESS;