aboutsummaryrefslogtreecommitdiff
path: root/ks_mmap.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-05-15 23:49:03 -0400
committerRob Austein <sra@hactrn.net>2016-05-15 23:49:03 -0400
commit19de5cd21bde4dcee12c40cd53d5592cbd91bc7b (patch)
tree94601108c51a3417a0bcea9c0955a55c34ab8db1 /ks_mmap.c
parent0690aa3d48966a4b151a468fd3a0a65bb99de439 (diff)
Tweak keystore API to allow update-in-place, so hal_ks_rename() will work.
Diffstat (limited to 'ks_mmap.c')
-rw-r--r--ks_mmap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ks_mmap.c b/ks_mmap.c
index e62aa46..cca9d3f 100644
--- a/ks_mmap.c
+++ b/ks_mmap.c
@@ -104,9 +104,10 @@ const hal_ks_keydb_t *hal_ks_get_keydb(void)
}
hal_error_t hal_ks_set_keydb(const hal_ks_key_t * const key,
- const int loc)
+ const int loc,
+ const int updating)
{
- if (key == NULL || loc < 0 || loc >= sizeof(db->keys)/sizeof(*db->keys) || key->in_use)
+ if (key == NULL || loc < 0 || loc >= sizeof(db->keys)/sizeof(*db->keys) || (!key->in_use != !updating))
return HAL_ERROR_BAD_ARGUMENTS;
db->keys[loc] = *key;