From: Herbert Xu herbert@gondor.apana.org.au
mainline inclusion from mainline-v5.5-rc1 commit 5b0fe9552336338acb52756daf65dd7a4eeca73f category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I6F049 CVE: NA
--------------------------------
When algif_skcipher does a partial operation it always process data that is a multiple of blocksize. However, for algorithms such as CTR this is wrong because even though it can process any number of bytes overall, the partial block must come at the very end and not in the middle.
This is exactly what chunksize is meant to describe so this patch changes blocksize to chunksize.
Fixes: 8ff590903d5f ("crypto: algif_skcipher - User-space...") Signed-off-by: Herbert Xu herbert@gondor.apana.org.au Acked-by: Ard Biesheuvel ard.biesheuvel@linaro.org Signed-off-by: Herbert Xu herbert@gondor.apana.org.au Conflicts: include/crypto/internal/skcipher.h include/crypto/skcipher.h Signed-off-by: Lu Jialin lujialin4@huawei.com Reviewed-by: Wang Weiyang wangweiyang2@huawei.com Reviewed-by: guozihua guozihua@huawei.com Signed-off-by: Yongqiang Liu liuyongqiang13@huawei.com --- crypto/algif_skcipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c index 4529ed2478bf..fe1f6b0f7c4c 100644 --- a/crypto/algif_skcipher.c +++ b/crypto/algif_skcipher.c @@ -60,7 +60,7 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg, struct alg_sock *pask = alg_sk(psk); struct af_alg_ctx *ctx = ask->private; struct crypto_skcipher *tfm = pask->private; - unsigned int bs = crypto_skcipher_blocksize(tfm); + unsigned int bs = crypto_skcipher_chunksize(tfm); struct af_alg_async_req *areq; int err = 0; size_t len = 0;