summaryrefslogtreecommitdiff
path: root/include/crypto/internal/acompress.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2025-04-23 17:22:28 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2025-04-28 19:40:54 +0800
commit19da081a28c95fe9b03ce952a2bf4a6f6bf5112c (patch)
tree224f4fc987087caa04437c1c10b26256cb7b245d /include/crypto/internal/acompress.h
parentaf9ce62783dd6acd595491badec08f1235c84739 (diff)
crypto: api - Add crypto_request_clone and fb
Add a helper to clone crypto requests and eliminate code duplication. Use kmemdup in the helper. Also add an fb field to crypto_tfm. This also happens to fix the existing implementations which were buggy. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202504230118.1CxUaUoX-lkp@intel.com/ Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202504230004.c7mrY0C6-lkp@intel.com/ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal/acompress.h')
-rw-r--r--include/crypto/internal/acompress.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/crypto/internal/acompress.h b/include/crypto/internal/acompress.h
index 7eda32619024..6550dad18e0f 100644
--- a/include/crypto/internal/acompress.h
+++ b/include/crypto/internal/acompress.h
@@ -220,13 +220,18 @@ static inline u32 acomp_request_flags(struct acomp_req *req)
return crypto_request_flags(&req->base) & ~CRYPTO_ACOMP_REQ_PRIVATE;
}
+static inline struct crypto_acomp *crypto_acomp_fb(struct crypto_acomp *tfm)
+{
+ return __crypto_acomp_tfm(crypto_acomp_tfm(tfm)->fb);
+}
+
static inline struct acomp_req *acomp_fbreq_on_stack_init(
char *buf, struct acomp_req *old)
{
struct crypto_acomp *tfm = crypto_acomp_reqtfm(old);
struct acomp_req *req = (void *)buf;
- acomp_request_set_tfm(req, tfm->fb);
+ acomp_request_set_tfm(req, crypto_acomp_fb(tfm));
req->base.flags = CRYPTO_TFM_REQ_ON_STACK;
acomp_request_set_callback(req, acomp_request_flags(old), NULL, NULL);
req->base.flags &= ~CRYPTO_ACOMP_REQ_PRIVATE;