From 15e8156f8719f1caf3cd5cbd2f77e44993995431 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 3 Oct 2018 18:42:37 +0200 Subject: blake2s: always put a simd, even if not use()'d --- src/crypto/zinc/blake2s/blake2s-x86_64-glue.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/crypto/zinc/blake2s/blake2s-x86_64-glue.h') diff --git a/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h b/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h index 1f331cb..2191e3f 100644 --- a/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h +++ b/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h @@ -39,6 +39,7 @@ static inline bool blake2s_compress_arch(struct blake2s_state *state, const u32 inc) { simd_context_t simd_context; + bool used_arch = false; /* SIMD disables preemption, so relax after processing each page. */ BUILD_BUG_ON(PAGE_SIZE / BLAKE2S_BLOCK_SIZE < 8); @@ -47,7 +48,8 @@ static inline bool blake2s_compress_arch(struct blake2s_state *state, if (!IS_ENABLED(CONFIG_AS_AVX) || !blake2s_use_avx || !simd_use(&simd_context)) - return false; + goto out; + used_arch = true; for (;;) { const size_t blocks = min_t(size_t, nblocks, @@ -64,6 +66,7 @@ static inline bool blake2s_compress_arch(struct blake2s_state *state, block += blocks * BLAKE2S_BLOCK_SIZE; simd_relax(&simd_context); } +out: simd_put(&simd_context); - return true; + return used_arch; } -- cgit v1.2.3-59-g8ed1b