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 | 15e8156f8719f1caf3cd5cbd2f77e44993995431 (patch) | |
tree | b6e9b7062c317063c0277c7d9c3f8f13a74ae41d | |
parent | simd: introduce useful disabling macro (diff) | |
download | wireguard-monolithic-historical-15e8156f8719f1caf3cd5cbd2f77e44993995431.tar.xz wireguard-monolithic-historical-15e8156f8719f1caf3cd5cbd2f77e44993995431.zip |
blake2s: always put a simd, even if not use()'d
-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; } |