@@ -210,3 +210,70 @@ software only implementation can be compared to the previous test.
210210 Signals delivered: 0
211211 Page size (bytes): 4096
212212 Exit status: 0
213+
214+ ******************************************************************
215+ Using the True Random Number Generator (TRNG) Hardware Accelerator
216+ ******************************************************************
217+
218+ The pre-built kernel that comes with the SDK already has the OPTEE TRNG
219+ driver enabled. You don't need any further configuration.
220+
221+ Verify that the optee-rng driver is loaded:
222+
223+ .. code-block :: console
224+
225+ root@am62lxx-evm:~# cat /sys/class/misc/hw_random/rng_current
226+ optee-rng
227+
228+ The hwrng device should now show up in the filesystem.
229+
230+ .. code-block :: console
231+
232+ root@am62lxx-evm:~# ls -l /dev/hwrng
233+ crw------- 1 root root 10, 183 Jan 1 2000 /dev/hwrng
234+
235+ Use :command: `cat ` on this device to generate random numbers.
236+
237+ .. code-block :: console
238+
239+ root@am62lxx-evm:~# cat /dev/hwrng | od -x
240+ 0000000 b2bd ae08 4477 be48 4836 bf64 5d92 01c9
241+ 0000020 0cb6 7ac5 16f9 8616 a483 7dfd 6bf4 3aa5
242+ 0000040 d693 db24 d917 5ee7 feb7 34c3 34e9 e7a5
243+ 0000060 36b7 ea85 fc17 0e66 555c 0934 7a0c 4c69
244+ 0000100 523b 9f21 1546 fddb d58b e5ed 142a 6712
245+ 0000120 8d76 8f80 a6d2 30d8 d107 32bc 7f45 f997
246+ 0000140 9d5d 0d0c f1f0 64f9 a77f 408f b0c1 f5a0
247+ 0000160 39c6 f0ae 4b59 1a76 84a7 a364 8964 f557
248+ root@am62lxx-evm:~#
249+
250+ Test the random number generator on the target.
251+
252+ .. code-block :: console
253+
254+ root@am62lxx-evm:~# cat /dev/hwrng | rngtest -c 1000
255+ rngtest 6.16
256+ Copyright (c) 2004 by Henrique de Moraes Holschuh
257+ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
258+
259+ rngtest: starting FIPS tests...
260+ rngtest: bits received from input: 20000032
261+ rngtest: FIPS 140-2 successes: 999
262+ rngtest: FIPS 140-2 failures: 1
263+ rngtest: FIPS 140-2(2001-10-10) Monobit: 0
264+ rngtest: FIPS 140-2(2001-10-10) Poker: 0
265+ rngtest: FIPS 140-2(2001-10-10) Runs: 0
266+ rngtest: FIPS 140-2(2001-10-10) Long run: 1
267+ rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
268+ rngtest: input channel speed: (min=72.965; avg=3848.070; max=9765625.000)Kibits/s
269+ rngtest: FIPS tests speed: (min=10.794; avg=53.373; max=54.967)Mibits/s
270+ rngtest: Program run time: 5710839 microseconds
271+ root@am62lxx-evm:~#
272+
273+ Note that the results might be slightly different on your system, since,
274+ after all, we are dealing with a random number generator. Any appreciable
275+ number of errors typically indicates a bad random number generator.
276+
277+ If you're satisfied the random number generator is working correctly,
278+ you can use :program: `rngd ` (the random number generator daemon) to feed the
279+ :file: `/dev/random ` entropy pool.
0 commit comments