diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-08 22:57:27 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-08 22:57:27 +0100 |
commit | 12abd974fdf8362d41d688c478528c6b8047fa87 (patch) | |
tree | 096ace7f908e66089f379248e9fe036a85e4a1cb /libblake_blake2xs_init.c | |
parent | Add last_node parameter to libblake_blake2[sb]_digest (diff) | |
download | libblake-12abd974fdf8362d41d688c478528c6b8047fa87.tar.gz libblake-12abd974fdf8362d41d688c478528c6b8047fa87.tar.bz2 libblake-12abd974fdf8362d41d688c478528c6b8047fa87.tar.xz |
Add BLAKE2X
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libblake_blake2xs_init.c')
-rw-r--r-- | libblake_blake2xs_init.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libblake_blake2xs_init.c b/libblake_blake2xs_init.c new file mode 100644 index 0000000..d2d5834 --- /dev/null +++ b/libblake_blake2xs_init.c @@ -0,0 +1,25 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + +void +libblake_blake2xs_init(struct libblake_blake2xs_state *state, const struct libblake_blake2xs_params *params, const unsigned char *key) +{ + libblake_internal_blake2xs_init0(state, params); + + memcpy(&state->xof_params, params, sizeof(state->xof_params)); + state->xof_params.digest_len = 32; + state->xof_params.key_len = 0; + state->xof_params.fanout = 0; + state->xof_params.depth = 0; + state->xof_params.leaf_len = 32; + state->xof_params.xof_len = params->xof_len; + state->xof_params.node_depth = 0; + state->xof_params.inner_len = 32; + + memset(&state->intermediate, 0, sizeof(state->intermediate)); + + if (params->key_len) { + state->b2s.t[0] = 32; + libblake_internal_blake2s_compress(&state->b2s, key); + } +} |