kernel_optimize_test/crypto
Herbert Xu 2bbb3375d9 crypto: api - fix unexpectedly getting generic implementation
When CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y, the first lookup of an
algorithm that needs to be instantiated using a template will always get
the generic implementation, even when an accelerated one is available.

This happens because the extra self-tests for the accelerated
implementation allocate the generic implementation for comparison
purposes, and then crypto_alg_tested() for the generic implementation
"fulfills" the original request (i.e. sets crypto_larval::adult).

This patch fixes this by only fulfilling the original request if
we are currently the best outstanding larval as judged by the
priority.  If we're not the best then we will ask all waiters on
that larval request to retry the lookup.

Note that this patch introduces a behaviour change when the module
providing the new algorithm is unregistered during the process.
Previously we would have failed with ENOENT, after the patch we
will instead redo the lookup.

Fixes: 9a8a6b3f09 ("crypto: testmgr - fuzz hashes against...")
Fixes: d435e10e67 ("crypto: testmgr - fuzz skciphers against...")
Fixes: 40153b10d9 ("crypto: testmgr - fuzz AEADs against...")
Reported-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2019-12-20 14:58:33 +08:00
..
asymmetric_keys KEYS: trusted: Create trusted keys subsystem 2019-11-12 21:45:37 +02:00
async_tx
842.c
acompress.c
adiantum.c crypto: poly1305 - move core routines into a separate library 2019-11-17 09:02:41 +08:00
aead.c crypto: aead - Split out geniv into its own module 2019-11-17 09:02:38 +08:00
aegis.h
aegis128-core.c
aegis128-neon-inner.c
aegis128-neon.c
aes_generic.c
aes_ti.c
af_alg.c crypto: af_alg - Use bh_lock_sock in sk_destruct 2019-12-11 16:37:02 +08:00
ahash.c
akcipher.c
algapi.c crypto: api - fix unexpectedly getting generic implementation 2019-12-20 14:58:33 +08:00
algboss.c
algif_aead.c
algif_hash.c
algif_rng.c
algif_skcipher.c
ansi_cprng.c
anubis.c
api.c crypto: api - fix unexpectedly getting generic implementation 2019-12-20 14:58:33 +08:00
arc4.c
authenc.c
authencesn.c
blake2b_generic.c crypto: blake2b - rename tfm context and _setkey callback 2019-11-22 18:48:35 +08:00
blake2s_generic.c crypto: blake2s - implement generic shash driver 2019-11-17 09:02:42 +08:00
blowfish_common.c
blowfish_generic.c
camellia_generic.c
cast_common.c
cast5_generic.c
cast6_generic.c crypto: x86 - Regularize glue function prototypes 2019-12-11 16:36:54 +08:00
cbc.c
ccm.c
cfb.c
chacha_generic.c crypto: chacha_generic - remove unnecessary setkey() functions 2019-11-22 18:48:39 +08:00
chacha20poly1305.c
cipher.c crypto: cipher - remove crt_u.cipher (struct cipher_tfm) 2019-12-11 16:37:01 +08:00
cmac.c
compress.c crypto: compress - remove crt_u.compress (struct compress_tfm) 2019-12-11 16:37:01 +08:00
crc32_generic.c
crc32c_generic.c
crct10dif_common.c
crct10dif_generic.c
cryptd.c crypto: skcipher - remove the "blkcipher" algorithm type 2019-11-01 13:38:32 +08:00
crypto_engine.c crypto: ablkcipher - remove deprecated and unused ablkcipher support 2019-11-17 09:02:49 +08:00
crypto_null.c
crypto_user_base.c
crypto_user_stat.c crypto: skcipher - remove the "blkcipher" algorithm type 2019-11-01 13:38:32 +08:00
ctr.c
cts.c
curve25519-generic.c crypto: curve25519 - implement generic KPP driver 2019-11-17 09:02:43 +08:00
deflate.c
des_generic.c
dh_helper.c
dh.c
drbg.c
ecb.c
ecc_curve_defs.h
ecc.c int128: move __uint128_t compiler test to Kconfig 2019-11-17 09:02:42 +08:00
ecc.h
ecdh_helper.c
ecdh.c
echainiv.c
ecrdsa_defs.h
ecrdsa_params.asn1
ecrdsa_pub_key.asn1
ecrdsa.c
essiv.c crypto: shash - allow essiv and hmac to use OPTIONAL_KEY algorithms 2019-12-11 16:36:57 +08:00
fcrypt.c
fips.c
gcm.c
geniv.c crypto: aead - Split out geniv into its own module 2019-11-17 09:02:38 +08:00
gf128mul.c
ghash-generic.c
hash_info.c
hmac.c crypto: hmac - Use init_tfm/exit_tfm interface 2019-12-11 16:48:39 +08:00
internal.h crypto: api - Fix race condition in crypto_spawn_alg 2019-12-11 16:48:38 +08:00
jitterentropy-kcapi.c
jitterentropy.c
jitterentropy.h
Kconfig crypto: mips/chacha - select CRYPTO_SKCIPHER, not CRYPTO_BLKCIPHER 2019-11-22 18:48:38 +08:00
keywrap.c
khazad.c
kpp.c
lrw.c
lz4.c
lz4hc.c
lzo-rle.c
lzo.c
Makefile crypto: ablkcipher - remove deprecated and unused ablkcipher support 2019-11-17 09:02:49 +08:00
md4.c
md5.c
memneq.c
michael_mic.c
nhpoly1305.c crypto: poly1305 - move core routines into a separate library 2019-11-17 09:02:41 +08:00
ofb.c
pcbc.c
pcrypt.c padata: remove cpumask change notifier 2019-12-11 16:37:02 +08:00
poly1305_generic.c crypto: x86/poly1305 - depend on generic library not generic shash 2019-11-17 09:02:41 +08:00
proc.c
ripemd.h
rmd128.c
rmd160.c
rmd256.c
rmd320.c
rng.c
rsa_helper.c
rsa-pkcs1pad.c
rsa.c
rsaprivkey.asn1
rsapubkey.asn1
salsa20_generic.c
scatterwalk.c
scompress.c
seed.c
seqiv.c
serpent_generic.c crypto: x86 - Regularize glue function prototypes 2019-12-11 16:36:54 +08:00
sha1_generic.c
sha3_generic.c
sha256_generic.c
sha512_generic.c
shash.c crypto: shash - Add init_tfm/exit_tfm and verify descsize 2019-12-11 16:48:39 +08:00
simd.c
skcipher.c crypto: skcipher - remove crypto_skcipher_extsize() 2019-12-11 16:36:56 +08:00
sm3_generic.c
sm4_generic.c
streebog_generic.c
tcrypt.c crypto: tcrypt - constify check alg list 2019-11-17 09:02:44 +08:00
tcrypt.h
tea.c
testmgr.c crypto: testmgr - generate inauthentic AEAD test vectors 2019-12-11 16:37:01 +08:00
testmgr.h crypto: testmgr - generate inauthentic AEAD test vectors 2019-12-11 16:37:01 +08:00
tgr192.c crypto: tgr192 - remove unneeded semicolon 2019-11-15 13:44:17 +08:00
twofish_common.c
twofish_generic.c
vmac.c
wp512.c
xcbc.c
xor.c
xts.c
xxhash_generic.c
zstd.c