summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2017-06-19 15:38:19 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-06-27 21:28:05 -0700
commit75edd8984f360ec1f46906facb6e624404b6bc0e (patch)
tree5bd5863ecf39a03e3f0fb2cfa076fb5e80f80b8c
parentf534936ca5435e3b31fd2e31acc4ae9d47d57b5d (diff)
downloadchrome-ec-75edd8984f360ec1f46906facb6e624404b6bc0e.tar.gz
vboot_hash: Don't auto-start hashing in recovery mode
If we have requested the host to go to recovery mode, the host will usually not need an RW hash because it won't do EC SW sync. Therefore, do not auto-start calculation of our hash if we've requested recovery. This may avoid past recovery-breaking bugs due to unexpected RW contents. If the host does need the hash after all, it will manually request that the computation start. BUG=chromium:612966 BRANCH=None TEST=Boot to recovery mode on kevin, verify that "hash start" print is not seen on UART. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I66d2d74398357dfe30e39882feec8cfba4cc945c Reviewed-on: https://chromium-review.googlesource.com/540695 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--common/vboot_hash.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index 0148d88fe7..81d60725aa 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -236,6 +236,17 @@ static void vboot_hash_init(void)
data_size = tag->size;
} else
#endif
+#ifdef CONFIG_HOSTCMD_EVENTS
+ /*
+ * Don't auto-start hash computation if we've asked the host to enter
+ * recovery mode since we probably won't need the hash. Although
+ * the host is capable of clearing this host event, the host is
+ * likely not even up and running yet in the case of cold boot, due to
+ * the power sequencing task not having run yet.
+ */
+ if (!(host_get_events() &
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)))
+#endif
{
/* Start computing the hash of RW firmware */
vboot_hash_start(CONFIG_EC_WRITABLE_STORAGE_OFF +
@@ -400,7 +411,6 @@ static int host_start_hash(const struct ec_params_vboot_hash *p)
offset = CONFIG_EC_WRITABLE_STORAGE_OFF + CONFIG_RW_STORAGE_OFF;
size = system_get_image_used(SYSTEM_IMAGE_RW);
}
-
rv = vboot_hash_start(offset, size, p->nonce_data, p->nonce_size);
if (rv == EC_SUCCESS)