pub struct Trng<'d, M: Mode> { /* private fields */ }Expand description
TRNG Driver
Implementations§
Source§impl<'d, M: Mode> Trng<'d, M>
impl<'d, M: Mode> Trng<'d, M>
Sourcepub fn blocking_fill_bytes(&mut self, buf: &mut [u8])
pub fn blocking_fill_bytes(&mut self, buf: &mut [u8])
Fill the buffer with random bytes, blocking version.
Sourcepub fn blocking_next_u32(&mut self) -> u32
pub fn blocking_next_u32(&mut self) -> u32
Return a random u32, blocking version.
Sourcepub fn blocking_next_u64(&mut self) -> u64
pub fn blocking_next_u64(&mut self) -> u64
Return a random u64, blocking version.
Source§impl<'d> Trng<'d, Blocking>
impl<'d> Trng<'d, Blocking>
Sourcepub fn new_blocking_128(_peri: Peri<'d, TRNG0>) -> Self
pub fn new_blocking_128(_peri: Peri<'d, TRNG0>) -> Self
Instantiates a new TRNG peripheral driver with 128 samples of entropy.
Sourcepub fn new_blocking_256(_peri: Peri<'d, TRNG0>) -> Self
pub fn new_blocking_256(_peri: Peri<'d, TRNG0>) -> Self
Instantiates a new TRNG peripheral driver with 256 samples of entropy.
Sourcepub fn new_blocking_512(_peri: Peri<'d, TRNG0>) -> Self
pub fn new_blocking_512(_peri: Peri<'d, TRNG0>) -> Self
Instantiates a new TRNG peripheral driver with 512 samples of entropy.
Sourcepub fn new_blocking_with_custom_config(
_peri: Peri<'d, TRNG0>,
config: Config,
) -> Self
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>
impl<'d> Trng<'d, Async>
Sourcepub fn new_128(
_peri: Peri<'d, TRNG0>,
_irq: impl Binding<TRNG0, InterruptHandler> + 'd,
) -> Self
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.
Sourcepub fn new_256(
_peri: Peri<'d, TRNG0>,
_irq: impl Binding<TRNG0, InterruptHandler> + 'd,
) -> Self
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.
Sourcepub fn new_512(
_peri: Peri<'d, TRNG0>,
_irq: impl Binding<TRNG0, InterruptHandler> + 'd,
) -> Self
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.
Sourcepub fn new_with_custom_config(
_peri: Peri<'d, TRNG0>,
_irq: impl Binding<TRNG0, InterruptHandler> + 'd,
config: Config,
) -> Self
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
Sourcepub async fn async_fill_bytes(&mut self, buf: &mut [u8]) -> Result<(), Error>
pub async fn async_fill_bytes(&mut self, buf: &mut [u8]) -> Result<(), Error>
Fill the buffer with random bytes, async version.
Sourcepub async fn async_next_u32(&mut self) -> Result<u32, Error>
pub async fn async_next_u32(&mut self) -> Result<u32, Error>
Return a random u32, async version.
Sourcepub async fn async_next_u64(&mut self) -> Result<u64, Error>
pub async fn async_next_u64(&mut self) -> Result<u64, Error>
Return a random u64, async version.
Trait Implementations§
Source§impl<'d, M: Mode> RngCore for Trng<'d, M>
impl<'d, M: Mode> RngCore for Trng<'d, M>
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
dest with random data. Read moreimpl<'d, M: Mode> CryptoRng for Trng<'d, M>
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> 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> CryptoRngCore for T
impl<T> CryptoRngCore for T
Source§fn as_rngcore(&mut self) -> &mut dyn RngCore
fn as_rngcore(&mut self) -> &mut dyn RngCore
RngCore trait object.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
UnwrapMut wrapper.