summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorWesley Atwell <atwellwea@gmail.com>2026-03-09 00:26:24 -0600
committerHerbert Xu <herbert@gondor.apana.org.au>2026-03-21 17:34:30 +0900
commit2ef3bac16fb5e9eee4fb1d722578a79b751ea58a (patch)
treeb04207294f275cb4cddc27cd740262df403f7530 /crypto
parente0ce97f781c78b717b00493630a9e34caf04f79b (diff)
downloadlwn-2ef3bac16fb5e9eee4fb1d722578a79b751ea58a.tar.gz
lwn-2ef3bac16fb5e9eee4fb1d722578a79b751ea58a.zip
crypto: krb5enc - fix sleepable flag handling in encrypt dispatch
krb5enc_encrypt_ahash_done() continues encryption from an ahash completion callback by calling krb5enc_dispatch_encrypt(). That helper takes a flags argument for this continuation path, but it ignored that argument and reused aead_request_flags(req) when setting up the skcipher subrequest callback. This can incorrectly preserve CRYPTO_TFM_REQ_MAY_SLEEP when the encrypt step is started from callback context. Preserve the original request flags but clear CRYPTO_TFM_REQ_MAY_SLEEP for the callback continuation path, and use the caller-supplied flags when setting up the skcipher subrequest. Fixes: d1775a177f7f ("crypto: Add 'krb5enc' hash and cipher AEAD algorithm") Assisted-by: Codex:GPT-5 Signed-off-by: Wesley Atwell <atwellwea@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/krb5enc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/krb5enc.c b/crypto/krb5enc.c
index a1de55994d92..1bfe8370cf94 100644
--- a/crypto/krb5enc.c
+++ b/crypto/krb5enc.c
@@ -154,7 +154,7 @@ static int krb5enc_dispatch_encrypt(struct aead_request *req,
dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen);
skcipher_request_set_tfm(skreq, enc);
- skcipher_request_set_callback(skreq, aead_request_flags(req),
+ skcipher_request_set_callback(skreq, flags,
krb5enc_encrypt_done, req);
skcipher_request_set_crypt(skreq, src, dst, req->cryptlen, req->iv);
@@ -192,7 +192,8 @@ static void krb5enc_encrypt_ahash_done(void *data, int err)
krb5enc_insert_checksum(req, ahreq->result);
- err = krb5enc_dispatch_encrypt(req, 0);
+ err = krb5enc_dispatch_encrypt(req,
+ aead_request_flags(req) & ~CRYPTO_TFM_REQ_MAY_SLEEP);
if (err != -EINPROGRESS)
aead_request_complete(req, err);
}