diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-03 18:42:37 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-03 18:42:37 +0200 |
commit | a9fa42240de0dc30fddb70912c89948692b4c135 (patch) | |
tree | 5c75bd15095f85b0aec6074722faa099a3d9ab7f /src | |
parent | bcee2a1b842d022187c3422f4ccc150048b15166 (diff) |
blake2s: always put a simd, even if not use()'d
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/zinc/blake2s/blake2s-x86_64-glue.h | 7 |
1 files changed, 5 insertions, 2 deletions
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; } |