]> www.infradead.org Git - users/jedix/linux-maple.git/commit
crypto: arm/crct10dif - revert to C code for short inputs
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Sun, 27 Jan 2019 09:16:52 +0000 (10:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 13:35:18 +0000 (14:35 +0100)
commite605d572c3ca00698ed0d05dc343c3a195196fdb
treecf4c86370e7e6cc9e4381047bda3f1e1a92ea7b6
parent8f94a9388accd55e39028e56b9f020fca7ebad4d
crypto: arm/crct10dif - revert to C code for short inputs

commit 62fecf295e3c48be1b5f17c440b93875b9adb4d6 upstream.

The SIMD routine ported from x86 used to have a special code path
for inputs < 16 bytes, which got lost somewhere along the way.
Instead, the current glue code aligns the input pointer to permit
the NEON routine to use special versions of the vld1 instructions
that assume 16 byte alignment, but this could result in inputs of
less than 16 bytes to be passed in. This not only fails the new
extended tests that Eric has implemented, it also results in the
code reading past the end of the input, which could potentially
result in crashes when dealing with less than 16 bytes of input
at the end of a page which is followed by an unmapped page.

So update the glue code to only invoke the NEON routine if the
input is at least 16 bytes.

Reported-by: Eric Biggers <ebiggers@kernel.org>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Fixes: 1d481f1cd892 ("crypto: arm/crct10dif - port x86 SSE implementation to ARM")
Cc: <stable@vger.kernel.org> # v4.10+
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/crypto/crct10dif-ce-core.S
arch/arm/crypto/crct10dif-ce-glue.c