summaryrefslogtreecommitdiffhomepage
path: root/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/zinc/chacha20/chacha20-x86_64-glue.h')
-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;
}