]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: aegis - avoid prerotated AES tables
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 3 Jul 2019 08:55:09 +0000 (10:55 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 26 Jul 2019 05:03:57 +0000 (15:03 +1000)
commit73788105b70bbc4390fb7adf58067b33e38d90b0
treef356195f6c5753583c26d4d3512bc88508ae64ef
parent95ab2f7025760164fce8f0d09786cb7d17de4046
crypto: aegis - avoid prerotated AES tables

The generic AES code provides four sets of lookup tables, where each
set consists of four tables containing the same 32-bit values, but
rotated by 0, 8, 16 and 24 bits, respectively. This makes sense for
CISC architectures such as x86 which support memory operands, but
for other architectures, the rotates are quite cheap, and using all
four tables needlessly thrashes the D-cache, and actually hurts rather
than helps performance.

Since x86 already has its own implementation of AEGIS based on AES-NI
instructions, let's tweak the generic implementation towards other
architectures, and avoid the prerotated tables, and perform the
rotations inline. On ARM Cortex-A53, this results in a ~8% speedup.

Acked-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/aegis.h