aboutsummaryrefslogtreecommitdiffstats
path: root/libar2simplified_hash.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-02-14 22:34:40 +0100
committerMattias Andrée <maandree@kth.se>2022-02-14 22:40:00 +0100
commit4e0109888c11b15cfb19383fc24310999e506d04 (patch)
tree82e28debff1f2e87e660fa9b802e8f631e09d5e5 /libar2simplified_hash.c
parentAdd libar2simplified_crypt and fix threading (diff)
downloadlibar2simplified-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 'libar2simplified_hash.c')
-rw-r--r--libar2simplified_hash.c6
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;
}