diff options
Diffstat (limited to 'libblake_blake2s_init.c')
-rw-r--r-- | libblake_blake2s_init.c | 13 |
1 files changed, 3 insertions, 10 deletions
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; |