Re: [PATCH] hw_random: rockchip: import driver from vendor tree

From: Anand Moon
Date: Tue Jun 18 2024 - 10:02:05 EST


Hi Corentin / Jason,

On Tue, 31 Jan 2023 at 16:10, Corentin LABBE <clabbe@xxxxxxxxxxxx> wrote:
>
> Le Tue, Sep 20, 2022 at 10:35:44AM +0100, Robin Murphy a écrit :
> > On 2022-09-19 22:00, Jason A. Donenfeld wrote:
> > > The Rockchip driver has long existed out of tree, but not upstream.
> > > There is support for it upstream in u-boot, but not in Linux proper.
> > > This commit imports the GPLv2 driver written by Lin Jinhan, together
> > > with the DTS and config blobs from Wevsty.
> >
> > Note that Corentin has a series enabling the full crypto driver for
> > RK3328 and RK3399[1], so it would seem more sensible to add TRNG support
> > to that. Having confliciting compatibles for the same hardware that
> > force the user to change their DT to choose one functionality or the
> > other isn't good (plus there's also no binding for this one).
> >
> > Robin.
> >
>
> Hello
>
> I am very interested on how this serie was tested and which tools was used to ensure output was random.
> And how did you get that CRYPTO_V1_TRNG_SAMPLE_PERIOD(100); was the best choice.
>
Is there any update on this driver

I just tested this patch on my RK3399 board.

8<-------------------------------------------------------------->8
# dd if=/dev/hwrng bs=100000 count=1 > /dev/null
1+0 records in
1+0 records out
100000 bytes (100 kB, 98 KiB) copied, 0.829212 s, 121 kB/s

# cat /dev/hwrng | rngtest -c 1000
...
rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 0
rngtest: FIPS 140-2 failures: 1000 <-- failures
rngtest: FIPS 140-2(2001-10-10) Monobit: 21
rngtest: FIPS 140-2(2001-10-10) Poker: 1000
rngtest: FIPS 140-2(2001-10-10) Runs: 1000
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 4
rngtest: input channel speed: (min=18.079; avg=955.991; max=9765625.000)Kibits/s
rngtest: FIPS tests speed: (min=18.062; avg=31.619; max=50.459)Mibits/s
rngtest: Program run time: 22125055 microseconds

Whereas for /dev/random

# cat /dev/random | rngtest -c 1000
...
rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 998
rngtest: FIPS 140-2 failures: 2
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 1
rngtest: FIPS 140-2(2001-10-10) Runs: 0
rngtest: FIPS 140-2(2001-10-10) Long run: 1
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=381.470; avg=5551.073; max=19073.486)Mibits/s
rngtest: FIPS tests speed: (min=24.933; avg=70.400; max=79.805)Mibits/s
rngtest: Program run time: 276870 microseconds

Thanks

-Anand




> Thanks
> Regards
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-rockchip