English
Language : 

AN4230 Datasheet, PDF (4/24 Pages) STMicroelectronics – Many standards have created requirements and references for the construction
STM32 F2/F4 MCU random number generator
AN4230
1
STM32 F2/F4 MCU random number generator
1.1
Introduction
Random number generators (RNG) used for cryptographic applications typically produce
sequences made of random 0 and 1 bits.
There are two basic classes of random number generators:
1. Deterministic random number generator or pseudo random number generator (PRNG):
A deterministic RNG consisting of an algorithm that produces a sequence of bits from
an initial value called a seed. To ensure forward unpredictability, care must be taken in
obtaining seeds. The values produced by a PRNG are completely predictable if the
seed and generation algorithm are known. Since in many cases the generation
algorithm is publicly available, the seed must be kept secret and generated from a
TRNG.
2. Non deterministic random number generator or True random number generator
(TRNG):
A nondeterministic RNG producing randomness which depends on some unpredictable
physical source (i.e. the entropy source) outside of any human control.
The STM32 F2xx and STM32F4xx microcontrollers embed a True random number
generator as described in Section 1.2.1.
1.2
1.2.1
STM32 MCUs implementation description
True random number generator
The True random number generator peripheral implemented on STM32 F2 series is the
same as the one implemented on F4 series, and it is based on an analog circuit. This circuit
generates a continuous analog noise that feed a Linear Feedback Shift Register (LFSR) in
order to produce a 32-bit random number.
The analog circuit is made of several ring oscillators whose outputs are XORed.
The LFSR is clocked by a dedicated clock (PLL48CLK) at a constant frequency, so that the
quality of the random number is independent of the HCLK frequency.
The contents of LFSR is transferred into the data register (RNG_DR) when a significant
number of seeds have been introduced into LFSR.
4/24
DocIDID024118 Rev 1