1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 2652ccae5SArd Biesheuvel 34a329fecSRobert Elliottmenu "Accelerated Cryptographic Algorithms for CPU (arm)" 4652ccae5SArd Biesheuvel 54a95d4aeSRobert Elliottconfig CRYPTO_CURVE25519_NEON 6*17ec3e71SHerbert Xu tristate 74a95d4aeSRobert Elliott depends on KERNEL_MODE_NEON 8*17ec3e71SHerbert Xu select CRYPTO_KPP 94a95d4aeSRobert Elliott select CRYPTO_LIB_CURVE25519_GENERIC 10*17ec3e71SHerbert Xu select CRYPTO_ARCH_HAVE_LIB_CURVE25519 11*17ec3e71SHerbert Xu default CRYPTO_LIB_CURVE25519_INTERNAL 1205b37465SRobert Elliott help 1305b37465SRobert Elliott Curve25519 algorithm 1405b37465SRobert Elliott 1505b37465SRobert Elliott Architecture: arm with 1605b37465SRobert Elliott - NEON (Advanced SIMD) extensions 174a95d4aeSRobert Elliott 184a95d4aeSRobert Elliottconfig CRYPTO_GHASH_ARM_CE 193f342a23SRobert Elliott tristate "Hash functions: GHASH (PMULL/NEON/ARMv8 Crypto Extensions)" 204a95d4aeSRobert Elliott depends on KERNEL_MODE_NEON 21b575b5a1SArd Biesheuvel select CRYPTO_AEAD 224a95d4aeSRobert Elliott select CRYPTO_HASH 234a95d4aeSRobert Elliott select CRYPTO_CRYPTD 24b575b5a1SArd Biesheuvel select CRYPTO_LIB_AES 2561c581a4SArd Biesheuvel select CRYPTO_LIB_GF128MUL 264a95d4aeSRobert Elliott help 273f342a23SRobert Elliott GCM GHASH function (NIST SP800-38D) 283f342a23SRobert Elliott 293f342a23SRobert Elliott Architecture: arm using 303f342a23SRobert Elliott - PMULL (Polynomial Multiply Long) instructions 313f342a23SRobert Elliott - NEON (Advanced SIMD) extensions 323f342a23SRobert Elliott - ARMv8 Crypto Extensions 333f342a23SRobert Elliott 344a95d4aeSRobert Elliott Use an implementation of GHASH (used by the GCM AEAD chaining mode) 354a95d4aeSRobert Elliott that uses the 64x64 to 128 bit polynomial multiplication (vmull.p64) 364a95d4aeSRobert Elliott that is part of the ARMv8 Crypto Extensions, or a slower variant that 374a95d4aeSRobert Elliott uses the vmull.p8 instruction that is part of the basic NEON ISA. 384a95d4aeSRobert Elliott 394a95d4aeSRobert Elliottconfig CRYPTO_NHPOLY1305_NEON 403f342a23SRobert Elliott tristate "Hash functions: NHPoly1305 (NEON)" 414a95d4aeSRobert Elliott depends on KERNEL_MODE_NEON 424a95d4aeSRobert Elliott select CRYPTO_NHPOLY1305 433f342a23SRobert Elliott help 443f342a23SRobert Elliott NHPoly1305 hash function (Adiantum) 453f342a23SRobert Elliott 463f342a23SRobert Elliott Architecture: arm using: 473f342a23SRobert Elliott - NEON (Advanced SIMD) extensions 484a95d4aeSRobert Elliott 494a95d4aeSRobert Elliottconfig CRYPTO_POLY1305_ARM 50*17ec3e71SHerbert Xu tristate 514a95d4aeSRobert Elliott select CRYPTO_HASH 52*17ec3e71SHerbert Xu select CRYPTO_ARCH_HAVE_LIB_POLY1305 53*17ec3e71SHerbert Xu default CRYPTO_LIB_POLY1305_INTERNAL 543f342a23SRobert Elliott help 553f342a23SRobert Elliott Poly1305 authenticator algorithm (RFC7539) 563f342a23SRobert Elliott 573f342a23SRobert Elliott Architecture: arm optionally using 583f342a23SRobert Elliott - NEON (Advanced SIMD) extensions 594a95d4aeSRobert Elliott 604a95d4aeSRobert Elliottconfig CRYPTO_BLAKE2S_ARM 613f342a23SRobert Elliott bool "Hash functions: BLAKE2s" 624a95d4aeSRobert Elliott select CRYPTO_ARCH_HAVE_LIB_BLAKE2S 634a95d4aeSRobert Elliott help 643f342a23SRobert Elliott BLAKE2s cryptographic hash function (RFC 7693) 653f342a23SRobert Elliott 663f342a23SRobert Elliott Architecture: arm 673f342a23SRobert Elliott 683f342a23SRobert Elliott This is faster than the generic implementations of BLAKE2s and 693f342a23SRobert Elliott BLAKE2b, but slower than the NEON implementation of BLAKE2b. 703f342a23SRobert Elliott There is no NEON implementation of BLAKE2s, since NEON doesn't 713f342a23SRobert Elliott really help with it. 724a95d4aeSRobert Elliott 734a95d4aeSRobert Elliottconfig CRYPTO_BLAKE2B_NEON 743f342a23SRobert Elliott tristate "Hash functions: BLAKE2b (NEON)" 754a95d4aeSRobert Elliott depends on KERNEL_MODE_NEON 764a95d4aeSRobert Elliott select CRYPTO_BLAKE2B 774a95d4aeSRobert Elliott help 783f342a23SRobert Elliott BLAKE2b cryptographic hash function (RFC 7693) 793f342a23SRobert Elliott 803f342a23SRobert Elliott Architecture: arm using 813f342a23SRobert Elliott - NEON (Advanced SIMD) extensions 823f342a23SRobert Elliott 834a95d4aeSRobert Elliott BLAKE2b digest algorithm optimized with ARM NEON instructions. 844a95d4aeSRobert Elliott On ARM processors that have NEON support but not the ARMv8 854a95d4aeSRobert Elliott Crypto Extensions, typically this BLAKE2b implementation is 863f342a23SRobert Elliott much faster than the SHA-2 family and slightly faster than 873f342a23SRobert Elliott SHA-1. 884a95d4aeSRobert Elliott 89652ccae5SArd Biesheuvelconfig CRYPTO_SHA1_ARM 903f342a23SRobert Elliott tristate "Hash functions: SHA-1" 91652ccae5SArd Biesheuvel select CRYPTO_SHA1 92652ccae5SArd Biesheuvel select CRYPTO_HASH 93652ccae5SArd Biesheuvel help 943f342a23SRobert Elliott SHA-1 secure hash algorithm (FIPS 180) 953f342a23SRobert Elliott 963f342a23SRobert Elliott Architecture: arm 97652ccae5SArd Biesheuvel 98652ccae5SArd Biesheuvelconfig CRYPTO_SHA1_ARM_NEON 993f342a23SRobert Elliott tristate "Hash functions: SHA-1 (NEON)" 100652ccae5SArd Biesheuvel depends on KERNEL_MODE_NEON 101652ccae5SArd Biesheuvel select CRYPTO_SHA1_ARM 102652ccae5SArd Biesheuvel select CRYPTO_SHA1 103652ccae5SArd Biesheuvel select CRYPTO_HASH 104652ccae5SArd Biesheuvel help 1053f342a23SRobert Elliott SHA-1 secure hash algorithm (FIPS 180) 1063f342a23SRobert Elliott 1073f342a23SRobert Elliott Architecture: arm using 1083f342a23SRobert Elliott - NEON (Advanced SIMD) extensions 109652ccae5SArd Biesheuvel 110864cbeedSArd Biesheuvelconfig CRYPTO_SHA1_ARM_CE 1113f342a23SRobert Elliott tristate "Hash functions: SHA-1 (ARMv8 Crypto Extensions)" 1125429ef62SWill Deacon depends on KERNEL_MODE_NEON 113864cbeedSArd Biesheuvel select CRYPTO_SHA1_ARM 114864cbeedSArd Biesheuvel select CRYPTO_HASH 115864cbeedSArd Biesheuvel help 1163f342a23SRobert Elliott SHA-1 secure hash algorithm (FIPS 180) 1173f342a23SRobert Elliott 1183f342a23SRobert Elliott Architecture: arm using ARMv8 Crypto Extensions 119864cbeedSArd Biesheuvel 120006d0624SArd Biesheuvelconfig CRYPTO_SHA2_ARM_CE 1213f342a23SRobert Elliott tristate "Hash functions: SHA-224 and SHA-256 (ARMv8 Crypto Extensions)" 1225429ef62SWill Deacon depends on KERNEL_MODE_NEON 1239205b949SArd Biesheuvel select CRYPTO_SHA256_ARM 124006d0624SArd Biesheuvel select CRYPTO_HASH 125006d0624SArd Biesheuvel help 1263f342a23SRobert Elliott SHA-224 and SHA-256 secure hash algorithms (FIPS 180) 1273f342a23SRobert Elliott 1283f342a23SRobert Elliott Architecture: arm using 1293f342a23SRobert Elliott - ARMv8 Crypto Extensions 130006d0624SArd Biesheuvel 131f2f770d7SSami Tolvanenconfig CRYPTO_SHA256_ARM 1323f342a23SRobert Elliott tristate "Hash functions: SHA-224 and SHA-256 (NEON)" 133f2f770d7SSami Tolvanen select CRYPTO_HASH 134b48321deSArnd Bergmann depends on !CPU_V7M 135f2f770d7SSami Tolvanen help 1363f342a23SRobert Elliott SHA-224 and SHA-256 secure hash algorithms (FIPS 180) 1373f342a23SRobert Elliott 1383f342a23SRobert Elliott Architecture: arm using 1393f342a23SRobert Elliott - NEON (Advanced SIMD) extensions 140f2f770d7SSami Tolvanen 141c80ae7caSArd Biesheuvelconfig CRYPTO_SHA512_ARM 1423f342a23SRobert Elliott tristate "Hash functions: SHA-384 and SHA-512 (NEON)" 143652ccae5SArd Biesheuvel select CRYPTO_HASH 144c80ae7caSArd Biesheuvel depends on !CPU_V7M 145652ccae5SArd Biesheuvel help 1463f342a23SRobert Elliott SHA-384 and SHA-512 secure hash algorithms (FIPS 180) 1473f342a23SRobert Elliott 1483f342a23SRobert Elliott Architecture: arm using 1493f342a23SRobert Elliott - NEON (Advanced SIMD) extensions 150652ccae5SArd Biesheuvel 151652ccae5SArd Biesheuvelconfig CRYPTO_AES_ARM 152cf514b2aSRobert Elliott tristate "Ciphers: AES" 153652ccae5SArd Biesheuvel select CRYPTO_ALGAPI 154652ccae5SArd Biesheuvel select CRYPTO_AES 155652ccae5SArd Biesheuvel help 156cf514b2aSRobert Elliott Block ciphers: AES cipher algorithms (FIPS-197) 157cf514b2aSRobert Elliott 158cf514b2aSRobert Elliott Architecture: arm 159652ccae5SArd Biesheuvel 160913a3aa0SEric Biggers On ARM processors without the Crypto Extensions, this is the 161913a3aa0SEric Biggers fastest AES implementation for single blocks. For multiple 162913a3aa0SEric Biggers blocks, the NEON bit-sliced implementation is usually faster. 163913a3aa0SEric Biggers 164913a3aa0SEric Biggers This implementation may be vulnerable to cache timing attacks, 165913a3aa0SEric Biggers since it uses lookup tables. However, as countermeasures it 166913a3aa0SEric Biggers disables IRQs and preloads the tables; it is hoped this makes 167913a3aa0SEric Biggers such attacks very difficult. 168913a3aa0SEric Biggers 169652ccae5SArd Biesheuvelconfig CRYPTO_AES_ARM_BS 170cf514b2aSRobert Elliott tristate "Ciphers: AES, modes: ECB/CBC/CTR/XTS (bit-sliced NEON)" 171652ccae5SArd Biesheuvel depends on KERNEL_MODE_NEON 172f235bc11SEric Biggers select CRYPTO_AES_ARM 173b95bba5dSEric Biggers select CRYPTO_SKCIPHER 174aa6e2d2bSArd Biesheuvel select CRYPTO_LIB_AES 1756fdf436fSHerbert Xu select CRYPTO_SIMD 176652ccae5SArd Biesheuvel help 177cf514b2aSRobert Elliott Length-preserving ciphers: AES cipher algorithms (FIPS-197) 178cf514b2aSRobert Elliott with block cipher modes: 179cf514b2aSRobert Elliott - ECB (Electronic Codebook) mode (NIST SP800-38A) 180cf514b2aSRobert Elliott - CBC (Cipher Block Chaining) mode (NIST SP800-38A) 181cf514b2aSRobert Elliott - CTR (Counter) mode (NIST SP800-38A) 182cf514b2aSRobert Elliott - XTS (XOR Encrypt XOR with ciphertext stealing) mode (NIST SP800-38E 183cf514b2aSRobert Elliott and IEEE 1619) 184652ccae5SArd Biesheuvel 185652ccae5SArd Biesheuvel Bit sliced AES gives around 45% speedup on Cortex-A15 for CTR mode 186652ccae5SArd Biesheuvel and for XTS mode encryption, CBC and XTS mode decryption speedup is 187652ccae5SArd Biesheuvel around 25%. (CBC encryption speed is not affected by this driver.) 188f235bc11SEric Biggers 189f235bc11SEric Biggers The bit sliced AES code does not use lookup tables, so it is believed 190f235bc11SEric Biggers to be invulnerable to cache timing attacks. However, since the bit 191f235bc11SEric Biggers sliced AES code cannot process single blocks efficiently, in certain 192f235bc11SEric Biggers cases table-based code with some countermeasures against cache timing 193f235bc11SEric Biggers attacks will still be used as a fallback method; specifically CBC 194f235bc11SEric Biggers encryption (not CBC decryption), the encryption of XTS tweaks, XTS 195f235bc11SEric Biggers ciphertext stealing when the message isn't a multiple of 16 bytes, and 196f235bc11SEric Biggers CTR when invoked in a context in which NEON instructions are unusable. 197652ccae5SArd Biesheuvel 19886464859SArd Biesheuvelconfig CRYPTO_AES_ARM_CE 199cf514b2aSRobert Elliott tristate "Ciphers: AES, modes: ECB/CBC/CTS/CTR/XTS (ARMv8 Crypto Extensions)" 2005429ef62SWill Deacon depends on KERNEL_MODE_NEON 201b95bba5dSEric Biggers select CRYPTO_SKCIPHER 202f703964fSArd Biesheuvel select CRYPTO_LIB_AES 203585b5fa6SHerbert Xu select CRYPTO_SIMD 20486464859SArd Biesheuvel help 205cf514b2aSRobert Elliott Length-preserving ciphers: AES cipher algorithms (FIPS-197) 206cf514b2aSRobert Elliott with block cipher modes: 207cf514b2aSRobert Elliott - ECB (Electronic Codebook) mode (NIST SP800-38A) 208cf514b2aSRobert Elliott - CBC (Cipher Block Chaining) mode (NIST SP800-38A) 209cf514b2aSRobert Elliott - CTR (Counter) mode (NIST SP800-38A) 210cf514b2aSRobert Elliott - CTS (Cipher Text Stealing) mode (NIST SP800-38A) 211cf514b2aSRobert Elliott - XTS (XOR Encrypt XOR with ciphertext stealing) mode (NIST SP800-38E 212cf514b2aSRobert Elliott and IEEE 1619) 213cf514b2aSRobert Elliott 214cf514b2aSRobert Elliott Architecture: arm using: 215cf514b2aSRobert Elliott - ARMv8 Crypto Extensions 21686464859SArd Biesheuvel 2174a95d4aeSRobert Elliottconfig CRYPTO_CHACHA20_NEON 218*17ec3e71SHerbert Xu tristate 2194a95d4aeSRobert Elliott select CRYPTO_SKCIPHER 220*17ec3e71SHerbert Xu select CRYPTO_ARCH_HAVE_LIB_CHACHA 221*17ec3e71SHerbert Xu default CRYPTO_LIB_CHACHA_INTERNAL 222cf514b2aSRobert Elliott help 223cf514b2aSRobert Elliott Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 224cf514b2aSRobert Elliott stream cipher algorithms 225cf514b2aSRobert Elliott 226cf514b2aSRobert Elliott Architecture: arm using: 227cf514b2aSRobert Elliott - NEON (Advanced SIMD) extensions 2281d481f1cSArd Biesheuvel 2294a329fecSRobert Elliottendmenu 2304a95d4aeSRobert Elliott 231