[Cryptech-Commits] [sw/libhal] 08/08: Debug new keystore init code.
git at cryptech.is
git at cryptech.is
Sun May 28 22:51:57 UTC 2017
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch ks9
in repository sw/libhal.
commit 9e20f2fa42bcd493548bf7764958848ab72d1255
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sun May 28 18:50:23 2017 -0400
Debug new keystore init code.
---
ks_token.c | 5 +++++
ks_volatile.c | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/ks_token.c b/ks_token.c
index c2ebee2..6172f79 100644
--- a/ks_token.c
+++ b/ks_token.c
@@ -338,6 +338,11 @@ static hal_error_t ks_token_init(hal_ks_t *ks, const int alloc)
unsigned b;
+ if ((block = hal_ks_cache_pick_lru(ks)) == NULL) {
+ err = HAL_ERROR_IMPOSSIBLE;
+ goto done;
+ }
+
memset(block, 0xFF, sizeof(*block));
block->header.block_type = HAL_KS_BLOCK_TYPE_PIN;
diff --git a/ks_volatile.c b/ks_volatile.c
index 42d1ba1..c1ea72d 100644
--- a/ks_volatile.c
+++ b/ks_volatile.c
@@ -205,13 +205,18 @@ static hal_error_t ks_volatile_init(hal_ks_t *ks, const int alloc)
db->keys = mem;
}
- if ((err = hal_ks_init_common(ks)) != HAL_OK)
+ if (db->keys == NULL) {
+ err = HAL_ERROR_IMPOSSIBLE;
goto done;
+ }
for (unsigned b = 0; b < db->ks.size; b++)
if ((err = hal_ks_block_erase(ks, b)) != HAL_OK)
goto done;
+ if ((err = hal_ks_init_common(ks)) != HAL_OK)
+ goto done;
+
err = HAL_OK;
done:
More information about the Commits
mailing list