diff options
-rw-r--r-- | board/cr50/board.h | 1 | ||||
-rw-r--r-- | board/cr50/u2f.c | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/board/cr50/board.h b/board/cr50/board.h index b03499e3d0..eabd819a15 100644 --- a/board/cr50/board.h +++ b/board/cr50/board.h @@ -251,6 +251,7 @@ enum nvmem_vars { NVMEM_VAR_TEST_VAR, NVMEM_VAR_U2F_SALT, NVMEM_VAR_CCD_CONFIG, + NVMEM_VAR_G2F_SALT, NVMEM_VARS_COUNT }; diff --git a/board/cr50/u2f.c b/board/cr50/u2f.c index 320f026a6e..a9989aa3fb 100644 --- a/board/cr50/u2f.c +++ b/board/cr50/u2f.c @@ -72,13 +72,19 @@ static uint32_t salt[8]; static uint32_t salt_kek[8]; static uint32_t salt_kh[8]; static uint8_t u2f_mode = MODE_UNSET; -static const uint8_t k_salt = NVMEM_VAR_U2F_SALT; +static const uint8_t k_salt = NVMEM_VAR_G2F_SALT; +static const uint8_t k_salt_deprecated = NVMEM_VAR_U2F_SALT; static int load_state(void) { const struct tuple *t_salt = getvar(&k_salt, sizeof(k_salt)); if (!t_salt) { + /* Delete the old salt if present, no-op if not. */ + if (setvar(&k_salt_deprecated, sizeof(k_salt_deprecated), + NULL, 0)) + return 0; + /* create random salt */ if (!DCRYPTO_ladder_random(salt)) return 0; |