From 5d77a0178349ecac6536e0374cf689500efa22bc Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 19 Jan 2022 20:28:55 +0100 Subject: Optimisation for amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Increased major number as the ABI was broken by insertion of padding into the BLAKE2 parameter structures (except for BLAKE2Xs) Signed-off-by: Mattias Andrée --- libblake_blake2b_digest.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libblake_blake2b_digest.c') diff --git a/libblake_blake2b_digest.c b/libblake_blake2b_digest.c index 08b2d75..4338387 100644 --- a/libblake_blake2b_digest.c +++ b/libblake_blake2b_digest.c @@ -13,13 +13,16 @@ libblake_blake2b_digest(struct libblake_blake2b_state *state, void *data_, size_ len -= r; state->f[0] = UINT_LEAST64_C(0xFFFFffffFFFFffff); - if (last_node) + if (UNLIKELY(last_node)) state->f[1] = UINT_LEAST64_C(0xFFFFffffFFFFffff); memset(&data[len], 0, 128 - len); + /* This runs so seldom that we are not bothering with trying to optimise + * this since similar code in libblake_blake2b_force_update.c could not + * be optimised */ state->t[0] = (state->t[0] + len) & UINT_LEAST64_C(0xFFFFffffFFFFffff); - if (state->t[0] < len) + if (UNLIKELY(state->t[0] < len)) state->t[1] = (state->t[1] + 1) & UINT_LEAST64_C(0xFFFFffffFFFFffff); libblake_internal_blake2b_compress(state, data); -- cgit v1.2.3-70-g09d2