android_kernel_oneplus_msm8998/arch/arm64/crypto
Eric Biggers 37343fde0c BACKPORT, FROMLIST: crypto: arm64/speck - add NEON-accelerated implementation of Speck-XTS
Add a NEON-accelerated implementation of Speck128-XTS and Speck64-XTS
for ARM64.  This is ported from the 32-bit version.  It may be useful on
devices with 64-bit ARM CPUs that don't have the Cryptography
Extensions, so cannot do AES efficiently -- e.g. the Cortex-A53
processor on the Raspberry Pi 3.

It generally works the same way as the 32-bit version, but there are
some slight differences due to the different instructions, registers,
and syntax available in ARM64 vs. in ARM32.  For example, in the 64-bit
version there are enough registers to hold the XTS tweaks for each
128-byte chunk, so they don't need to be saved on the stack.

Benchmarks on a Raspberry Pi 3 running a 64-bit kernel:

   Algorithm                              Encryption     Decryption
   ---------                              ----------     ----------
   Speck64/128-XTS (NEON)                 92.2 MB/s      92.2 MB/s
   Speck128/256-XTS (NEON)                75.0 MB/s      75.0 MB/s
   Speck128/256-XTS (generic)             47.4 MB/s      35.6 MB/s
   AES-128-XTS (NEON bit-sliced)          33.4 MB/s      29.6 MB/s
   AES-256-XTS (NEON bit-sliced)          24.6 MB/s      21.7 MB/s

The code performs well on higher-end ARM64 processors as well, though
such processors tend to have the Crypto Extensions which make AES
preferred.  For example, here are the same benchmarks run on a HiKey960
(with CPU affinity set for the A73 cores), with the Crypto Extensions
implementation of AES-256-XTS added:

   Algorithm                              Encryption     Decryption
   ---------                              -----------    -----------
   AES-256-XTS (Crypto Extensions)        1273.3 MB/s    1274.7 MB/s
   Speck64/128-XTS (NEON)                  359.8 MB/s     348.0 MB/s
   Speck128/256-XTS (NEON)                 292.5 MB/s     286.1 MB/s
   Speck128/256-XTS (generic)              186.3 MB/s     181.8 MB/s
   AES-128-XTS (NEON bit-sliced)           142.0 MB/s     124.3 MB/s
   AES-256-XTS (NEON bit-sliced)           104.7 MB/s      91.1 MB/s

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

(cherry picked from commit 91a2abb78f940ac821345cb7cc376dca94336c2f
 git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master)
(changed speck-neon-glue.c to use blkcipher API instead of skcipher API)
(resolved merge conflicts in arch/arm64/crypto/Makefile and
 arch/arm64/crypto/Kconfig)
(made CONFIG_CRYPTO_SPECK_NEON select CONFIG_CRYPTO_GF128MUL, since
 gf128mul_x_ble() is non-inline in older kernels)
Change-Id: Iaed7a14c84b32b09ec299060a5d27060693043d5
Signed-off-by: Eric Biggers <ebiggers@google.com>
2018-03-24 09:42:06 +00:00
..
aes-ce-ccm-core.S crypto: arm64/aes-ccm-ce: fix for big endian 2017-01-12 11:22:50 +01:00
aes-ce-ccm-glue.c crypto: aead - Remove CRYPTO_ALG_AEAD_NEW flag 2015-08-17 16:53:53 +08:00
aes-ce-cipher.c crypto: arm64/aes-ce - fix for big endian 2017-01-12 11:22:50 +01:00
aes-ce-setkey.h arm64/crypto: use crypto instructions to generate AES key schedule 2014-11-06 17:25:28 +00:00
aes-ce.S crypto: arm64/aes-xts-ce: fix for big endian 2017-01-12 11:22:50 +01:00
aes-glue.c Merge remote-tracking branch 'common/android-4.4' into android-4.4.y 2017-02-15 18:02:55 -08:00
aes-modes.S crypto: arm64/aes-blk - honour iv_out requirement in CBC and CTR modes 2017-02-09 08:02:45 +01:00
aes-neon.S crypto: arm64/aes-neon - fix for big endian 2017-01-12 11:22:50 +01:00
crc32-arm64.c crypto: arm64/crc32 - bring in line with generic CRC32 2015-05-07 11:16:24 +08:00
ghash-ce-core.S crypto: arm64/ghash-ce - fix for big endian 2017-01-12 11:22:50 +01:00
ghash-ce-glue.c arm64/crypto: improve performance of GHASH algorithm 2014-06-18 12:40:54 +01:00
Kconfig BACKPORT, FROMLIST: crypto: arm64/speck - add NEON-accelerated implementation of Speck-XTS 2018-03-24 09:42:06 +00:00
Makefile BACKPORT, FROMLIST: crypto: arm64/speck - add NEON-accelerated implementation of Speck-XTS 2018-03-24 09:42:06 +00:00
poly-hash-ce-core.S ANDROID: arm64/crypto: add ARMv8-CE optimized poly_hash algorithm 2017-02-10 20:09:13 +00:00
poly-hash-ce-glue.c ANDROID: arm64/crypto: add ARMv8-CE optimized poly_hash algorithm 2017-02-10 20:09:13 +00:00
sha1-ce-core.S UPSTREAM: crypto: arm64/sha - avoid non-standard inline asm tricks 2017-10-09 14:00:13 -07:00
sha1-ce-glue.c UPSTREAM: crypto: arm64/sha - avoid non-standard inline asm tricks 2017-10-09 14:00:13 -07:00
sha2-ce-core.S UPSTREAM: crypto: arm64/sha - avoid non-standard inline asm tricks 2017-10-09 14:00:13 -07:00
sha2-ce-glue.c UPSTREAM: crypto: arm64/sha - avoid non-standard inline asm tricks 2017-10-09 14:00:13 -07:00
speck-neon-core.S BACKPORT, FROMLIST: crypto: arm64/speck - add NEON-accelerated implementation of Speck-XTS 2018-03-24 09:42:06 +00:00
speck-neon-glue.c BACKPORT, FROMLIST: crypto: arm64/speck - add NEON-accelerated implementation of Speck-XTS 2018-03-24 09:42:06 +00:00