#[non_exhaustive]pub struct Config {
pub disable_autocorrelation_test: bool,
pub disable_crngt_test: bool,
pub disable_von_neumann_balancer: bool,
pub sample_count: u32,
pub inverter_chain_length: InverterChainLength,
}
Expand description
Configuration for the TRNG.
- Three built in entropy checks
- ROSC frequency controlled by selecting one of ROSC chain lengths
- Sample period in terms of system clock ticks
Default configuration is based on the following from documentation:
RP2350 Datasheet 12.12.2
…
When configuring the TRNG block, consider the following principles: • As average generation time increases, result quality increases and failed entropy checks decrease. • A low sample count decreases average generation time, but increases the chance of NIST test-failing results and failed entropy checks. For acceptable results with an average generation time of about 2 milliseconds, use ROSC chain length settings of 0 or 1 and sample count settings of 20-25.
Note, Pico SDK and Bootrom don’t use any of the entropy checks and sample the ROSC directly by setting the sample period to 0. Random data collected this way is then passed through either hardware accelerated SHA256 (Bootrom) or xoroshiro128** (version 1.0!).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.disable_autocorrelation_test: bool
Bypass TRNG autocorrelation test
disable_crngt_test: bool
Bypass CRNGT test
disable_von_neumann_balancer: bool
When set, the Von-Neuman balancer is bypassed (including the 32 consecutive bits test)
sample_count: u32
Sets the number of rng_clk cycles between two consecutive ring oscillator samples. Note: If the von Neumann decorrelator is bypassed, the minimum value for sample counter must not be less than seventeen
inverter_chain_length: InverterChainLength
Selects the number of inverters (out of four possible selections) in the ring oscillator (the entropy source). Higher values select longer inverter chain lengths.