RE: [EXT] Re: [REPOST PATCH] crypto: caam - reject overlong RSA CRT parameters

From: Sahil Malhotra (OSS)

Date: Mon Oct 26 2026 - 07:57:21 EST


Hi Herbert,

Sorry for the delay.
I just reviewed the patch and in process of reviewing other pending patches also.

Regards,
Sahil Malhotra


NXP Confidential
> -----Original Message-----
> From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Sent: 26 October 2026 10:13
> To: Jérémy Jean <Jeremy.Jean@xxxxxxxxxxxxxxxxx>
> Cc: Horia Geanta <horia.geanta@xxxxxxx>; Pankaj Gupta
> <pankaj.gupta@xxxxxxx>; Sahil Malhotra <sahil.malhotra@xxxxxxx>; David
> S. Miller <davem@xxxxxxxxxxxxx>; linux-crypto@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; stable@xxxxxxxxxxxxxxx
> Subject: [EXT] Re: [REPOST PATCH] crypto: caam - reject overlong RSA CRT
> parameters
>
> Caution: This is an external email. Please take care when clicking links
or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
>
> On Thu, Oct 15, 2026 at 08:28:50PM +1100, Herbert Xu wrote:
> > On Thu, Oct 08, 2026 at 09:35:53AM +0000, Jérémy Jean wrote:
> > > caam_read_rsa_crt() right-aligns dP, dQ, and qInv in buffers sized
> > > from the corresponding prime. rsa_parse_priv_key() only bounds these
> > > integers against n, so a malformed key can provide, for example, a
> > > two-byte dP with a one-byte p. dstlen - nbytes then underflows and
> > > memcpy() writes outside the allocation during set_priv_key(). KASAN
> > > reports a slab-out-of-bounds write in caam_read_rsa_crt().
> > >
> > > Reject empty or overlong CRT parameters after stripping leading zeros.
> > > qInv is consumed by CAAM as a p-sized value, so size it from p
> > > rather than q to match the DMA mapping in set_rsa_priv_f3_pdb(). Let
> > > the top-level key cleanup handle partial form-3 allocations and
> > > return the specific error to the caller.
> > >
> > > Also test nbytes before dereferencing it while stripping zeros, so
> > > an all-zero integer does not read one byte beyond its input.
> > >
> > > Fixes: 4a651b122adb ("crypto: caam - add support for RSA key form
> > > 3")
> > > Cc: stable@xxxxxxxxxxxxxxx
> > > Assisted-by: LLM
> > > Signed-off-by: Jérémy Jean <Jeremy.Jean@xxxxxxxxxxxxxxxxx>
> > > ---
> > > drivers/crypto/caam/caampkc.c | 69
> > > +++++++++++++++--------------------
> > > 1 file changed, 30 insertions(+), 39 deletions(-)
> >
> > Sahil, could you please review this patch?
>
> Hi Sahil:
>
> It's been two weeks and you've provided no feedback.
>
> If there isn't going to be timely feedback to patches on this driver then
it will be
> removed.
>
> Thanks,
> --
> Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page:
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgondo
> r.apana.org.au%2F~herbert%2F&data=05%7C02%7Csahil.malhotra%40nxp.c
> om%7C8ae2201e6d304d4bca0708df331b9897%7C686ea1d3bc2b4c6fa92c
> d99c5c301635%7C0%7C0%7C639285865952622472%7CUnknown%7CTW
> FpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXa
> W4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=YP2
> HDGxtmPHRqtU3%2F6lFqhjJwOUa8Czp6IV3QJI%2FaYc%3D&reserved=0
> PGP Key:
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgondo
> r.apana.org.au%2F~herbert%2Fpubkey.txt&data=05%7C02%7Csahil.malhotr
> a%40nxp.com%7C8ae2201e6d304d4bca0708df331b9897%7C686ea1d3bc
> 2b4c6fa92cd99c5c301635%7C0%7C0%7C639285865952656160%7CUnkn
> own%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwM
> CIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C
> &sdata=9N5IuUc0ReEfh37OUvvVqfWMs1NJRxS6yDd32NmUu84%3D&reser
> ved=0