android_kernel_samsung_msm8976/arch/x86/crypto
Eric Biggers 79bd202987 crypto: hash - annotate algorithms taking optional key
commit a208fa8f33031b9e0aba44c7d1b7e68eb0cbd29e upstream.

We need to consistently enforce that keyed hashes cannot be used without
setting the key.  To do this we need a reliable way to determine whether
a given hash algorithm is keyed or not.  AF_ALG currently does this by
checking for the presence of a ->setkey() method.  However, this is
actually slightly broken because the CRC-32 algorithms implement
->setkey() but can also be used without a key.  (The CRC-32 "key" is not
actually a cryptographic key but rather represents the initial state.
If not overridden, then a default initial state is used.)

Prepare to fix this by introducing a flag CRYPTO_ALG_OPTIONAL_KEY which
indicates that the algorithm has a ->setkey() method, but it is not
required to be called.  Then set it on all the CRC-32 algorithms.

The same also applies to the Adler-32 implementation in Lustre.

Also, the cryptd and mcryptd templates have to pass through the flag
from their underlying algorithm.

Change-Id: Ie0547047b828f276d967e8979cd9176e57c99ac8
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[bwh: Backported to 3.2:
 - Drop changes to nonexistent drivers
 - There's no CRYPTO_ALG_INTERNAL flag
 - Adjust filenames]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2019-07-27 21:49:17 +02:00
..
Makefile crypto: camellia - add AVX2/AES-NI/x86_64 assembler implementation of camellia cipher 2013-04-25 21:09:07 +08:00
ablk_helper.c
aes-i586-asm_32.S crypto: x86/aes - assembler clean-ups: use ENTRY/ENDPROC, localize jump targets 2013-01-20 10:16:47 +11:00
aes-x86_64-asm_64.S crypto: x86/aes - assembler clean-ups: use ENTRY/ENDPROC, localize jump targets 2013-01-20 10:16:47 +11:00
aes_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
aesni-intel_asm.S crypto: aesni_intel - fix accessing of unaligned memory 2013-06-13 14:57:42 +08:00
aesni-intel_glue.c crypto: aesni - fix memory usage in GCM decryption 2015-03-26 15:01:00 +01:00
blowfish-avx2-asm_64.S crypto: blowfish - add AVX2/x86_64 implementation of blowfish cipher 2013-04-25 21:09:04 +08:00
blowfish-x86_64-asm_64.S crypto: blowfish-x86_64: use ENTRY()/ENDPROC() for assembler functions and localize jump targets 2013-01-20 10:16:48 +11:00
blowfish_avx2_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
blowfish_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
camellia-aesni-avx-asm_64.S crypto: x86/camellia-aesni-avx - add more optimized XTS code 2013-04-25 21:01:52 +08:00
camellia-aesni-avx2-asm_64.S crypto: camellia - add AVX2/AES-NI/x86_64 assembler implementation of camellia cipher 2013-04-25 21:09:07 +08:00
camellia-x86_64-asm_64.S crypto: camellia-x86_64/aes-ni: use ENTRY()/ENDPROC() for assembler functions and localize jump targets 2013-01-20 10:16:48 +11:00
camellia_aesni_avx2_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
camellia_aesni_avx_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
camellia_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
cast5-avx-x86_64-asm_64.S crypto: cast5-avx: use ENTRY()/ENDPROC() for assembler functions and localize jump targets 2013-01-20 10:16:48 +11:00
cast5_avx_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
cast6-avx-x86_64-asm_64.S crypto: cast6-avx: use new optimized XTS code 2013-04-25 21:01:52 +08:00
cast6_avx_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
crc32-pclmul_asm.S x86, crc32-pclmul: Fix build with older binutils 2013-05-30 16:36:23 -07:00
crc32-pclmul_glue.c crypto: hash - annotate algorithms taking optional key 2019-07-27 21:49:17 +02:00
crc32c-intel_glue.c crypto: hash - annotate algorithms taking optional key 2019-07-27 21:49:17 +02:00
crc32c-pcl-intel-asm_64.S crypto: crc32-pclmul - Use gas macro for pclmulqdq 2013-04-25 21:01:44 +08:00
fpu.c crypto: include crypto- module prefix in template 2015-01-29 17:40:57 -08:00
ghash-clmulni-intel_asm.S crypto: ghash-clmulni-intel - use C implementation for setkey() 2014-04-14 06:42:19 -07:00
ghash-clmulni-intel_glue.c crypto: ghash-clmulni - Fix load failure 2019-07-27 21:44:03 +02:00
glue_helper-asm-avx.S crypto: x86 - add more optimized XTS-mode for serpent-avx 2013-04-25 21:01:51 +08:00
glue_helper-asm-avx2.S crypto: twofish - add AVX2/x86_64 assembler implementation of twofish cipher 2013-04-25 21:09:05 +08:00
glue_helper.c crypto: x86 - add more optimized XTS-mode for serpent-avx 2013-04-25 21:01:51 +08:00
salsa20-i586-asm_32.S crypto: x86/salsa20 - assembler cleanup, use ENTRY/ENDPROC for assember functions and rename ECRYPT_* to salsa20_* 2013-01-20 10:16:50 +11:00
salsa20-x86_64-asm_64.S crypto: x86/salsa20 - assembler cleanup, use ENTRY/ENDPROC for assember functions and rename ECRYPT_* to salsa20_* 2013-01-20 10:16:50 +11:00
salsa20_glue.c crypto: salsa20 - fix blkcipher_walk API usage 2019-07-27 21:45:46 +02:00
serpent-avx-x86_64-asm_64.S crypto: x86 - add more optimized XTS-mode for serpent-avx 2013-04-25 21:01:51 +08:00
serpent-avx2-asm_64.S crypto: serpent - add AVX2/x86_64 assembler implementation of serpent cipher 2013-04-25 21:09:07 +08:00
serpent-sse2-i586-asm_32.S crypto: x86/serpent - use ENTRY/ENDPROC for assember functions and localize jump targets 2013-01-20 10:16:50 +11:00
serpent-sse2-x86_64-asm_64.S crypto: x86/serpent - use ENTRY/ENDPROC for assember functions and localize jump targets 2013-01-20 10:16:50 +11:00
serpent_avx2_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
serpent_avx_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
serpent_sse2_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
sha1_ssse3_asm.S crypto: x86/sha1 - assembler clean-ups: use ENTRY/ENDPROC 2013-01-20 10:16:51 +11:00
sha1_ssse3_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
sha256-avx-asm.S crypto: sha256_ssse3 - fix stack corruption with SSSE3 and AVX implementations 2013-05-28 13:46:47 +08:00
sha256-avx2-asm.S crypto: sha256 - Optimized sha256 x86_64 routine using AVX2's RORX instructions 2013-04-03 09:06:32 +08:00
sha256-ssse3-asm.S crypto: sha256_ssse3 - fix stack corruption with SSSE3 and AVX implementations 2013-05-28 13:46:47 +08:00
sha256_ssse3_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
sha512-avx-asm.S crypto: sha512 - Optimized SHA512 x86_64 assembly routine using AVX instructions. 2013-04-25 21:00:58 +08:00
sha512-avx2-asm.S crypto: sha512 - Optimized SHA512 x86_64 assembly routine using AVX2 RORX instruction. 2013-04-25 21:00:58 +08:00
sha512-ssse3-asm.S crypto: sha512 - Optimized SHA512 x86_64 assembly routine using Supplemental SSE3 instructions. 2013-04-25 21:00:58 +08:00
sha512_ssse3_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
twofish-avx-x86_64-asm_64.S crypto: x86/twofish-avx - use optimized XTS code 2013-04-25 21:01:51 +08:00
twofish-avx2-asm_64.S crypto: twofish - add AVX2/x86_64 assembler implementation of twofish cipher 2013-04-25 21:09:05 +08:00
twofish-i586-asm_32.S crypto: x86/twofish - assembler clean-ups: use ENTRY/ENDPROC, localize jump labels 2013-01-20 10:16:51 +11:00
twofish-x86_64-asm_64-3way.S crypto: x86/twofish - assembler clean-ups: use ENTRY/ENDPROC, localize jump labels 2013-01-20 10:16:51 +11:00
twofish-x86_64-asm_64.S crypto: x86/twofish - assembler clean-ups: use ENTRY/ENDPROC, localize jump labels 2013-01-20 10:16:51 +11:00
twofish_avx2_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
twofish_avx_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
twofish_glue.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00
twofish_glue_3way.c crypto: prefix module autoloading with "crypto-" 2015-01-29 17:40:57 -08:00