embassy-mcxa

Crates

git

Versions

mcx-a256

Flavors

Trng

Struct Trng 

Source
pub struct Trng<'d, M: Mode> { /* private fields */ }
Expand description

TRNG Driver

Implementations§

Source§

impl<'d, M: Mode> Trng<'d, M>

Source

pub fn blocking_fill_bytes(&mut self, buf: &mut [u8])

Fill the buffer with random bytes, blocking version.

Source

pub fn blocking_next_u32(&mut self) -> u32

Return a random u32, blocking version.

Source

pub fn blocking_next_u64(&mut self) -> u64

Return a random u64, blocking version.

Source§

impl<'d> Trng<'d, Blocking>

Source

pub fn new_blocking_128(_peri: Peri<'d, TRNG0>) -> Self

Instantiates a new TRNG peripheral driver with 128 samples of entropy.

Source

pub fn new_blocking_256(_peri: Peri<'d, TRNG0>) -> Self

Instantiates a new TRNG peripheral driver with 256 samples of entropy.

Source

pub fn new_blocking_512(_peri: Peri<'d, TRNG0>) -> Self

Instantiates a new TRNG peripheral driver with 512 samples of entropy.

Source

pub fn new_blocking_with_custom_config( _peri: Peri<'d, TRNG0>, config: Config, ) -> Self

Instantiates a new TRNG peripheral driver.

NOTE: this constructor makes no attempt at validating the parameters. If you get this wrong, the security guarantees of the TRNG with regards to entropy may be violated

Source§

impl<'d> Trng<'d, Async>

Source

pub fn new_128( _peri: Peri<'d, TRNG0>, _irq: impl Binding<TRNG0, InterruptHandler> + 'd, ) -> Self

Instantiates a new TRNG peripheral driver with 128 samples of entropy.

Source

pub fn new_256( _peri: Peri<'d, TRNG0>, _irq: impl Binding<TRNG0, InterruptHandler> + 'd, ) -> Self

Instantiates a new TRNG peripheral driver with 256 samples of entropy.

Source

pub fn new_512( _peri: Peri<'d, TRNG0>, _irq: impl Binding<TRNG0, InterruptHandler> + 'd, ) -> Self

Instantiates a new TRNG peripheral driver with 512 samples of entropy.

Source

pub fn new_with_custom_config( _peri: Peri<'d, TRNG0>, _irq: impl Binding<TRNG0, InterruptHandler> + 'd, config: Config, ) -> Self

Instantiates a new TRNG peripheral driver.

NOTE: this constructor makes no attempt at validating the parameters. If you get this wrong, the security guarantees of the TRNG with regards to entropy may be violated

Source

pub async fn async_fill_bytes(&mut self, buf: &mut [u8]) -> Result<(), Error>

Fill the buffer with random bytes, async version.

Source

pub async fn async_next_u32(&mut self) -> Result<u32, Error>

Return a random u32, async version.

Source

pub async fn async_next_u64(&mut self) -> Result<u64, Error>

Return a random u64, async version.

Trait Implementations§

Source§

impl<M: Mode> Drop for Trng<'_, M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'d, M: Mode> RngCore for Trng<'d, M>

Source§

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
Source§

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
Source§

fn fill_bytes(&mut self, dest: &mut [u8])

Fill dest with random data. Read more
Source§

fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>

Fill dest entirely with random data. Read more
Source§

impl<'d, M: Mode> RngCore for Trng<'d, M>

Source§

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
Source§

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
Source§

fn fill_bytes(&mut self, dest: &mut [u8])

Fill dest with random data. Read more
Source§

impl<'d, M: Mode> CryptoRng for Trng<'d, M>

Source§

impl<'d, M: Mode> CryptoRng for Trng<'d, M>

Auto Trait Implementations§

§

impl<'d, M> Freeze for Trng<'d, M>

§

impl<'d, M> RefUnwindSafe for Trng<'d, M>
where M: RefUnwindSafe,

§

impl<'d, M> Send for Trng<'d, M>
where M: Send,

§

impl<'d, M> Sync for Trng<'d, M>
where M: Sync,

§

impl<'d, M> Unpin for Trng<'d, M>
where M: Unpin,

§

impl<'d, M> !UnwindSafe for Trng<'d, M>

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> CryptoRngCore for T
where T: CryptoRng + RngCore,

Source§

fn as_rngcore(&mut self) -> &mut dyn RngCore

Upcast to an RngCore trait object.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<R> TryRngCore for R
where R: RngCore + ?Sized,

Source§

type Error = Infallible

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

fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>

Return the next random u32.
Source§

fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>

Return the next random u64.
Source§

fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>

Fill dest entirely with random data.
Source§

fn unwrap_err(self) -> UnwrapErr<Self>
where Self: Sized,

Wrap RNG with the UnwrapErr wrapper.
Source§

fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>

Wrap RNG with the UnwrapMut wrapper.
Source§

impl<R> TryCryptoRng for R
where R: CryptoRng + ?Sized,