]> 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)
commit8d27cc99242e7899363935ac82fe7c06f9be0ba1
treef356195f6c5753583c26d4d3512bc88508ae64ef
parentf4c9db1a07e5d19a580368a155929351685e2b19
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