RE: [PATCH v2] crypto: starfive - Align rsa input data to 32-bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > @@ -217,12 +218,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[STARFIVE_RSA_MAX_KEYSZ];
> 
> I think you should retain the aligned attribute.

I'll add this back in the next version.

> > @@ -74,14 +73,13 @@ static int starfive_rsa_montgomery_form(struct
> > starfive_cryp_ctx *ctx,  {
> >  	struct starfive_cryp_dev *cryp = ctx->cryp;
> >  	struct starfive_cryp_request_ctx *rctx = ctx->rctx;
> > -	int count = rctx->total / sizeof(u32) - 1;
> > +	int count = (ALIGN(rctx->total, sizeof(u32)) >> 2) - 1;
> 
> This is a bit confusing.  Perhaps use 4 instead of sizeof(u32), i.e.
> 
> 	int count = (ALIGN(rctx->total, 4) / 4) - 1;
> 

Will update this too.

> >  	int loop;
> >  	u32 temp;
> >  	u8 opsize;
> >
> >  	opsize = (bit_len - 1) >> 5;
> >  	rctx->csr.pka.v = 0;
> > -
> 
> Please do not make unrelated changes like this.

Got it. I'll remove it and the unrelated changes in the next version.
Thanks for review this patch.

Best regards,
Jia Jie






[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux