]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: x86/chacha-sse3 - use unaligned loads for state array
authorArd Biesheuvel <ardb@kernel.org>
Wed, 8 Jul 2020 09:11:18 +0000 (12:11 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 16 Jul 2020 11:49:04 +0000 (21:49 +1000)
commit1f4f001670873df1dfa43bb1629f853b4bda0ae8
treefe9d960b52083a72242d8c1a5ecbd0db8b90ff3d
parentde7a84af095df65db6fc4f66c08ce3985cf278d8
crypto: x86/chacha-sse3 - use unaligned loads for state array

Due to the fact that the x86 port does not support allocating objects
on the stack with an alignment that exceeds 8 bytes, we have a rather
ugly hack in the x86 code for ChaCha to ensure that the state array is
aligned to 16 bytes, allowing the SSE3 implementation of the algorithm
to use aligned loads.

Given that the performance benefit of using of aligned loads appears to
be limited (~0.25% for 1k blocks using tcrypt on a Corei7-8650U), and
the fact that this hack has leaked into generic ChaCha code, let's just
remove it.

Cc: Martin Willi <martin@strongswan.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Martin Willi <martin@strongswan.org>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/chacha-ssse3-x86_64.S
arch/x86/crypto/chacha_glue.c
include/crypto/chacha.h