Skip to main content

try_fill_bytes_zeroing_on_error

Function try_fill_bytes_zeroing_on_error 

Source
pub fn try_fill_bytes_zeroing_on_error<R: RngCore + ?Sized>(
    rng: &mut R,
    destination: &mut [u8],
) -> Result<(), Error>
Expand description

Fill a destination and clear it completely if the RNG reports failure.

RngCore implementations are caller supplied and may write only part of a destination before returning an error. Secret constructors use this helper so those partial bytes never remain live on an error path.