• Ard Biesheuvel's avatar
    crypto: arm64/aes-ctr - improve tail handling · 5318d3db
    Ard Biesheuvel authored
    Counter mode is a stream cipher chaining mode that is typically used
    with inputs that are of arbitrarily length, and so a tail block which
    is smaller than a full AES block is rule rather than exception.
    
    The current ctr(aes) implementation for arm64 always makes a separate
    call into the assembler routine to process this tail block, which is
    suboptimal, given that it requires reloading of the AES round keys,
    and prevents us from handling this tail block using the 5-way stride
    that we use for better performance on deep pipelines.
    
    So let's update the assembler routine so it can handle any input size,
    and uses NEON permutation instructions and overlapping loads and stores
    to handle the tail block. This results in a ~16% speedup for 1420 byte
    blocks on cores with deep pipelines such as ThunderX2.
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    5318d3db
aes-glue.c 28.5 KB