diff options
author | Mattias Andrée <maandree@kth.se> | 2022-02-14 22:34:40 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-02-14 22:40:00 +0100 |
commit | 4e0109888c11b15cfb19383fc24310999e506d04 (patch) | |
tree | 82e28debff1f2e87e660fa9b802e8f631e09d5e5 /libar2simplified_hash.c | |
parent | Add libar2simplified_crypt and fix threading (diff) | |
download | libar2simplified-4e0109888c11b15cfb19383fc24310999e506d04.tar.gz libar2simplified-4e0109888c11b15cfb19383fc24310999e506d04.tar.bz2 libar2simplified-4e0109888c11b15cfb19383fc24310999e506d04.tar.xz |
Add documentation and make sure the password is always erased
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libar2simplified_hash.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libar2simplified_hash.c b/libar2simplified_hash.c index 4583dfb..8e4bd85 100644 --- a/libar2simplified_hash.c +++ b/libar2simplified_hash.c @@ -391,6 +391,7 @@ int libar2simplified_hash(void *hash, void *msg, size_t msglen, struct libar2_argon2_parameters *params) { struct libar2_context ctx; + int ret; memset(&ctx, 0, sizeof(ctx)); ctx.autoerase_message = 1; @@ -402,5 +403,8 @@ libar2simplified_hash(void *hash, void *msg, size_t msglen, struct libar2_argon2 ctx.join_thread_pool = join_thread_pool; ctx.destroy_thread_pool = destroy_thread_pool; - return libar2_hash(hash, msg, msglen, params, &ctx); + ret = libar2_hash(hash, msg, msglen, params, &ctx); + if (ret) + libar2_erase(msg, msglen); + return ret; } |