From 12abd974fdf8362d41d688c478528c6b8047fa87 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 8 Jan 2022 22:57:27 +0100 Subject: Add BLAKE2X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libblake_blake2s_init.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'libblake_blake2s_init.c') diff --git a/libblake_blake2s_init.c b/libblake_blake2s_init.c index d33ce5c..c4b126c 100644 --- a/libblake_blake2s_init.c +++ b/libblake_blake2s_init.c @@ -22,16 +22,9 @@ libblake_blake2s_init(struct libblake_blake2s_state *state, const struct libblak state->h[0] ^= ((uint_least32_t)params->key_len & 255) << 8; state->h[0] ^= ((uint_least32_t)params->fanout & 255) << 16; state->h[0] ^= ((uint_least32_t)params->depth & 255) << 24; - state->h[1] ^= ((uint_least32_t)(params->leaf_len >> 0) & 255) << 0; - state->h[1] ^= ((uint_least32_t)(params->leaf_len >> 8) & 255) << 8; - state->h[1] ^= ((uint_least32_t)(params->leaf_len >> 16) & 255) << 16; - state->h[1] ^= ((uint_least32_t)(params->leaf_len >> 24) & 255) << 24; - state->h[2] ^= ((uint_least32_t)(params->node_offset >> 0) & 255) << 0; - state->h[2] ^= ((uint_least32_t)(params->node_offset >> 8) & 255) << 8; - state->h[2] ^= ((uint_least32_t)(params->node_offset >> 16) & 255) << 16; - state->h[2] ^= ((uint_least32_t)(params->node_offset >> 24) & 255) << 24; - state->h[3] ^= ((uint_least32_t)(params->xof_len >> 0) & 255) << 0; - state->h[3] ^= ((uint_least32_t)(params->xof_len >> 8) & 255) << 8; + state->h[1] ^= params->leaf_len & UINT_LEAST32_C(0xFFFFffff); + state->h[2] ^= (uint_least32_t)((params->node_offset >> 0) & UINT_LEAST64_C(0xFFFFffff)); + state->h[3] ^= (uint_least32_t)((params->node_offset >> 32) & UINT_LEAST64_C(0xFFFF)) << 0; state->h[3] ^= ((uint_least32_t)params->node_depth & 255) << 16; state->h[3] ^= ((uint_least32_t)params->inner_len & 255) << 24; state->h[4] ^= ((uint_least32_t)params->salt[0] & 255) << 0; -- cgit v1.2.3-70-g09d2