From 514841a83b3ffe17aecd62345659254891333218 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 17 Sep 2018 06:03:38 +0200 Subject: chacha20-x86_64: don't activate simd for small blocks Signed-off-by: Jason A. Donenfeld --- src/crypto/zinc/chacha20/chacha20-x86_64-glue.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/crypto/zinc/chacha20/chacha20-x86_64-glue.h') diff --git a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h index 34919c7..aef9697 100644 --- a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h +++ b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h @@ -61,7 +61,8 @@ 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 (!simd_use(simd_context)) + if ((len < CHACHA20_BLOCK_SIZE && !(*simd_context && HAVE_SIMD_IN_USE)) || + !simd_use(simd_context)) return false; #ifdef CONFIG_AS_AVX512 -- cgit v1.2.3