summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2017-08-04 16:26:05 +0200
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-08-18 23:05:42 +0000
commit585c89c61f789eda8172aa6e4ab5ee30e92df206 (patch)
tree16d18d65fc814393f3fbecc997a20c59380b63b8
parent03c175e991653267ba3c64f5e470dc6924700c8a (diff)
downloadchrome-ec-585c89c61f789eda8172aa6e4ab5ee30e92df206.tar.gz
cr50: fix saving the U2F seed to flash
We need to ensure that the NVMEM variable containing the seed is properly saved to flash, so we can restore it later whatever happens. Add a call to writevars() which triggers the NVMEM commit rather than accidentally waiting for it. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=cr50 BUG=b:35545754 TEST=run twice 'trunks_send --u2f_cert --crt=/tmp/mycert.crt' and hard-reboot the cr50 in between and see both certificates are fully identical. Change-Id: Iea4f9fdede4c0a2eeae1c59633caa16dbf70a66f Reviewed-on: https://chromium-review.googlesource.com/602241 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit b7e4d50cfe9fe6c1a847727153f3677b9a3630e2) Reviewed-on: https://chromium-review.googlesource.com/622234 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--board/cr50/u2f.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/board/cr50/u2f.c b/board/cr50/u2f.c
index 26fc3c10ce..633b9f60d3 100644
--- a/board/cr50/u2f.c
+++ b/board/cr50/u2f.c
@@ -79,6 +79,8 @@ static int load_state(void)
if (setvar(&k_salt, sizeof(k_salt),
(const uint8_t *)salt, sizeof(salt)))
return 0;
+ /* really save the new variable to flash */
+ writevars();
} else {
memcpy(salt, tuple_val(t_salt), sizeof(salt));
}