mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
crypto: arm64/aegis128 - implement plain NEON version
Provide a version of the core AES transform to the aegis128 SIMD code that does not rely on the special AES instructions, but uses plain NEON instructions instead. This allows the SIMD version of the aegis128 driver to be used on arm64 systems that do not implement those instructions (which are not mandatory in the architecture), such as the Raspberry Pi 3. Since GCC makes a mess of this when using the tbl/tbx intrinsics to perform the sbox substitution, preload the Sbox into v16..v31 in this case and use inline asm to emit the tbl/tbx instructions. Clang does not support this approach, nor does it require it, since it does a much better job at code generation, so there we use the intrinsics as usual. Cc: Nick Desaulniers <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Acked-by: Nick Desaulniers <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
This commit is contained in:
parent
a4397635af
commit
198429631a
3 changed files with 80 additions and 2 deletions
|
|
@ -98,7 +98,14 @@ CFLAGS_aegis128-neon-inner.o += -mfpu=crypto-neon-fp-armv8
|
|||
aegis128-$(CONFIG_CRYPTO_AEGIS128_SIMD) += aegis128-neon.o aegis128-neon-inner.o
|
||||
endif
|
||||
ifeq ($(ARCH),arm64)
|
||||
CFLAGS_aegis128-neon-inner.o += -ffreestanding -mcpu=generic+crypto
|
||||
aegis128-cflags-y := -ffreestanding -mcpu=generic+crypto
|
||||
aegis128-cflags-$(CONFIG_CC_IS_GCC) += -ffixed-q16 -ffixed-q17 -ffixed-q18 \
|
||||
-ffixed-q19 -ffixed-q20 -ffixed-q21 \
|
||||
-ffixed-q22 -ffixed-q23 -ffixed-q24 \
|
||||
-ffixed-q25 -ffixed-q26 -ffixed-q27 \
|
||||
-ffixed-q28 -ffixed-q29 -ffixed-q30 \
|
||||
-ffixed-q31
|
||||
CFLAGS_aegis128-neon-inner.o += $(aegis128-cflags-y)
|
||||
CFLAGS_REMOVE_aegis128-neon-inner.o += -mgeneral-regs-only
|
||||
aegis128-$(CONFIG_CRYPTO_AEGIS128_SIMD) += aegis128-neon.o aegis128-neon-inner.o
|
||||
endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue