This patch makes cryptd pass along the CRYPTO_TFM_REQ_MORE flag to its child skcipher as well as inheriting the final chunk size from it. Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> --- crypto/cryptd.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crypto/cryptd.c b/crypto/cryptd.c index a1bea0f4baa88..510c23b320082 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c @@ -261,13 +261,16 @@ static void cryptd_skcipher_encrypt(struct crypto_async_request *base, struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); struct crypto_sync_skcipher *child = ctx->child; SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, child); + unsigned int flags = req->base.flags; if (unlikely(err == -EINPROGRESS)) goto out; + flags &= CRYPTO_TFM_REQ_MORE; + flags |= CRYPTO_TFM_REQ_MAY_SLEEP; + skcipher_request_set_sync_tfm(subreq, child); - skcipher_request_set_callback(subreq, CRYPTO_TFM_REQ_MAY_SLEEP, - NULL, NULL); + skcipher_request_set_callback(subreq, flags, NULL, NULL); skcipher_request_set_crypt(subreq, req->src, req->dst, req->cryptlen, req->iv); @@ -289,13 +292,16 @@ static void cryptd_skcipher_decrypt(struct crypto_async_request *base, struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); struct crypto_sync_skcipher *child = ctx->child; SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, child); + unsigned int flags = req->base.flags; if (unlikely(err == -EINPROGRESS)) goto out; + flags &= CRYPTO_TFM_REQ_MORE; + flags |= CRYPTO_TFM_REQ_MAY_SLEEP; + skcipher_request_set_sync_tfm(subreq, child); - skcipher_request_set_callback(subreq, CRYPTO_TFM_REQ_MAY_SLEEP, - NULL, NULL); + skcipher_request_set_callback(subreq, flags, NULL, NULL); skcipher_request_set_crypt(subreq, req->src, req->dst, req->cryptlen, req->iv); @@ -400,6 +406,7 @@ static int cryptd_create_skcipher(struct crypto_template *tmpl, (alg->base.cra_flags & CRYPTO_ALG_INTERNAL); inst->alg.ivsize = crypto_skcipher_alg_ivsize(alg); inst->alg.chunksize = crypto_skcipher_alg_chunksize(alg); + inst->alg.final_chunksize = crypto_skcipher_alg_final_chunksize(alg); inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(alg); inst->alg.max_keysize = crypto_skcipher_alg_max_keysize(alg);