summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShelley Chen <shchen@chromium.org>2017-09-13 10:34:11 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-09-15 16:59:22 -0700
commit1282081609321888f485318cc7d06ee047feb31e (patch)
tree0c80cc7bcde61d74ba2dcbea1a475ad8dba582f5
parentc8e3d27c814634c629b46dab0b708d3cf375c641 (diff)
downloadvboot-1282081609321888f485318cc7d06ee047feb31e.tar.gz
detachables: Ensure keyboard input in TO_DEV menu trusted
Add in check at TO_DEV menu screen to make sure that the navigation keys (up/down, volup/voldown) are trusted. Beep when user tries to use unstrusted keys (usb keyboard) in the TO_DEV menu so that the user knows they're doing something wrong. USB keyboard return key will still work in the TO_DEV menu. BUG=b:65546569 BRANCH=None TEST=test out using up/down keys in TO_DEV menu and make sure that they are disabled and hear beeps. Change-Id: Ifc7183c7ca35efaf079abb196a90ab7305380642 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/665355 Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--firmware/lib/vboot_ui_menu.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 8ca7a9f2..84ced164 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -1022,6 +1022,7 @@ VbError_t vb2_recovery_menu(struct vb2_context *ctx, VbCommonParams *cparams)
(VbSharedDataHeader *)cparams->shared_data_blob;
uint32_t retval;
uint32_t key;
+ uint32_t key_flags;
int i;
VbError_t ret;
@@ -1104,15 +1105,27 @@ VbError_t vb2_recovery_menu(struct vb2_context *ctx, VbCommonParams *cparams)
* platforms don't like to scan USB too rapidly.
*/
for (i = 0; i < REC_DISK_DELAY; i += REC_KEY_DELAY) {
- key = VbExKeyboardRead();
+ key = VbExKeyboardReadWithFlags(&key_flags);
switch (key) {
case 0:
/* nothing pressed */
break;
- case VB_BUTTON_VOL_UP:
- case VB_BUTTON_VOL_DOWN:
case VB_KEY_UP:
case VB_KEY_DOWN:
+ case VB_BUTTON_VOL_UP:
+ case VB_BUTTON_VOL_DOWN:
+ /* User cannot use keyboard to enable dev mode.
+ * They need to use the volume buttons from a
+ * trusted source to navigate to the disable os
+ * verification menu item. Beep so user knows
+ * that they're doing something wrong.
+ */
+ if (current_menu == VB_MENU_TO_DEV &&
+ !(key_flags & VB_KEY_FLAG_TRUSTED_KEYBOARD)) {
+ VbExBeep(120, 400);
+ break;
+ }
+
if (current_menu == VB_MENU_RECOVERY_INSERT) {
ret = vb2_update_menu(ctx);
vb2_set_disabled_idx_mask(shared->flags);