• Ard Biesheuvel's avatar
    crypto: arm64/aes-ce - Simplify round key load sequence · 571e557c
    Ard Biesheuvel authored
    Tweak the round key logic so that they can be loaded using a single
    branchless sequence using overlapping loads. This is shorter and
    simpler, and puts the conditional branches based on the key size further
    apart, which might benefit microarchitectures that cannot record taken
    branches at every instruction. For these branches, use test-bit-branch
    instructions that don't clobber the condition flags.
    
    Note that none of this has any impact on performance, positive or
    otherwise (and the branch prediction benefit would only benefit AES-192
    which nobody uses). It does make for nicer code, though.
    
    While at it, use \@ to generate the labels inside the macros, which is
    more robust than using fixed numbers, which could clash inadvertently.
    Also, bring aes-neon.S in line with these changes, including the switch
    to test-and-branch instructions, to avoid surprises in the future when
    we might start relying on the condition flags being preserved in the
    chaining mode wrappers in aes-modes.S
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    Reviewed-by: default avatarEric Biggers <ebiggers@google.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    571e557c
aes-neon.S 7.46 KB