aboutsummaryrefslogtreecommitdiff
path: root/com/BLAKE2/blake2s.h
diff options
context:
space:
mode:
Diffstat (limited to 'com/BLAKE2/blake2s.h')
-rw-r--r--com/BLAKE2/blake2s.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/com/BLAKE2/blake2s.h b/com/BLAKE2/blake2s.h
index d60d6d3..fd68168 100644
--- a/com/BLAKE2/blake2s.h
+++ b/com/BLAKE2/blake2s.h
@@ -45,6 +45,15 @@ void BLAKE2s_update(struct BLAKE2s_ctx *ctx, const void *d, size_t dd);
void BLAKE2s_final(struct BLAKE2s_ctx *ctx, void *out);
// All-in-one convenience function.
-int BLAKE2s(void *out, size_t outlen, // return buffer for digest
- const void *key, size_t keylen, // optional secret key
- const void *in, size_t inlen); // data to be hashed
+[[maybe_unused]] static int
+BLAKE2s(void *out, size_t outlen, // return buffer for digest
+ const void *key, size_t keylen, // optional secret key
+ const void *in, size_t inlen) // data to be hashed
+{
+ struct BLAKE2s_ctx ctx;
+ if (BLAKE2s_init(&ctx, outlen, key, keylen)) return -1;
+ BLAKE2s_update(&ctx, in, inlen);
+ BLAKE2s_final(&ctx, out);
+
+ return 0;
+}