summaryrefslogtreecommitdiffhomepage
path: root/src/crypto
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
commit399d5bb850b0e0d0269ef14bb52720221cb526a4 (patch)
treebfad8adf48433d034fbc88f45988c0a7a7c74680 /src/crypto
parentcda3dc51520680d52df56fd22f42db4e64c84600 (diff)
chacha20-x86_64: cascade down implementations
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto')
-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;
}