aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-17 05:16:35 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-09-17 05:16:35 +0200
commit809e6a07815992f999663ef66e52d2e7c28fbe04 (patch)
tree5eb3ba604bd0c5a94370eee551c861c8d353de6a
parentpoly1305: do not require simd context for arch (diff)
downloadwireguard-monolithic-historical-809e6a07815992f999663ef66e52d2e7c28fbe04.tar.xz
wireguard-monolithic-historical-809e6a07815992f999663ef66e52d2e7c28fbe04.zip
chacha20-x86_64: cascade down implementations
-rw-r--r--src/crypto/zinc/chacha20/chacha20-x86_64-glue.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
index 5a44988..78270d7 100644
--- a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
@@ -65,17 +65,17 @@ static inline bool chacha20_arch(u8 *dst, const u8 *src, const size_t len,
return false;
#ifdef CONFIG_AS_AVX512
- if (chacha20_use_avx512) {
+ if (chacha20_use_avx512 && len >= CHACHA20_BLOCK_SIZE * 16) {
chacha20_avx512(dst, src, len, key, counter);
return true;
}
- if (chacha20_use_avx512vl) {
+ if (chacha20_use_avx512vl && len >= CHACHA20_BLOCK_SIZE * 16) {
chacha20_avx512vl(dst, src, len, key, counter);
return true;
}
#endif
#ifdef CONFIG_AS_AVX2
- if (chacha20_use_avx2) {
+ if (chacha20_use_avx2 && len >= CHACHA20_BLOCK_SIZE * 8) {
chacha20_avx2(dst, src, len, key, counter);
return true;
}