真随机数TRNG在optee关闭后无法访问

cwlin0 |浏览146次
收藏|2023/03/17 13:38

如果不需要用到optee但需用到真随机数,反馈异常

如何复现:

...\MA35D1_Buildroot\output\build\linux-custom\arch\arm64\boot\dts\nuvoton\ma35d1.dtsi

trng: trng@40B90000 {

        compatible = "nuvoton,ma35d1-trng";

        reg = <0x0 0x40B90000 0x0 0x400>;

        interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;

        optee_nuvoton = "yes";

        status = "okay";

optee开启测试正常(默认开启),

# hexdump /dev/hwrng

0000000 06d7 a392 142f 2c68 60ae 96f2 80c7 93ec

0000010 0131 117e 25b9 3841 d742 f851 6a39 ad54

0000020 9c8f 4390 8c20 278e b8d7 ed5d fd12 e1be

0000030 f1b4 4193 e379 8728 3788 72bf a1da f0e4

能正常访问

optee关闭no编译后;

hexdump /dev/hwrng

hexdump: /dev/hwrng: No such device

无法访问,

如果不需要optee但需真随机数,我查看规格书,

If TRNG was configured as TZS (Trust-Zone Secure) or equipped with TSI, “optee_nuvoton” must beset to “yes”, otherwise, it should be set to “no”.

查看设备树中,<TRNG_TZNS>;理论不是TZS的关闭OPTEE应该也可以使用。


满意回答

2023/03/17 13:53

目前所有MA35D1都是TSI enable的,必须设置optee_nuvoton为“yes”才能使用TRNG,除非在OTP disable TSI,这样就可以设置为“no”或者“yes”

Disable TSI后设置为 yes,仍是由 Linux 调用OP-TEE access TRNG

设置为 no,则是由 Linux trng driver 直接 access TRNG 硬件。


nuvoton2022

其他回答(0)
0人关注该问题
+1
 加载中...