summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsuan Ting Chen <roccochen@chromium.org>2021-10-07 03:54:37 +0000
committerCommit Bot <commit-bot@chromium.org>2021-10-07 20:50:31 +0000
commitb9644352d7717d4f564be90aac6c41bef583d930 (patch)
treee48bff12918d117e5ebab67f8e58e2a2f19fb4de
parentf0ba3fe277fdc623565eab0725aed743e24a1a44 (diff)
downloadvboot-b9644352d7717d4f564be90aac6c41bef583d930.tar.gz
Revert "2lib/2api: Deprecate vb2ex_ec_trusted()"
This reverts commit 7c73bb07fd3ca45ce650b993a9c6a5850ddb2707. Reason for revert: b:202258389 Original change's description: > 2lib/2api: Deprecate vb2ex_ec_trusted() > > coreboot will support check the EC_IN_RW during verstage_main(), which > performs the equivalent tasks as vb2ex_ec_trusted(). > > In the previous CL, we remove the check of vb2ex_ec_trusted(), so the > whole implementation of this function among vboot_reference and > depthcharge could be deprecated and removed. > > BUG=b:181931817 > BRANCH=none > TEST=CC=x86_64-pc-linux-gnu-clang; > make clean && make runtests > TEST=emerge coreboot vboot_reference depthcharge > > Cq-Depend: chromium:3139956 > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > Change-Id: I4f592d7dec2480475762e1336791cbb34fa143ba > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139539 > Reviewed-by: Julius Werner <jwerner@chromium.org> > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Bug: b:181931817 Change-Id: Ia127ce89b7f9413db9fd6ca4561ad06efb36d7e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3211006 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com>
-rw-r--r--firmware/2lib/2ec_sync.c8
-rw-r--r--firmware/2lib/2stub.c6
-rw-r--r--firmware/2lib/include/2api.h8
-rw-r--r--tests/vb2_ec_sync_tests.c5
4 files changed, 23 insertions, 4 deletions
diff --git a/firmware/2lib/2ec_sync.c b/firmware/2lib/2ec_sync.c
index e75313b4..20490e08 100644
--- a/firmware/2lib/2ec_sync.c
+++ b/firmware/2lib/2ec_sync.c
@@ -160,10 +160,10 @@ static vb2_error_t check_ec_active(struct vb2_context *ctx)
struct vb2_shared_data *sd = vb2_get_sd(ctx);
int in_rw = 0;
/*
- * We don't use VB2_CONTEXT_EC_TRUSTED, which checks if not EC_IN_RW.
- * It is controlled by cr50 but on some platforms, cr50 can't know when
- * a EC resets. So, we trust what EC-RW says. If it lies it's in RO,
- * we'll flash RW while it's in RW.
+ * We don't use vb2ex_ec_trusted, which checks EC_IN_RW. It is
+ * controlled by cr50 but on some platforms, cr50 can't know when a EC
+ * resets. So, we trust what EC-RW says. If it lies it's in RO, we'll
+ * flash RW while it's in RW.
*/
/* If we couldn't determine where the EC was, reboot to recovery. */
VB2_TRY(vb2ex_ec_running_rw(&in_rw),
diff --git a/firmware/2lib/2stub.c b/firmware/2lib/2stub.c
index 85534dd6..956b4bb4 100644
--- a/firmware/2lib/2stub.c
+++ b/firmware/2lib/2stub.c
@@ -75,6 +75,12 @@ vb2_error_t vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val)
/* auxfw and EC-related stubs */
__attribute__((weak))
+int vb2ex_ec_trusted(void)
+{
+ return 1;
+}
+
+__attribute__((weak))
vb2_error_t vb2ex_ec_running_rw(int *in_rw)
{
*in_rw = 0;
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 8cc9a923..1f9d70f9 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -1303,6 +1303,14 @@ enum vb2_firmware_selection {
vb2_error_t vb2api_ec_sync(struct vb2_context *ctx);
/**
+ * This is called only if the system implements a keyboard-based (virtual)
+ * developer switch. It must return true only if the system has an embedded
+ * controller which is provably running in its RO firmware at the time the
+ * function is called.
+ */
+int vb2ex_ec_trusted(void);
+
+/**
* Check if the EC is currently running rewritable code.
*
* If the EC is in RO code, sets *in_rw=0.
diff --git a/tests/vb2_ec_sync_tests.c b/tests/vb2_ec_sync_tests.c
index e47f59d6..16496e44 100644
--- a/tests/vb2_ec_sync_tests.c
+++ b/tests/vb2_ec_sync_tests.c
@@ -121,6 +121,11 @@ uint32_t VbExIsShutdownRequested(void)
return 0;
}
+int vb2ex_ec_trusted(void)
+{
+ return !ec_run_image;
+}
+
vb2_error_t vb2ex_ec_running_rw(int *in_rw)
{
*in_rw = ec_run_image;