From: Herbert Xu Date: Mon, 20 Jun 2016 05:19:17 +0000 (+0800) Subject: crypto: chacha20-simd - Use generic code for small requests X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7ea0da1d75e0d03f9ec484d2038e3caf06024b17;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git crypto: chacha20-simd - Use generic code for small requests On 16-byte requests the optimised version is actually slower than the generic code, so we should simply use that instead. Signed-off-by: Herbert Xu Cheers, --- diff --git a/arch/x86/crypto/chacha20_glue.c b/arch/x86/crypto/chacha20_glue.c index 2d5c2e0bd939..f910d1d449f0 100644 --- a/arch/x86/crypto/chacha20_glue.c +++ b/arch/x86/crypto/chacha20_glue.c @@ -70,7 +70,7 @@ static int chacha20_simd(struct blkcipher_desc *desc, struct scatterlist *dst, struct blkcipher_walk walk; int err; - if (!may_use_simd()) + if (nbytes <= CHACHA20_BLOCK_SIZE || !may_use_simd()) return crypto_chacha20_crypt(desc, dst, src, nbytes); state = (u32 *)roundup((uintptr_t)state_buf, CHACHA20_STATE_ALIGN);