Skip to content

Commit 8323c03

Browse files
jiajiehoherbertx
authored andcommitted
crypto: starfive - Fix nent assignment in rsa dec
Missing src scatterlist nent assignment in rsa decrypt function. Removing all unneeded assignment and use nents value from req->src instead. Signed-off-by: Jia Jie Ho <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 6aad701 commit 8323c03

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

drivers/crypto/starfive/jh7110-cryp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ struct starfive_cryp_request_ctx {
218218
struct scatterlist *out_sg;
219219
struct ahash_request ahash_fbk_req;
220220
size_t total;
221-
size_t nents;
222221
unsigned int blksize;
223222
unsigned int digsize;
224223
unsigned long in_sg_len;

drivers/crypto/starfive/jh7110-rsa.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static int starfive_rsa_enc_core(struct starfive_cryp_ctx *ctx, int enc)
259259
memset(rctx->rsa_data, 0, shift);
260260
}
261261

262-
rctx->total = sg_copy_to_buffer(rctx->in_sg, rctx->nents,
262+
rctx->total = sg_copy_to_buffer(rctx->in_sg, sg_nents(rctx->in_sg),
263263
rctx->rsa_data + shift, rctx->total);
264264

265265
if (enc) {
@@ -309,7 +309,6 @@ static int starfive_rsa_enc(struct akcipher_request *req)
309309
rctx->in_sg = req->src;
310310
rctx->out_sg = req->dst;
311311
rctx->total = req->src_len;
312-
rctx->nents = sg_nents(rctx->in_sg);
313312
ctx->rctx = rctx;
314313

315314
return starfive_rsa_enc_core(ctx, 1);

0 commit comments

Comments
 (0)