[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<NT0PR01MB1182521792A1CB004CB525648AC62@NT0PR01MB1182.CHNPR01.prod.partner.outlook.cn>
Date: Mon, 10 Jun 2024 10:50:14 +0000
From: JiaJie Ho <jiajie.ho@...rfivetech.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
CC: "David S . Miller" <davem@...emloft.net>, "linux-crypto@...r.kernel.org"
<linux-crypto@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] crypto: starfive - Align rsa input data to 32-bit
> On Wed, May 29, 2024 at 08:25:53AM +0800, Jia Jie Ho wrote:
> > Hardware expects RSA input plain/ciphertext to be 32-bit aligned.
> > Allocate aligned buffer and shift data accordingly.
> >
> > Signed-off-by: Jia Jie Ho <jiajie.ho@...rfivetech.com>
> > ---
> > drivers/crypto/starfive/jh7110-cryp.h | 3 +--
> > drivers/crypto/starfive/jh7110-rsa.c | 17 ++++++++++-------
> > 2 files changed, 11 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/crypto/starfive/jh7110-cryp.h
> > b/drivers/crypto/starfive/jh7110-cryp.h
> > index 494a74f52706..eeb4e2b9655f 100644
> > --- a/drivers/crypto/starfive/jh7110-cryp.h
> > +++ b/drivers/crypto/starfive/jh7110-cryp.h
> > @@ -217,12 +217,11 @@ struct starfive_cryp_request_ctx {
> > struct scatterlist *out_sg;
> > struct ahash_request ahash_fbk_req;
> > size_t total;
> > - size_t nents;
> > unsigned int blksize;
> > unsigned int digsize;
> > unsigned long in_sg_len;
> > unsigned char *adata;
> > - u8 rsa_data[] __aligned(sizeof(u32));
> > + u8 *rsa_data;
>
> You didn't explain why this is moving from a pre-allocated buffer to one that's
> allocated on the run. It would appear that there is no reason why you can't
> build the extra space used for shifting into reqsize.
>
I'll update this in the next version.
Thanks for reviewing this.
Best regards,
Jia Jie
Powered by blists - more mailing lists