crypto: hash - Fix clone error handling

Do not copy the exit function in crypto_clone_tfm as it should
only be set after init_tfm or clone_tfm has succeeded.

Move the setting into crypto_clone_ahash and crypto_clone_shash
instead.

Also clone the fb if necessary.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Herbert Xu
2025-04-23 17:22:31 +08:00
parent 19da081a28
commit 2cfe41630a
3 changed files with 21 additions and 3 deletions

View File

@@ -570,7 +570,7 @@ void *crypto_clone_tfm(const struct crypto_type *frontend,
tfm = (struct crypto_tfm *)(mem + frontend->tfmsize);
tfm->crt_flags = otfm->crt_flags;
tfm->exit = otfm->exit;
tfm->fb = tfm;
out:
return mem;