crypto: arm64/gcm - move authentication tag check to SIMD domain
authorArd Biesheuvel <ardb@kernel.org>
Tue, 10 Nov 2020 09:10:42 +0000 (10:10 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 20 Nov 2020 03:45:32 +0000 (14:45 +1100)
commit3ad99c22cebee84034bc53e42f5115dbc97490e8
treeae5d8b21d02aab542d2040e79e69b9cb7ecf0301
parent5761498c4d074560b38a203000afc6e971ffaa7f
crypto: arm64/gcm - move authentication tag check to SIMD domain

Instead of copying the calculated authentication tag to memory and
calling crypto_memneq() to verify it, use vector bytewise compare and
min across vector instructions to decide whether the tag is valid. This
is more efficient, and given that the tag is only transiently held in a
NEON register, it is also safer, given that calculated tags for failed
decryptions should be withheld.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm64/crypto/ghash-ce-core.S
arch/arm64/crypto/ghash-ce-glue.c