[Cryptech-Commits] [sw/libhal] 05/05: Erase new head of free list in ks_store().
git at cryptech.is
git at cryptech.is
Wed Feb 15 01:13:20 UTC 2017
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch pymux
in repository sw/libhal.
commit 44652e52ae7b238adcac5a347ca74f2a9838ab6f
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Tue Feb 14 20:01:04 2017 -0500
Erase new head of free list in ks_store().
---
ks_flash.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/ks_flash.c b/ks_flash.c
index b9397f8..c0179ca 100644
--- a/ks_flash.c
+++ b/ks_flash.c
@@ -1075,7 +1075,13 @@ static hal_error_t ks_store(hal_ks_t *ks,
k->der_len = SIZEOF_FLASH_KEY_BLOCK_DER;
k->attributes_len = 0;
- if ((err = hal_mkm_get_kek(kek, &kek_len, sizeof(kek))) == HAL_OK)
+ if (db.ksi.used < db.ksi.size)
+ err = block_erase_maybe(db.ksi.index[db.ksi.used]);
+
+ if (err == HAL_OK)
+ err = hal_mkm_get_kek(kek, &kek_len, sizeof(kek));
+
+ if (err == HAL_OK)
err = hal_aes_keywrap(NULL, kek, kek_len, der, der_len, k->der, &k->der_len);
memset(kek, 0, sizeof(kek));
More information about the Commits
mailing list