From 4319d104ceb3ed1e62e7831b9f232c6b4186a7b4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 20 Feb 2022 11:29:39 +0100 Subject: Update init for BLAKE2Xb and BLAKE2Xs according to previous commmit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libblake.h | 22 ++-------------------- libblake_blake2xb_init.c | 8 ++------ libblake_blake2xs_init.c | 7 +------ 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/libblake.h b/libblake.h index 81439a1..63a7d73 100644 --- a/libblake.h +++ b/libblake.h @@ -1071,18 +1071,9 @@ struct libblake_blake2xb_state { * * @param state The state to initialise * @param params Hashing parameters - * @param key Key to use. The key's length is set in - * `params->key_len`, but unless this value - * is 0 (hash in unkeyed mode), this buffer - * must be padded with NUL bytes, to the end, - * such that it's length is at least 64 bytes. - * (The maximum allowed key length is 32, the - * buffer's size shall be twice this.) The - * key is used for MAC and PRF. */ LIBBLAKE_PUBLIC__ void -libblake_blake2xs_init(struct libblake_blake2xs_state *state, const struct libblake_blake2xs_params *params, - const unsigned char *key /* append null bytes until 64 bytes; if key is used */); +libblake_blake2xs_init(struct libblake_blake2xs_state *state, const struct libblake_blake2xs_params *params); /** * Process data for hashing with BLAKE2Xs @@ -1199,18 +1190,9 @@ libblake_blake2xs_digest(const struct libblake_blake2xs_state *state, uint_least * * @param state The state to initialise * @param params Hashing parameters - * @param key Key to use. The key's length is set in - * `params->key_len`, but unless this value - * is 0 (hash in unkeyed mode), this buffer - * must be padded with NUL bytes, to the end, - * such that it's length is at least 128 bytes. - * (The maximum allowed key length is 64, the - * buffer's size shall be twice this.) The - * key is used for MAC and PRF. */ LIBBLAKE_PUBLIC__ void -libblake_blake2xb_init(struct libblake_blake2xb_state *state, const struct libblake_blake2xb_params *params, - const unsigned char *key /* append null bytes until 128 bytes; if key is used */); +libblake_blake2xb_init(struct libblake_blake2xb_state *state, const struct libblake_blake2xb_params *params); /** * Process data for hashing with BLAKE2Xb diff --git a/libblake_blake2xb_init.c b/libblake_blake2xb_init.c index 1064bae..da59755 100644 --- a/libblake_blake2xb_init.c +++ b/libblake_blake2xb_init.c @@ -2,11 +2,12 @@ #include "common.h" void -libblake_blake2xb_init(struct libblake_blake2xb_state *state, const struct libblake_blake2xb_params *params, const unsigned char *key) +libblake_blake2xb_init(struct libblake_blake2xb_state *state, const struct libblake_blake2xb_params *params) { libblake_internal_blake2xb_init0(state, params); memcpy(&state->xof_params, params, sizeof(state->xof_params)); + state->xof_params.digest_len = 64; state->xof_params.key_len = 0; state->xof_params.fanout = 0; state->xof_params.depth = 0; @@ -16,9 +17,4 @@ libblake_blake2xb_init(struct libblake_blake2xb_state *state, const struct libbl state->xof_params.inner_len = 64; memset(&state->intermediate, 0, sizeof(state->intermediate)); - - if (params->key_len) { - state->b2b.t[0] = 128; - libblake_internal_blake2b_compress(&state->b2b, key); - } } diff --git a/libblake_blake2xs_init.c b/libblake_blake2xs_init.c index 5404eee..1857f19 100644 --- a/libblake_blake2xs_init.c +++ b/libblake_blake2xs_init.c @@ -2,7 +2,7 @@ #include "common.h" void -libblake_blake2xs_init(struct libblake_blake2xs_state *state, const struct libblake_blake2xs_params *params, const unsigned char *key) +libblake_blake2xs_init(struct libblake_blake2xs_state *state, const struct libblake_blake2xs_params *params) { libblake_internal_blake2xs_init0(state, params); @@ -17,9 +17,4 @@ libblake_blake2xs_init(struct libblake_blake2xs_state *state, const struct libbl state->xof_params.inner_len = 32; memset(&state->intermediate, 0, sizeof(state->intermediate)); - - if (params->key_len) { - state->b2s.t[0] = 64; - libblake_internal_blake2s_compress(&state->b2s, key); - } } -- cgit v1.2.3-70-g09d2