#[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.
Trait Implementations§
impl Copy for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)