• Ard Biesheuvel's avatar
    crypto: arm64/aes-ccm - Merge encrypt and decrypt tail handling · 71505288
    Ard Biesheuvel authored
    The encryption and decryption code paths are mostly identical, except
    for a small difference where the plaintext input into the MAC is taken
    from either the input or the output block.
    
    We can factor this in quite easily using a vector bit select, and a few
    additional XORs, without the need for branches. This way, we can use the
    same tail handling logic on the encrypt and decrypt code paths, allowing
    further consolidation of the asm helpers in a subsequent patch.
    
    (In the main loop, adding just a handful of ALU instructions results in
    a noticeable performance hit [around 5% on Apple M2], so those routines
    are kept separate)
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    71505288
aes-ce-ccm-core.S 3.94 KB