Do not ensure randomness or implement CryptoRng for ESP32-P4/S2 (#1267)
* Do not ensure randomness or implement `CryptoRng` for ESP32-P4/S2 * Update `CHANGELOG.md` * Make `clippy` happy
This commit is contained in:
parent
d3a5dcce86
commit
a0f3b39acc
@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Changed
|
||||
|
||||
- Do not ensure randomness or implement the `CryptoRng` trait for ESP32-P4/S2 (#1267)
|
||||
|
||||
### Removed
|
||||
|
||||
## [0.16.0] - 2024-03-08
|
||||
|
||||
@ -65,8 +65,6 @@
|
||||
|
||||
use core::{convert::Infallible, marker::PhantomData};
|
||||
|
||||
use rand_core::{CryptoRng, RngCore};
|
||||
|
||||
use crate::{peripheral::Peripheral, peripherals::RNG};
|
||||
|
||||
/// Random number generator driver
|
||||
@ -78,7 +76,7 @@ pub struct Rng {
|
||||
impl Rng {
|
||||
/// Create a new random number generator instance
|
||||
pub fn new(_rng: impl Peripheral<P = RNG>) -> Self {
|
||||
#[cfg(not(esp32p4))]
|
||||
#[cfg(not(any(esp32p4, esp32s2)))]
|
||||
crate::soc::trng::ensure_randomness();
|
||||
|
||||
Self {
|
||||
@ -110,7 +108,7 @@ impl embedded_hal::blocking::rng::Read for Rng {
|
||||
}
|
||||
}
|
||||
|
||||
impl RngCore for Rng {
|
||||
impl rand_core::RngCore for Rng {
|
||||
fn next_u32(&mut self) -> u32 {
|
||||
// Directly use the existing random method to get a u32 random number
|
||||
self.random()
|
||||
@ -140,4 +138,5 @@ impl RngCore for Rng {
|
||||
}
|
||||
}
|
||||
|
||||
impl CryptoRng for Rng {}
|
||||
#[cfg(not(any(esp32p4, esp32s2)))]
|
||||
impl rand_core::CryptoRng for Rng {}
|
||||
|
||||
@ -18,7 +18,7 @@ pub mod peripherals;
|
||||
#[cfg(psram)]
|
||||
pub mod psram;
|
||||
pub mod radio_clocks;
|
||||
pub mod trng;
|
||||
// pub mod trng;
|
||||
pub mod ulp_core;
|
||||
|
||||
pub(crate) mod constants {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user