rp2/moduos: Implement uos.urandom().
The implementation samples rosc.randombits at a frequency lower than the oscillator frequency. This gives better random values. In addition, for an 8-bit value 8 samples are taken and fed through a 8-bit CRC, distributing the sampling over the byte. The resulting sampling rate is about 120k/sec. The RNG does not include testing of error conditions, like the ROSC being in sync with the sampling or completely failing. Making the interim value static causes it to perform a little bit better in short sync or drop-out situations. The output of uos.urandom() performs well with the NIST800-22 test suite. In my trial it passed all tests of the sts 2.1.2 test suite. I also ran a test of the random data with the Common Criteria test suite AIS 31, and it passed all tests too.
Showing
Please register or sign in to comment