diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-07-29 11:35:16 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-12-28 21:01:45 +0200 |
commit | bb6439d85b36d9ebbaf82a08e707428e8a7ef234 (patch) | |
tree | c8841eea0913f8fcda621870875422b1d6f28394 /com/BLAKE2/blake2s.h | |
parent | Add BLAKE2s implementation (diff) | |
download | kernel-bb6439d85b36d9ebbaf82a08e707428e8a7ef234.tar.xz |
BLAKE2s: add Known Answer Tests
Diffstat (limited to 'com/BLAKE2/blake2s.h')
-rw-r--r-- | com/BLAKE2/blake2s.h | 15 |
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; +} |