Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] how to initialize RNG when /dev/hwrng is not found?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
jpsollie
Guru
Guru


Joined: 17 Aug 2013
Posts: 322

PostPosted: Sun Sep 22, 2024 1:47 pm    Post subject: [solved] how to initialize RNG when /dev/hwrng is not found? Reply with quote

I built gentoo on a nanopi neo3 a while ago,
years have passed, it always did a good job,
but since version 6.2, friendlyarm dropped their custom kernel for this nanopi r2s like board.
Time moves on, so I thought 'yeah, let's give vanilla 6.6 a try' :
so, while I enjoy the working crypto controller in 6.6:
Code:

[    9.270549] rk3288-crypto ff060000.crypto: will run requests pump with realtime priority
[    9.270687] rk3288-crypto ff060000.crypto: Register ecb(aes) as ecb-aes-rk
[    9.270808] rk3288-crypto ff060000.crypto: Register cbc(aes) as cbc-aes-rk
[    9.270831] rk3288-crypto ff060000.crypto: Register ecb(des) as ecb-des-rk
[    9.270848] rk3288-crypto ff060000.crypto: Register cbc(des) as cbc-des-rk
[    9.270864] rk3288-crypto ff060000.crypto: Register ecb(des3_ede) as ecb-des3-ede-rk
[    9.270880] rk3288-crypto ff060000.crypto: Register cbc(des3_ede) as cbc-des3-ede-rk
[    9.270896] rk3288-crypto ff060000.crypto: Register sha1 as rk-sha1
[    9.270915] rk3288-crypto ff060000.crypto: Register sha256 as rk-sha256
[    9.270932] rk3288-crypto ff060000.crypto: Register md5 as rk-md5

... I definitely do NOT enjoy rngd not booting up anymore because there's no rng device anymore:

Code:

rngd -f           
Initializing available sources
[hwrng ]: Initialization Failed
[rndr  ]: No HW SUPPORT
[rndr  ]: Initialization Failed
Can't open any entropy source
Maybe RNG device modules are not loaded


the diff of the dts tree shows why:
Code:

@@ -279,17 +281,6 @@
                status = "disabled";
        };
 
-       rng: rng@ff060000 {
-               compatible = "rockchip,cryptov1-rng";
-               reg = <0x0 0xff060000 0x0 0x4000>;
-
-               clocks = <&cru SCLK_CRYPTO>, <&cru HCLK_CRYPTO_SLV>;
-               clock-names = "clk_crypto", "hclk_crypto";
-               assigned-clocks = <&cru SCLK_CRYPTO>, <&cru HCLK_CRYPTO_SLV>;
-               assigned-clock-rates = <150000000>, <100000000>;
-               status = "enabled";
-       };
-
        grf: syscon@ff100000 {
                compatible = "rockchip,rk3328-grf", "syscon", "simple-mfd";
                reg = <0x0 0xff100000 0x0 0x1000>;

@@ -1087,6 +1036,17 @@
                      (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
        };
 
+       crypto: crypto@ff060000 {
+               compatible = "rockchip,rk3328-crypto";
+               reg = <0x0 0xff060000 0x0 0x4000>;
+               interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru HCLK_CRYPTO_MST>, <&cru HCLK_CRYPTO_SLV>,
+                        <&cru SCLK_CRYPTO>;
+               clock-names = "hclk_master", "hclk_slave", "sclk";
+               resets = <&cru SRST_CRYPTO>;
+               reset-names = "crypto-rst";
+       };
+



pretty clear, I guess ...
But why isn't rngd working with usual armv8 random instructions?[/code]
_________________
The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img]


Last edited by jpsollie on Mon Sep 23, 2024 10:20 am; edited 1 time in total
Back to top
View user's profile Send private message
jpsollie
Guru
Guru


Joined: 17 Aug 2013
Posts: 322

PostPosted: Mon Sep 23, 2024 10:20 am    Post subject: Reply with quote

the solution was to apply the crypto-rng patch, which reinserts the crypto driver .
Unfortunately, this has not been upstreamed (yet?): https://lore.kernel.org/linux-crypto/20220919210025.2376254-1-Jason@zx2c4.com/
After turning off the crypto engine (status: "disabled" in dts), the hwrng device was up-and-running like it should.
_________________
The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum