2014-03-06 16:23:33 +08:00
|
|
|
|
|
|
|
menuconfig ARM64_CRYPTO
|
|
|
|
bool "ARM64 Accelerated Cryptographic Algorithms"
|
|
|
|
depends on ARM64
|
|
|
|
help
|
|
|
|
Say Y here to choose from a selection of cryptographic algorithms
|
|
|
|
implemented using ARM64 specific CPU features or instructions.
|
|
|
|
|
|
|
|
if ARM64_CRYPTO
|
|
|
|
|
|
|
|
config CRYPTO_SHA1_ARM64_CE
|
|
|
|
tristate "SHA-1 digest algorithm (ARMv8 Crypto Extensions)"
|
|
|
|
depends on ARM64 && KERNEL_MODE_NEON
|
|
|
|
select CRYPTO_HASH
|
|
|
|
|
2014-03-20 15:35:40 +01:00
|
|
|
config CRYPTO_SHA2_ARM64_CE
|
|
|
|
tristate "SHA-224/SHA-256 digest algorithm (ARMv8 Crypto Extensions)"
|
|
|
|
depends on ARM64 && KERNEL_MODE_NEON
|
|
|
|
select CRYPTO_HASH
|
|
|
|
|
2014-03-26 20:53:05 +01:00
|
|
|
config CRYPTO_GHASH_ARM64_CE
|
|
|
|
tristate "GHASH (for GCM chaining mode) using ARMv8 Crypto Extensions"
|
|
|
|
depends on ARM64 && KERNEL_MODE_NEON
|
|
|
|
select CRYPTO_HASH
|
|
|
|
|
ANDROID: arm64/crypto: add ARMv8-CE optimized poly_hash algorithm
poly_hash is part of the HEH (Hash-Encrypt-Hash) encryption mode,
proposed in Internet Draft
https://tools.ietf.org/html/draft-cope-heh-01. poly_hash is very
similar to GHASH; besides the swapping of the last two coefficients
which we opted to handle in the HEH template, poly_hash just uses a
different finite field representation. As with GHASH, poly_hash becomes
much faster and more secure against timing attacks when implemented
using carryless multiplication instructions instead of tables. This
patch adds an ARMv8-CE optimized version of poly_hash, based roughly on
the existing ARMv8-CE optimized version of GHASH.
Benchmark results are shown below, but note that the resistance to
timing attacks may be even more important than the performance gain.
poly_hash only:
poly_hash-generic:
1,000,000 setkey() takes 1185 ms
hashing is 328 MB/s
poly_hash-ce:
1,000,000 setkey() takes 8 ms
hashing is 1756 MB/s
heh(aes) with 4096-byte inputs (this is the ideal case, as the
improvement is less significant with smaller inputs):
encryption with "heh_base(cmac(aes-ce),poly_hash-generic,ecb-aes-ce)": 118 MB/s
decryption with "heh_base(cmac(aes-ce),poly_hash-generic,ecb-aes-ce)": 120 MB/s
encryption with "heh_base(cmac(aes-ce),poly_hash-ce,ecb-aes-ce)": 291 MB/s
decryption with "heh_base(cmac(aes-ce),poly_hash-ce,ecb-aes-ce)": 293 MB/s
Bug: 32508661
Signed-off-by: Eric Biggers <ebiggers@google.com>
Change-Id: I621ec0e1115df7e6f5cbd7e864a4a9d8d2e94cf2
2017-01-10 18:32:19 -08:00
|
|
|
config CRYPTO_POLY_HASH_ARM64_CE
|
|
|
|
tristate "poly_hash (for HEH encryption mode) using ARMv8 Crypto Extensions"
|
|
|
|
depends on ARM64 && KERNEL_MODE_NEON
|
|
|
|
select CRYPTO_HASH
|
|
|
|
|
2014-02-05 18:13:38 +01:00
|
|
|
config CRYPTO_AES_ARM64_CE
|
|
|
|
tristate "AES core cipher using ARMv8 Crypto Extensions"
|
|
|
|
depends on ARM64 && KERNEL_MODE_NEON
|
|
|
|
select CRYPTO_ALGAPI
|
|
|
|
|
2014-02-10 11:26:29 +01:00
|
|
|
config CRYPTO_AES_ARM64_CE_CCM
|
|
|
|
tristate "AES in CCM mode using ARMv8 Crypto Extensions"
|
|
|
|
depends on ARM64 && KERNEL_MODE_NEON
|
|
|
|
select CRYPTO_ALGAPI
|
2014-11-03 16:50:01 +00:00
|
|
|
select CRYPTO_AES_ARM64_CE
|
2014-02-10 11:26:29 +01:00
|
|
|
select CRYPTO_AEAD
|
|
|
|
|
2014-03-21 10:19:17 +01:00
|
|
|
config CRYPTO_AES_ARM64_CE_BLK
|
|
|
|
tristate "AES in ECB/CBC/CTR/XTS modes using ARMv8 Crypto Extensions"
|
|
|
|
depends on ARM64 && KERNEL_MODE_NEON
|
|
|
|
select CRYPTO_BLKCIPHER
|
2014-11-03 16:50:01 +00:00
|
|
|
select CRYPTO_AES_ARM64_CE
|
2014-03-21 10:19:17 +01:00
|
|
|
select CRYPTO_ABLK_HELPER
|
|
|
|
|
|
|
|
config CRYPTO_AES_ARM64_NEON_BLK
|
|
|
|
tristate "AES in ECB/CBC/CTR/XTS modes using NEON instructions"
|
|
|
|
depends on ARM64 && KERNEL_MODE_NEON
|
|
|
|
select CRYPTO_BLKCIPHER
|
|
|
|
select CRYPTO_AES
|
|
|
|
select CRYPTO_ABLK_HELPER
|
|
|
|
|
2014-11-19 11:19:37 -06:00
|
|
|
config CRYPTO_CRC32_ARM64
|
|
|
|
tristate "CRC32 and CRC32C using optional ARMv8 instructions"
|
|
|
|
depends on ARM64
|
|
|
|
select CRYPTO_HASH
|
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-05 11:17:07 -08:00
|
|
|
|
|
|
|
config CRYPTO_SPECK_NEON
|
|
|
|
tristate "NEON accelerated Speck cipher algorithms"
|
|
|
|
depends on KERNEL_MODE_NEON
|
|
|
|
select CRYPTO_BLKCIPHER
|
|
|
|
select CRYPTO_GF128MUL
|
|
|
|
select CRYPTO_SPECK
|
2014-03-06 16:23:33 +08:00
|
|
|
endif
|