]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: arm64/chacha - fix chacha_4block_xor_neon() for big endian
authorEric Biggers <ebiggers@google.com>
Sat, 23 Feb 2019 06:54:07 +0000 (22:54 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 28 Feb 2019 06:37:48 +0000 (14:37 +0800)
commit5a535ee8cd6a6d6e4cce4b2785579c0829f52049
treee6b9e6144f7933b6d5a2f6796ec86e49eabd00ea
parent8a12c7524a01e48394314dcb19cd5f29bf99b26e
crypto: arm64/chacha - fix chacha_4block_xor_neon() for big endian

The change to encrypt a fifth ChaCha block using scalar instructions
caused the chacha20-neon, xchacha20-neon, and xchacha12-neon self-tests
to start failing on big endian arm64 kernels.  The bug is that the
keystream block produced in 32-bit scalar registers is directly XOR'd
with the data words, which are loaded and stored in native endianness.
Thus in big endian mode the data bytes end up XOR'd with the wrong
bytes.  Fix it by byte-swapping the keystream words in big endian mode.

Fixes: 60069b1ab120 ("crypto: arm64/chacha - use combined SIMD/ALU routine for more speed")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm64/crypto/chacha-neon-core.S