summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoredisonhello <edisonhello@google.com>2021-08-02 14:28:50 +0800
committerCommit Bot <commit-bot@chromium.org>2021-08-12 08:13:14 +0000
commit51879dc24aea94851fc28ffc2f68cba1b58f3db8 (patch)
tree832355c3b26b424b9300c92a9fb2a6b93f28e4c6
parentd8de9942e2fdfdf3f1792740cb5419163faff3ea (diff)
downloadvboot-release-R94-14150.49.B.tar.gz
Since all flags are initialized as 0 in vb2api_init(), some flag unset operations are not needed. Edit few comments to make it more accurate. BUG=none TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1; \ make -j32 test_setup && make -j32 runtests; BRANCH=none Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I0129f43342598195800ff671b965100d3d568564 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3066803 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
-rw-r--r--firmware/2lib/2misc.c11
-rw-r--r--firmware/2lib/include/2api.h6
-rw-r--r--tests/vb2_ui_action_tests.c1
-rw-r--r--tests/vb2_ui_tests.c1
4 files changed, 6 insertions, 13 deletions
diff --git a/firmware/2lib/2misc.c b/firmware/2lib/2misc.c
index 03766b44..efa33a8a 100644
--- a/firmware/2lib/2misc.c
+++ b/firmware/2lib/2misc.c
@@ -579,10 +579,9 @@ void vb2_fill_dev_boot_flags(struct vb2_context *ctx)
{
struct vb2_gbb_header *gbb = vb2_get_gbb(ctx);
- if (vb2_secdata_fwmp_get_flag(ctx, VB2_SECDATA_FWMP_DEV_DISABLE_BOOT) &&
- !(gbb->flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON))
- ctx->flags &= ~(uint64_t)VB2_CONTEXT_DEV_BOOT_ALLOWED;
- else
+ if (!vb2_secdata_fwmp_get_flag(ctx,
+ VB2_SECDATA_FWMP_DEV_DISABLE_BOOT) ||
+ (gbb->flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON))
ctx->flags |= VB2_CONTEXT_DEV_BOOT_ALLOWED;
if (vb2_nv_get(ctx, VB2_NV_DEV_BOOT_EXTERNAL) ||
@@ -590,15 +589,11 @@ void vb2_fill_dev_boot_flags(struct vb2_context *ctx)
vb2_secdata_fwmp_get_flag(ctx,
VB2_SECDATA_FWMP_DEV_ENABLE_EXTERNAL))
ctx->flags |= VB2_CONTEXT_DEV_BOOT_EXTERNAL_ALLOWED;
- else
- ctx->flags &= ~(uint64_t)VB2_CONTEXT_DEV_BOOT_EXTERNAL_ALLOWED;
if (vb2_nv_get(ctx, VB2_NV_DEV_BOOT_ALTFW) ||
(gbb->flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_ALTFW) ||
vb2_secdata_fwmp_get_flag(ctx, VB2_SECDATA_FWMP_DEV_ENABLE_ALTFW))
ctx->flags |= VB2_CONTEXT_DEV_BOOT_ALTFW_ALLOWED;
- else
- ctx->flags &= ~(uint64_t)VB2_CONTEXT_DEV_BOOT_ALTFW_ALLOWED;
}
int vb2api_use_short_dev_screen_delay(struct vb2_context *ctx)
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 66594035..b973417d 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -242,19 +242,19 @@ enum vb2_context_flags {
VB2_CONTEXT_EC_TRUSTED = (1 << 24),
/*
- * Boot into developer mode is allowed by FWMP and GBB flags.
+ * Boot into developer mode is allowed by FWMP or GBB flags.
*/
VB2_CONTEXT_DEV_BOOT_ALLOWED = (1 << 25),
/*
* Boot into developer mode from external disk is allowed by nvdata,
- * FWMP and GBB flags.
+ * FWMP or GBB flags.
*/
VB2_CONTEXT_DEV_BOOT_EXTERNAL_ALLOWED = (1 << 26),
/*
* Boot into developer mode from alternate bootloader is allowed by
- * nvdata, FWMP and GBB flags.
+ * nvdata, FWMP or GBB flags.
*/
VB2_CONTEXT_DEV_BOOT_ALTFW_ALLOWED = (1 << 27),
};
diff --git a/tests/vb2_ui_action_tests.c b/tests/vb2_ui_action_tests.c
index 001d6c2e..514340b4 100644
--- a/tests/vb2_ui_action_tests.c
+++ b/tests/vb2_ui_action_tests.c
@@ -315,7 +315,6 @@ static void reset_common_data(void)
sd = vb2_get_sd(ctx);
ctx->flags |= VB2_CONTEXT_DEV_BOOT_ALLOWED;
- ctx->flags &= ~(uint64_t)VB2_CONTEXT_DEV_BOOT_ALTFW_ALLOWED;
/* For check_shutdown_request */
mock_calls_until_shutdown = 10;
diff --git a/tests/vb2_ui_tests.c b/tests/vb2_ui_tests.c
index 95d22900..54f76037 100644
--- a/tests/vb2_ui_tests.c
+++ b/tests/vb2_ui_tests.c
@@ -279,7 +279,6 @@ static void reset_common_data(enum reset_type t)
}
ctx->flags |= VB2_CONTEXT_DEV_BOOT_ALLOWED;
- ctx->flags &= ~(uint64_t)VB2_CONTEXT_DEV_BOOT_ALTFW_ALLOWED;
ctx->flags |= VB2_CONTEXT_DEV_BOOT_EXTERNAL_ALLOWED;
/* Mock ui_context based on real screens */