STM32F4 random number generation validation
- September 23, 2019
- 5 replies
- 2761 views
Hello all,
I am working on a cryptography project based on STM32F407VGT micro controller, in which I need to generate random data using inbuilt RNG peripheral. I dump this random data to my Ubuntu 16.04 host machine using USB in CDC mode and using libusb 1.0.9. My buffer size is 16KB which I sent 64 times per 1MB. When I ran the statistical test suite on the 1MB generated data file, it gives a result of repeated sequence of bit stream around the last 64 KB of file. My window/slice size for statistical test is 1KB.
Now my question is whether or not I am initialising and using the RNG in the correct way.
I have attached my main.c here.
According to App note AN4230, the RNG on the STM32 is a TRNG (and not PRNG). But is it possible that the RNG is giving repetitive data? I suspect so because it mentions an LFSR and LFSRs have a finite bit sequence period.
