Skip to main content

RawNoiseHealthMonitor

Struct RawNoiseHealthMonitor 

Source
pub struct RawNoiseHealthMonitor { /* private fields */ }
Expand description

Lifecycle monitor connecting SP 800-90B startup, continuous, and on-demand health tests for an unconditioned raw noise source.

Blocks readiness (Self::is_ready returns false) until STARTUP_SAMPLE_COUNT (1,024) consecutive raw samples pass both RCT and APT, then seamlessly carries RCT/APT state into continuous monitoring. Any failure latches permanently on the monitor.

Implementations§

Source§

impl RawNoiseHealthMonitor

Source

pub fn new( rct_cutoff: u32, kind: AptSourceKind, apt_cutoff: u32, ) -> Result<Self>

Creates a new monitor with SP 800-90B mandated APT window (1,024 binary / 512 non-binary) and assessed cutoffs derived from the noise source’s min-entropy and false-positive bound.

Source

pub fn observe(&mut self, sample: u64) -> Result<bool>

Observes one unconditioned raw noise sample.

Returns:

  • Ok(false) while still executing the 1,024-sample startup test (output MUST remain blocked),
  • Ok(true) once startup has completed and continuous health holds,
  • Err(Error::EntropyHealthCheckFailed) on any RCT/APT failure (latched permanently).
Source

pub fn run_on_demand_test(&mut self, samples: &[u64]) -> Result<()>

Runs an SP 800-90B Section 4.2 on-demand health test over at least 1,024 consecutive raw samples; any failure permanently latches this monitor.

Source

pub const fn is_ready(&self) -> bool

Returns true iff the 1,024-sample startup test has completed and no failure has latched.

Source

pub const fn is_failed(&self) -> bool

Returns true iff a permanent health-check failure has latched.

Trait Implementations§

Source§

impl Drop for RawNoiseHealthMonitor

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Zeroize for RawNoiseHealthMonitor

Source§

fn zeroize(&mut self)

Overwrites all sensitive memory owned by self with zeros.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.