lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <NT0PR01MB11824BA0DD4F7C638A91E80C8AC02@NT0PR01MB1182.CHNPR01.prod.partner.outlook.cn>
Date: Wed, 12 Jun 2024 02:58:18 +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.
> 
Hi Herbert,

Can I fix the buffer length of the pre-allocated buffer to 256 bytes instead of
the current variable length buffer? 

-        u8 rsa_data[] __aligned(sizeof(u32));
+       u8 rsa_data[STARFIVE_RSA_MAX_KEYSZ];

That's the maximum length supported by the hardware and 
most applications now use rsa2048 and above.

Thanks,
Jia Jie

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ