[PATCH v7 0/3] hwrng: add hwrng support for Rockchip RK3568
Dragan Simic
dsimic at manjaro.org
Tue Jul 16 22:18:25 PDT 2024
Hello Anand,
On 2024-07-17 07:06, Anand Moon wrote:
> On Wed, 17 Jul 2024 at 08:29, Chen-Yu Tsai <wens at kernel.org> wrote:
>>
>> On Wed, Jul 17, 2024 at 10:25 AM Daniel Golle <daniel at makrotopia.org>
>> wrote:
>> >
>> > On Tue, Jul 16, 2024 at 07:19:35PM +0200, Diederik de Haas wrote:
>> > > On Tuesday, 16 July 2024 18:53:43 CEST Diederik de Haas wrote:
>> > > > rngtest: FIPS 140-2(2001-10-10) Long run: 0
>> > >
>> > > I don't know if it means something, but I noticed that I have
>> > > ``Long run: 0`` with all my poor results,
>> > > while Chen-Yu had ``Long run: 1``.
>> > >
>> > > Different SoC (RK3399), but Anand had ``Long run: 0`` too on their
>> > > very poor result (100% failure):
>> > > https://lore.kernel.org/linux-rockchip/CANAwSgTTzZOwBaR9zjJ5VMpxm5BydtW6rB2S7jg+dnoX8hAoWg@mail.gmail.com/
>> >
>> > The conclusions I draw from that rather ugly situation are:
>> > - The hwrng should not be enabled by default, but it should by done
>> > for each board on which it is known to work well.
>> > - RK_RNG_SAMPLE_CNT as well as the assumed rng quality should be
>> > defined in DT for each board:
>> > * introduce new 'rochchip,rng-sample-count' property
>> > * read 'quality' property already used for timeriomem_rng
>> >
>> > I will prepare a follow-up patch taking those conclusions into account.
>> >
>> > Just for completeness, here my test result on the NanoPi R5C:
>> > root at OpenWrt:~# cat /dev/hwrng | rngtest -c 1000
>> > rngtest 6.15
>> > Copyright (c) 2004 by Henrique de Moraes Holschuh
>> > This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>> >
>> > rngtest: starting FIPS tests...
>> > rngtest: bits received from input: 20000032
>> > rngtest: FIPS 140-2 successes: 875
>> > rngtest: FIPS 140-2 failures: 125
>> > rngtest: FIPS 140-2(2001-10-10) Monobit: 123
>> > rngtest: FIPS 140-2(2001-10-10) Poker: 5
>> > rngtest: FIPS 140-2(2001-10-10) Runs: 4
>> > rngtest: FIPS 140-2(2001-10-10) Long run: 0
>> > rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
>> > rngtest: input channel speed: (min=85.171; avg=141.102; max=4882812.500)Kibits/s
>> > rngtest: FIPS tests speed: (min=17.809; avg=19.494; max=60.169)Mibits/s
>> > rngtest: Program run time: 139628605 microseconds
>>
>> I doubt this is per-board. The RNG is inside the SoC, so it could be a
>> chip
>> quality thing. On the RK3399 we also saw wildly varying results.
>>
> I feel the latest rng-tool only supports Intel platform x86_64 and
> i386.
> It has no proper support for Arm64 and Armv7
> It is heavily modified for the X86 platform
> so it's not suitable for testing on other platforms.
>
> If we enable HWRNG on all the Rockchip platforms it will be better.
>
> [1] https://github.com/nhorman/rng-tools
I don't see what could be tweaked in rngtest(1) to support any platform
better than the other, and still remain a valid test. It just applies
certain FIPS test(s) to the random data obtained from /dev/hwrng or some
other source, and if that testing is tweaked in any way, then the test
results aren't valid on any platform.
In other words, perhaps the other components of rng-tools are tweaked to
support "mainstream" platforms better, but rngtest(1) simply must not be
tweaked in any way.
More information about the linux-arm-kernel
mailing list