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