• Ard Biesheuvel's avatar
    crypto: aegis - avoid prerotated AES tables · 521cdde7
    Ard Biesheuvel authored
    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: default avatarOndrej Mosnacek <omosnace@redhat.com>
    Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    521cdde7
aegis.h 2 KB