aboutsummaryrefslogtreecommitdiffstats
path: root/libar2_hash_buf_size.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-02-13 23:22:53 +0100
committerMattias Andrée <maandree@kth.se>2022-02-13 23:22:53 +0100
commit238d8b72069b80522066ac5edc3a4d2155e3382c (patch)
tree3ba436e8c5cc967d4e26f5a1bd454d92697b5eb2 /libar2_hash_buf_size.c
parentBug fix (diff)
downloadlibar2-238d8b72069b80522066ac5edc3a4d2155e3382c.tar.gz
libar2-238d8b72069b80522066ac5edc3a4d2155e3382c.tar.bz2
libar2-238d8b72069b80522066ac5edc3a4d2155e3382c.tar.xz
Add libar2_hash_buf_size and fix related documentation for libar2_hash
Diffstat (limited to 'libar2_hash_buf_size.c')
-rw-r--r--libar2_hash_buf_size.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libar2_hash_buf_size.c b/libar2_hash_buf_size.c
new file mode 100644
index 0000000..b165d4b
--- /dev/null
+++ b/libar2_hash_buf_size.c
@@ -0,0 +1,9 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+size_t
+libar2_hash_buf_size(struct libar2_argon2_parameters *params)
+{
+ return (params->hashlen > 64 && (params->hashlen & 127)) ? (params->hashlen | 127) + 1 : params->hashlen;
+}