aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-17 22:55:43 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-09-18 04:21:16 +0200
commit52142a709f14eb2ac8d1b877fc2dc9c8dc2dad7f (patch)
tree6680dca377f51c2bc5093d927a2a23d8566f6f1e
parentchacha20poly1305: relax simd between sg chunks (diff)
downloadwireguard-monolithic-historical-52142a709f14eb2ac8d1b877fc2dc9c8dc2dad7f.tar.xz
wireguard-monolithic-historical-52142a709f14eb2ac8d1b877fc2dc9c8dc2dad7f.zip
chacha20-x86_64: more limited cascade
-rw-r--r--src/crypto/zinc/chacha20/chacha20-x86_64-glue.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
index 7eacde3..f3a7456 100644
--- a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
@@ -60,22 +60,21 @@ static inline bool chacha20_arch(u8 *dst, const u8 *src, const size_t len,
const u32 key[8], const u32 counter[4],
simd_context_t *simd_context)
{
- if ((len < CHACHA20_BLOCK_SIZE && !(*simd_context && HAVE_SIMD_IN_USE)) ||
- !simd_use(simd_context))
+ if (len <= CHACHA20_BLOCK_SIZE || !simd_use(simd_context))
return false;
#ifdef CONFIG_AS_AVX512
- if (chacha20_use_avx512 && len >= CHACHA20_BLOCK_SIZE * 16) {
+ if (chacha20_use_avx512 && len >= CHACHA20_BLOCK_SIZE * 8) {
chacha20_avx512(dst, src, len, key, counter);
return true;
}
- if (chacha20_use_avx512vl && len >= CHACHA20_BLOCK_SIZE * 16) {
+ if (chacha20_use_avx512vl && len >= CHACHA20_BLOCK_SIZE * 8) {
chacha20_avx512vl(dst, src, len, key, counter);
return true;
}
#endif
#ifdef CONFIG_AS_AVX2
- if (chacha20_use_avx2 && len >= CHACHA20_BLOCK_SIZE * 8) {
+ if (chacha20_use_avx2 && len >= CHACHA20_BLOCK_SIZE * 4) {
chacha20_avx2(dst, src, len, key, counter);
return true;
}