From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 103BBC3DA42 for ; Wed, 17 Jul 2024 05:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Js8sqWzBerizJJcE4j5H4vl9+Y+2wmbUBag2iVhUq3E=; b=RsKzMcgnWFjssySmhuqy+i/aoQ LlQzHS01CdPjcPWJ9XUUJ5Ll34rzqUTUsFQGl+LKYttaj8QtBvPRBIxXJD3raUK31J61q1oIGpTxx 3I9k5p7SWd+JxWRJQh27WD5ArAQUX5WxW8WnP6L+0KPlbRi/HIZO3DpqYvT+ZJL/pB37OAZGHHGiv S+chzkt/PqXOQXxeOdFQLCGhzQgOL5NqkVvo7EhUOIUg1ZvuK9xw9B9FpFuqJaVeF5iAtnTuF3XmY SU5PEbsqNjjvso7LoXSfrUfLhwCVMsr2dTuaz5PtyBHLgsSAV6RNxwPL5OcNiyWGUTCNoFP6LxSRK Qsa0zOQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTx40-0000000CgV8-3ykT; Wed, 17 Jul 2024 05:18:53 +0000 Received: from mail.manjaro.org ([2a01:4f8:c0c:51f3::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTx3f-0000000CgMX-29he; Wed, 17 Jul 2024 05:18:33 +0000 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1721193509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Js8sqWzBerizJJcE4j5H4vl9+Y+2wmbUBag2iVhUq3E=; b=C7VUIFMQIuP+oVILPDwvq0+0o+4rFBFzNG/TZyExlB4EAu+uoePvGMgjCORFe24tfQjLAk qkDlcHlbZ3yTY+pm18hs4GzOWpxi4qolVdJdrbvi90CjMz8fF98iV7H2uL3KNblXnyOKPw ES/kNCcIVrBZkBURazqPobqH5auKN41ZwnPKlF0f6+uotziIN0miKbwYieklGE2kiErhU3 bYrbC7Gg9VoMqz/botOtjjhGylvBuDjeRBpPLlO9pRFxUyQDgtcUnDRFx8Ef1wFES0wI5X Z+dq6FXa/f8elR74+CSNIlxp7d08lXtb3bTdEGmzWp70PEX1v9Btwc6F7PI78g== Date: Wed, 17 Jul 2024 07:18:25 +0200 From: Dragan Simic To: Anand Moon Cc: wens@kernel.org, Daniel Golle , Diederik de Haas , linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Rob Herring , Conor Dooley , linux-kernel@vger.kernel.org, Herbert Xu , Martin Kaiser , Sascha Hauer , Sebastian Reichel , Ard Biesheuvel , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, linux-crypto@vger.kernel.org, Philipp Zabel , Olivia Mackall , Krzysztof Kozlowski , Aurelien Jarno , Heiko Stuebner Subject: Re: [PATCH v7 0/3] hwrng: add hwrng support for Rockchip RK3568 In-Reply-To: References: <3190961.CRkYR5qTbq@bagend> <3220752.Q7WYUMVHaa@bagend> Message-ID: <51011274265ab684763287e4c02b6cd4@manjaro.org> X-Sender: dsimic@manjaro.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_221832_124077_8935B6B5 X-CRM114-Status: GOOD ( 27.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Anand, On 2024-07-17 07:06, Anand Moon wrote: > On Wed, 17 Jul 2024 at 08:29, Chen-Yu Tsai wrote: >> >> On Wed, Jul 17, 2024 at 10:25 AM Daniel Golle >> 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@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.