diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-12-31 16:03:20 +0200 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2023-01-29 11:41:29 +0200 |
commit | f6b7365dc8759d6df5d340e4a68fb75537c07be4 (patch) | |
tree | c15614d8dee445dd4c6ae75da2959c701e69daae /com/BLAKE2/blake2s.h | |
parent | Move blake2s selftest to test/ (diff) | |
download | kernel-f6b7365dc8759d6df5d340e4a68fb75537c07be4.tar.xz |
blake2: use makefiles instead of meson.build
Diffstat (limited to 'com/BLAKE2/blake2s.h')
-rw-r--r-- | com/BLAKE2/blake2s.h | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/com/BLAKE2/blake2s.h b/com/BLAKE2/blake2s.h deleted file mode 100644 index fd68168..0000000 --- a/com/BLAKE2/blake2s.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include <stddef.h> -#include <stdint.h> - -struct BLAKE2s_param { - uint8_t outlen; // digest length - uint8_t keylen; // key length - uint8_t fanout; - uint8_t depth; - uint32_t leaf_length; - uint32_t node_offset; - uint16_t node_offset_ex; - uint8_t node_depth; - uint8_t inner_length; - uint64_t salt; - uint64_t personalization; -}; - -struct BLAKE2s_ctx { - uint8_t b[64]; // input buffer - size_t c; // pointer for b[] - size_t outlen; // digest size TODO remove - uint32_t h[8]; // chained state vector h - uint32_t t[2]; // total number of bytes - struct BLAKE2s_param param; // parameter block -}; - -uint32_t rotr_u32(uint32_t word, uint8_t c); - -/** - * 3.1 Mixing Function G - */ -void G(uint32_t V[16], unsigned a, unsigned b, unsigned c, unsigned d, uint32_t x, uint32_t y); - -/** - * 3.2 Compression Function F - * @param t: 2w-bit offset counter t - * @param f: final block indicator flag f - */ -void F(struct BLAKE2s_ctx *context, uint32_t m[16], uint32_t f); - -[[nodiscard]] int BLAKE2s_init(struct BLAKE2s_ctx *ctx, size_t outlen, const void *key, size_t keylen); -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. -[[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; -} |