aboutsummaryrefslogtreecommitdiff
path: root/ks_volatile.c
diff options
context:
space:
mode:
Diffstat (limited to 'ks_volatile.c')
-rw-r--r--ks_volatile.c7
1 files changed, 6 insertions, 1 deletions
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: