crypto: x86/aes-xts - handle AES-128 and AES-192 more efficiently
authorEric Biggers <ebiggers@google.com>
Sat, 13 Apr 2024 03:17:26 +0000 (20:17 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 19 Apr 2024 10:54:19 +0000 (18:54 +0800)
commit2717e01fc3fb4d37b625b9bd6cf161d0d9d5c4b5
tree1130797efb723854a6116923e889352abd60fd0b
parentea9459ef363e46b1b353b3fd45761d738b1458a9
crypto: x86/aes-xts - handle AES-128 and AES-192 more efficiently

Decrease the amount of code specific to the different AES variants by
"right-aligning" the sequence of round keys, and for AES-128 and AES-192
just skipping irrelevant rounds at the beginning.

This shrinks the size of aes-xts-avx-x86_64.o by 13.3%, and it improves
the efficiency of AES-128 and AES-192.  The tradeoff is that for AES-256
some additional not-taken conditional jumps are now executed.  But these
are predicted well and are cheap on x86.

Note that the ARMv8 CE based AES-XTS implementation uses a similar
strategy to handle the different AES variants.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/aes-xts-avx-x86_64.S