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: <DU0PR04MB95637D86F0134DC26EF955DB8E02A@DU0PR04MB9563.eurprd04.prod.outlook.com>
Date:   Mon, 24 Jul 2023 05:13:23 +0000
From:   Meenakshi Aggarwal <meenakshi.aggarwal@....com>
To:     Bastian Krause <bst@...gutronix.de>,
        "herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     Dan Douglass <dan.douglass@....com>,
        "kernel@...gutronix.de" <kernel@...gutronix.de>,
        Meenakshi Aggarwal <meenakshi.aggarwal@....com>,
        Horia Geanta <horia.geanta@....com>,
        Varun Sethi <V.Sethi@....com>,
        Pankaj Gupta <pankaj.gupta@....com>,
        Gaurav Jain <gaurav.jain@....com>
Subject: RE: [PATCH] crypto: caam - adjust RNG timing to support more devices

Hi Bastian,

Please share the required information.

Thanks,
Meenakshi

> -----Original Message-----
> From: Meenakshi Aggarwal <meenakshi.aggarwal@....com>
> Sent: Wednesday, July 19, 2023 12:31 PM
> To: Bastian Krause <bst@...gutronix.de>; Horia Geanta
> <horia.geanta@....com>; Varun Sethi <V.Sethi@....com>; Pankaj Gupta
> <pankaj.gupta@....com>; Gaurav Jain <gaurav.jain@....com>;
> herbert@...dor.apana.org.au; davem@...emloft.net; linux-
> crypto@...r.kernel.org; linux-kernel@...r.kernel.org
> Cc: Victoria Milhoan <vicki.milhoan@...escale.com>; Dan Douglass
> <dan.douglass@....com>; Vipul Kumar <vipul_kumar@...tor.com>;
> kernel@...gutronix.de
> Subject: RE: [PATCH] crypto: caam - adjust RNG timing to support more devices
>
> Hi Bastian,
>
> We have tested the patch on i.mx8mm board and we did not face any issue with
> the patch.
>
> Please share your imx8mm board revision and complete logs (including
> bootloader logs), It will help in investigating the issue you are facing.
>
> Thanks,
> Meenakshi
>
> > -----Original Message-----
> > From: Bastian Krause <bst@...gutronix.de>
> > Sent: Tuesday, July 18, 2023 3:13 PM
> > To: Meenakshi Aggarwal <meenakshi.aggarwal@....com>; Horia Geanta
> > <horia.geanta@....com>; Varun Sethi <V.Sethi@....com>; Pankaj Gupta
> > <pankaj.gupta@....com>; Gaurav Jain <gaurav.jain@....com>;
> > herbert@...dor.apana.org.au; davem@...emloft.net; linux-
> > crypto@...r.kernel.org; linux-kernel@...r.kernel.org
> > Cc: Victoria Milhoan <vicki.milhoan@...escale.com>; Dan Douglass
> > <dan.douglass@....com>; Vipul Kumar <vipul_kumar@...tor.com>;
> > kernel@...gutronix.de
> > Subject: Re: [PATCH] crypto: caam - adjust RNG timing to support more
> > devices
> >
> > On 7/17/23 14:43, Bastian Krause wrote:
> > > On 6/12/23 10:26, meenakshi.aggarwal@....com wrote:
> > >> From: Victoria Milhoan <vicki.milhoan@...escale.com>
> > >>
> > >> Adjust RNG timing parameters to support more i.MX6 devices.
> > >>
> > >> Signed-off-by: Victoria Milhoan <vicki.milhoan@...escale.com>
> > >> Signed-off-by: Dan Douglass <dan.douglass@....com>
> > >> Signed-off-by: Vipul Kumar <vipul_kumar@...tor.com>
> > >> Signed-off-by: Horia Geantă <horia.geanta@....com>
> > >> ---
> > >>   drivers/crypto/caam/ctrl.c | 4 ++--
> > >>   1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > This patch seems to breaks CAAM RNG instantiation on an i.MX8MM at my
> end:
> > >
> > > caam 30900000.crypto: Entropy delay = 3200 caam 30900000.crypto:
> > > Entropy delay = 3600 [...] caam 30900000.crypto: Entropy delay =
> > > 12400 caam 30900000.crypto: failed to instantiate RNG
> > > caam: probe of 30900000.crypto failed with error -11
> > >
> > > If I revert this patch or increase RTSDCTL_ENT_DLY_MAX to a value >
> > > 66800, it works again:
> > >
> > > caam 30900000.crypto: Entropy delay = 32800 caam 30900000.crypto:
> > > Entropy delay = 33200 [...] caam 30900000.crypto: Entropy delay =
> > > 66800 caam 30900000.crypto: Instantiated RNG4 SH0 caam
> > > 30900000.crypto: Instantiated RNG4 SH1 caam 30900000.crypto: device
> > > ID = 0x0a16040100000000 (Era 9) caam 30900000.crypto: job rings = 2,
> > > qi =
> > > 0 caam algorithms registered in /proc/crypto caam 30900000.crypto:
> > > caam pkc algorithms registered in /proc/crypto caam 30900000.crypto:
> > > registering rng-caam Executing RNG SELF-TEST with wait
> > > random: crng init done
> > > caam 30900000.crypto: rng crypto API alg registered prng-caam
> >
> > This ^ was the kernel log for..
> >
> >
> > --- a/drivers/crypto/caam/regs.h
> > +++ b/drivers/crypto/caam/regs.h
> > @@@ -522,7 -522,7 +522,7 @@@ struct rng4tst
> >    #define RTSDCTL_ENT_DLY_SHIFT 16
> >    #define RTSDCTL_ENT_DLY_MASK (0xffff << RTSDCTL_ENT_DLY_SHIFT)
> >    #define RTSDCTL_ENT_DLY_MIN 3200
> > --#define RTSDCTL_ENT_DLY_MAX 12800
> > ++#define RTSDCTL_ENT_DLY_MAX 70000
> >    #define RTSDCTL_SAMP_SIZE_MASK 0xffff
> >    #define RTSDCTL_SAMP_SIZE_VAL 512
> >          u32 rtsdctl;            /* seed control register */
> >
> >
> > For completion's sake: Reverting this patch..
> >
> >
> > --- a/drivers/crypto/caam/ctrl.c
> > +++ b/drivers/crypto/caam/ctrl.c
> > @@ -383,7 +383,7 @@ static void kick_trng(struct device *dev, int ent_delay)
> >                  /* min. freq. count, equal to 1/4 of the entropy sample length */
> >                  wr_reg32(&r4tst->rtfrqmin, val >> 2);
> >                  /* max. freq. count, equal to 16 times the entropy sample length */
> > -               wr_reg32(&r4tst->rtfrqmax, val << 4);
> > +               wr_reg32(&r4tst->rtfrqmax, RTFRQMAX_DISABLE);
> >          }
> >
> >          wr_reg32(&r4tst->rtsdctl, (val << RTSDCTL_ENT_DLY_SHIFT) |
> >
> >
> > ..produces this kernel log (without RNG SELF-TEST):
> >
> > caam 30900000.crypto: Entropy delay = 3200 caam 30900000.crypto:
> > Entropy delay = 3600 caam 30900000.crypto: Instantiated RNG4 SH0 caam
> > 30900000.crypto: Instantiated RNG4 SH1 caam 30900000.crypto: device ID
> > =
> > 0x0a16040100000000 (Era 9) caam 30900000.crypto: job rings = 2, qi = 0
> > caam algorithms registered in /proc/crypto caam 30900000.crypto: caam
> > pkc algorithms registered in /proc/crypto caam 30900000.crypto:
> > registering rng- caam caam 30900000.crypto: rng crypto API alg
> > registered prng-caam
> > random: crng init done
> >
> > Regards,
> > Bastian
> >
> > >>
> > >> diff --git a/drivers/crypto/caam/ctrl.c
> > >> b/drivers/crypto/caam/ctrl.c index 5fed3cf354c0..62dd069942e4
> > >> 100644
> > >> --- a/drivers/crypto/caam/ctrl.c
> > >> +++ b/drivers/crypto/caam/ctrl.c
> > >> @@ -383,8 +383,8 @@ static void kick_trng(struct device *dev, int
> > >> ent_delay)
> > >>       wr_reg32(&r4tst->rtsdctl, val);
> > >>       /* min. freq. count, equal to 1/4 of the entropy sample
> > >> length */
> > >>       wr_reg32(&r4tst->rtfrqmin, ent_delay >> 2);
> > >> -    /* disable maximum frequency count */
> > >> -    wr_reg32(&r4tst->rtfrqmax, RTFRQMAX_DISABLE);
> > >> +    /* max. freq. count, equal to 16 times the entropy sample
> > >> +length */
> > >> +    wr_reg32(&r4tst->rtfrqmax, ent_delay << 4);
> > >>       /* read the control register */
> > >>       val = rd_reg32(&r4tst->rtmctl);
> > >>   start_rng:
> > >
> >
> > --
> > Pengutronix e.K.                           |                             |
> > Steuerwalder Str. 21                       |
> > http://www.p/
> >
> en%2F&data=05%7C01%7Cmeenakshi.aggarwal%40nxp.com%7C3e036baed8c9
> 4cf104
> >
> 4008db8825e5ce%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6382
> 534685
> >
> 76971721%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2l
> uMzIiL
> >
> CJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=vbtE1IciakfHjf
> JQiB
> > VxOGN%2Bm7JBlT%2B1obDRf0eyOuM%3D&reserved=0
> >
> gutronix.de%2F&data=05%7C01%7Cmeenakshi.aggarwal%40nxp.com%7C1f556
> >
> d6802434c00ef4f08db87736527%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
> >
> 0%7C0%7C638252701909887583%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
> >
> wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C
> > %7C%7C&sdata=2vCBBdo%2FAkyz%2BaLXcDyeursw3Gle%2FKosiO%2FdPysOd
> 3
> > Q%3D&reserved=0  |
> > 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> > Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ