]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: arm64/aes-ce - deal with oversight in new CTR carry code
authorArd Biesheuvel <ardb@kernel.org>
Tue, 6 Apr 2021 14:25:23 +0000 (16:25 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 16 Apr 2021 11:16:31 +0000 (21:16 +1000)
commit7fb2364184b110aa6a381e1977d9d46765e0ae55
tree09fd47a0abf110bc3e8e4521f515c657b4c9f544
parentdee9667ab7ac302880621418ed85790a056e3b66
crypto: arm64/aes-ce - deal with oversight in new CTR carry code

The new carry handling code in the CTR driver can deal with a carry
occurring in the 4x/5x parallel code path, by using a computed goto to
jump into the carry sequence at the right place as to only apply the
carry to a subset of the blocks being processed.

If the lower half of the counter wraps and ends up at exactly 0x0, a
carry needs to be applied to the counter, but not to the counter values
taken for the 4x/5x parallel sequence. In this case, the computed goto
skips all register assignments, and branches straight to the jump
instruction that gets us back to the fast path. This produces the
correct result, but due to the fact that this branch target does not
carry the correct BTI annotation, this fails when BTI is enabled.

Let's omit the computed goto entirely in this case, and jump straight
back to the fast path after applying the carry to the main counter.

Fixes: 557df554c799 ("crypto: arm64/aes-ctr - improve tail handling")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm64/crypto/aes-modes.S