Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: ahash - Stop legacy tfms from using the set_virt fallback path

Ensure that drivers that have not been converted to the ahash API
do not use the ahash_request_set_virt fallback path as they cannot
use the software fallback.

Reported-by: Eric Biggers <ebiggers@kernel.org>
Fixes: 9d7a0ab1c753 ("crypto: ahash - Handle partial blocks in API")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+9
+3
crypto/ahash.c
··· 350 350 if (!crypto_ahash_need_fallback(tfm)) 351 351 return -ENOSYS; 352 352 353 + if (crypto_hash_no_export_core(tfm)) 354 + return -ENOSYS; 355 + 353 356 { 354 357 u8 state[HASH_MAX_STATESIZE]; 355 358
+6
include/crypto/internal/hash.h
··· 91 91 !(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY); 92 92 } 93 93 94 + static inline bool crypto_hash_no_export_core(struct crypto_ahash *tfm) 95 + { 96 + return crypto_hash_alg_common(tfm)->base.cra_flags & 97 + CRYPTO_AHASH_ALG_NO_EXPORT_CORE; 98 + } 99 + 94 100 int crypto_grab_ahash(struct crypto_ahash_spawn *spawn, 95 101 struct crypto_instance *inst, 96 102 const char *name, u32 type, u32 mask);