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:
Jesse Braham 2024-03-12 15:06:49 +00:00 committed by GitHub
parent d3a5dcce86
commit a0f3b39acc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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 {}

View File

@ -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 {