diff --git a/Cargo.toml b/Cargo.toml index 8f94d3c..dc2d056 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,10 @@ esp-mbedtls = { path = "./esp-mbedtls" } [target.xtensa-esp32s3-none-elf.dependencies] +[[example]] +name = "crypto_self_test" +required-features = ["esp-wifi/wifi-logs"] + [[example]] name = "async_client" required-features = ["async"] @@ -66,3 +70,12 @@ esp32s2 = ["esp32s2-hal/embassy-time-timg0", "esp-backtrace/esp32s2", "esp-print esp32s3 = ["esp32s3-hal/embassy-time-timg0", "esp-backtrace/esp32s3", "esp-println/esp32s3", "embassy-executor?/arch-xtensa", "esp-wifi/esp32s3", "esp-mbedtls/esp32s3"] async = ["esp-wifi/async", "esp-wifi/embassy-net", "embassy-executor", "embassy-net", "embassy-time", "embedded-io/async", "esp-mbedtls/async"] +[patch."https://github.com/esp-rs/esp-wifi.git"] +# Change PATH and patch for interrupt changes +esp-wifi = { package = "esp-wifi", path = "../esp-wifi/esp-wifi/" } + +[patch.crates-io] +esp32-hal = { package = "esp32-hal", git = "https://github.com/esp-rs/esp-hal.git", rev = "44e968f7a83f80be43d60cdc01c10eccab4b39cf" } +esp32c3-hal = { package = "esp32c3-hal", git = "https://github.com/esp-rs/esp-hal.git", rev = "44e968f7a83f80be43d60cdc01c10eccab4b39cf" } +esp32s2-hal = { package = "esp32s2-hal", git = "https://github.com/esp-rs/esp-hal.git", rev = "44e968f7a83f80be43d60cdc01c10eccab4b39cf" } +esp32s3-hal = { package = "esp32s3-hal", git = "https://github.com/esp-rs/esp-hal.git", rev = "44e968f7a83f80be43d60cdc01c10eccab4b39cf" } diff --git a/esp-mbedtls-sys/headers/esp32/config.h b/esp-mbedtls-sys/headers/esp32/config.h index 1f366db..b1c746b 100644 --- a/esp-mbedtls-sys/headers/esp32/config.h +++ b/esp-mbedtls-sys/headers/esp32/config.h @@ -3069,7 +3069,7 @@ * * This module adds support for SHA-224. */ -#define MBEDTLS_SHA224_C +// #define MBEDTLS_SHA224_C /** * \def MBEDTLS_SHA256_C diff --git a/esp-mbedtls-sys/headers/esp32c3/config.h b/esp-mbedtls-sys/headers/esp32c3/config.h index 7eb82a8..2dcb92a 100644 --- a/esp-mbedtls-sys/headers/esp32c3/config.h +++ b/esp-mbedtls-sys/headers/esp32c3/config.h @@ -331,7 +331,7 @@ //#define MBEDTLS_RIPEMD160_ALT //#define MBEDTLS_RSA_ALT //#define MBEDTLS_SHA1_ALT -//#define MBEDTLS_SHA256_ALT +#define MBEDTLS_SHA256_ALT //#define MBEDTLS_SHA512_ALT /* diff --git a/esp-mbedtls-sys/headers/esp32c3/sha256_alt.h b/esp-mbedtls-sys/headers/esp32c3/sha256_alt.h new file mode 100644 index 0000000..541f992 --- /dev/null +++ b/esp-mbedtls-sys/headers/esp32c3/sha256_alt.h @@ -0,0 +1,7 @@ + +typedef struct mbedtls_sha256_context { + void* peripheral; + void* hasher; +} mbedtls_sha256_context; + + diff --git a/esp-mbedtls-sys/src/include/esp32.rs b/esp-mbedtls-sys/src/include/esp32.rs index 34a5e23..fb9b3d5 100644 --- a/esp-mbedtls-sys/src/include/esp32.rs +++ b/esp-mbedtls-sys/src/include/esp32.rs @@ -152,8 +152,6 @@ pub const MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY: u32 = 1; pub const PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY: u32 = 1; pub const MBEDTLS_PSA_BUILTIN_ALG_SHA_1: u32 = 1; pub const PSA_WANT_ALG_SHA_1: u32 = 1; -pub const MBEDTLS_PSA_BUILTIN_ALG_SHA_224: u32 = 1; -pub const PSA_WANT_ALG_SHA_224: u32 = 1; pub const MBEDTLS_PSA_BUILTIN_ALG_SHA_256: u32 = 1; pub const PSA_WANT_ALG_SHA_256: u32 = 1; pub const MBEDTLS_PSA_BUILTIN_ALG_SHA_384: u32 = 1; @@ -13457,13 +13455,6 @@ extern "C" { is224: crate::c_types::c_int, ) -> crate::c_types::c_int; } -extern "C" { - /// \brief The SHA-224 checkup routine. - /// - /// \return \c 0 on success. - /// \return \c 1 on failure. - pub fn mbedtls_sha224_self_test(verbose: crate::c_types::c_int) -> crate::c_types::c_int; -} extern "C" { /// \brief The SHA-256 checkup routine. /// diff --git a/esp-mbedtls-sys/src/include/esp32c3.rs b/esp-mbedtls-sys/src/include/esp32c3.rs index 02e7202..2039009 100644 --- a/esp-mbedtls-sys/src/include/esp32c3.rs +++ b/esp-mbedtls-sys/src/include/esp32c3.rs @@ -13324,18 +13324,11 @@ extern "C" { /// \return \c 1 on failure. pub fn mbedtls_sha1_self_test(verbose: crate::c_types::c_int) -> crate::c_types::c_int; } -/// \brief The SHA-256 context structure. -/// -/// The structure is used both for SHA-256 and for SHA-224 -/// checksum calculations. The choice between these two is -/// made in the call to mbedtls_sha256_starts(). #[repr(C)] #[derive(Copy, Clone)] pub struct mbedtls_sha256_context { - pub private_total: [u32; 2usize], - pub private_state: [u32; 8usize], - pub private_buffer: [crate::c_types::c_uchar; 64usize], - pub private_is224: crate::c_types::c_int, + pub peripheral: *mut crate::c_types::c_void, + pub hasher: *mut crate::c_types::c_void, } extern "C" { /// \brief This function initializes a SHA-256 context. diff --git a/esp-mbedtls/Cargo.toml b/esp-mbedtls/Cargo.toml index ed87ba4..0e5ac07 100644 --- a/esp-mbedtls/Cargo.toml +++ b/esp-mbedtls/Cargo.toml @@ -11,6 +11,7 @@ esp32-hal = { version = "0.15.0", optional = true } esp32c3-hal = { version = "0.12.0", optional = true } esp32s2-hal = { version = "0.12.0", optional = true } esp32s3-hal = { version = "0.12.0", optional = true } +nb = "1.1.0" [features] async = ["embedded-io/async"] diff --git a/esp-mbedtls/src/compat.rs b/esp-mbedtls/src/compat.rs index 6f4ef58..48fb52f 100644 --- a/esp-mbedtls/src/compat.rs +++ b/esp-mbedtls/src/compat.rs @@ -2,8 +2,8 @@ use core::ffi::VaListImpl; use core::fmt::Write; #[no_mangle] -extern "C" fn putchar() { - todo!() +extern "C" fn putchar(c: crate::c_int) { + log::info!("{c}"); } #[no_mangle] diff --git a/esp-mbedtls/src/lib.rs b/esp-mbedtls/src/lib.rs index 1c5f4d5..1a34dcd 100644 --- a/esp-mbedtls/src/lib.rs +++ b/esp-mbedtls/src/lib.rs @@ -29,6 +29,26 @@ use embedded_io::Io; use esp_mbedtls_sys::bindings::*; use esp_mbedtls_sys::c_types::*; +/// Re-export self-tests +pub use esp_mbedtls_sys::bindings::{ + // AES + mbedtls_aes_self_test, + // MD5 + mbedtls_md5_self_test, + // RSA + mbedtls_rsa_self_test, + // SHA + mbedtls_sha1_self_test, + mbedtls_sha256_self_test, + mbedtls_sha384_self_test, + mbedtls_sha512_self_test, +}; + +#[cfg(not(feature = "esp32"))] +pub use esp_mbedtls_sys::bindings::mbedtls_sha224_self_test; + +mod sha; + // these will come from esp-wifi (i.e. this can only be used together with esp-wifi) extern "C" { fn free(ptr: *const u8); diff --git a/esp-mbedtls/src/sha/mod.rs b/esp-mbedtls/src/sha/mod.rs new file mode 100644 index 0000000..db88c2f --- /dev/null +++ b/esp-mbedtls/src/sha/mod.rs @@ -0,0 +1,15 @@ +//! Re-export SHA Hardware implementation based on availability. +//! +//! # Hardware support +//! This does not reflect the current implementation but rather the support +//! for the SHA modes on the specific SoCs. +//! +//! | Modes | esp32 | esp32c3 | esp32s2 | esp32s3 | +//! | ------- | ------- | ------- | ------- | ------- | +//! | SHA1 | ✓ | ✓ | ✓ | ✓ | +//! | SHA224 | x | ✓ | ✓ | ✓ | +//! | SHA256 | ✓ | ✓ | ✓ | ✓ | +//! | SHA384 | ✓ | x | ✓ | ✓ | +//! | SHA512 | ✓ | x | ✓ | ✓ | + +mod sha256; diff --git a/esp-mbedtls/src/sha/sha256.rs b/esp-mbedtls/src/sha/sha256.rs new file mode 100644 index 0000000..164a388 --- /dev/null +++ b/esp-mbedtls/src/sha/sha256.rs @@ -0,0 +1,77 @@ +use crate::hal::peripherals::SHA; +use crate::hal::sha::Sha; +use crate::hal::sha::ShaMode; +use esp_mbedtls_sys::c_types::*; +use nb::block; + +#[repr(C)] +pub struct mbedtls_sha256_context<'a> { + peripheral: SHA, + hasher: Sha<'a>, +} + +#[no_mangle] +pub unsafe extern "C" fn mbedtls_sha256_init(ctx: *mut mbedtls_sha256_context) { + (*ctx).peripheral = SHA::steal(); +} + +#[no_mangle] +pub unsafe extern "C" fn mbedtls_sha256_free(_ctx: *mut mbedtls_sha256_context) { + // Do nothing +} + +#[no_mangle] +pub unsafe extern "C" fn mbedtls_sha256_clone<'a>( + dst: *mut mbedtls_sha256_context<'a>, + src: *const mbedtls_sha256_context<'a>, +) { + core::ptr::copy_nonoverlapping(src, dst, 1) +} + +#[allow(unused_variables)] +#[no_mangle] +pub unsafe extern "C" fn mbedtls_sha256_starts( + ctx: *mut mbedtls_sha256_context, + is224: c_int, +) -> c_int { + #[cfg(not(feature = "esp32"))] + let mode = if is224 == 1 { + ShaMode::SHA224 + } else { + ShaMode::SHA256 + }; + + #[cfg(feature = "esp32")] + let mode = ShaMode::SHA256; + + let hasher = Sha::new(&mut (*ctx).peripheral, mode); + + (*ctx).hasher = hasher; + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn mbedtls_sha256_update( + ctx: *mut mbedtls_sha256_context, + input: *const c_uchar, + ilen: usize, +) -> c_int { + let slice = core::ptr::slice_from_raw_parts(input as *const u8, ilen as usize); + let mut remaining = &*slice; + + while remaining.len() > 0 { + remaining = block!((*ctx).hasher.update(remaining)).unwrap(); + } + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn mbedtls_sha256_finish( + ctx: *mut mbedtls_sha256_context, + output: *mut c_uchar, +) -> c_int { + let mut data = [0u8; 32]; + block!((*ctx).hasher.finish(&mut data)).unwrap(); + core::ptr::copy_nonoverlapping(data.as_ptr(), output, data.len()); + 0 +} diff --git a/examples/async_client.rs b/examples/async_client.rs index 1944c2c..535c5cb 100644 --- a/examples/async_client.rs +++ b/examples/async_client.rs @@ -54,22 +54,13 @@ fn main() -> ! { init_logger(log::LevelFilter::Info); let peripherals = Peripherals::take(); - #[cfg(feature = "esp32")] - let mut system = peripherals.DPORT.split(); - #[cfg(not(feature = "esp32"))] - #[allow(unused_mut)] - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::max(system.clock_control).freeze(); #[cfg(feature = "esp32c3")] let timer = hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0; #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] - let timer = hal::timer::TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0; + let timer = hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0; let init = initialize( EspWifiInitFor::Wifi, timer, @@ -86,11 +77,7 @@ fn main() -> ! { let (wifi_interface, controller) = esp_wifi::wifi::new_with_mode(&init, wifi, WifiMode::Sta).unwrap(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let config = Config::dhcpv4(Default::default()); diff --git a/examples/async_client_mTLS.rs b/examples/async_client_mTLS.rs index bbda903..b4d144b 100644 --- a/examples/async_client_mTLS.rs +++ b/examples/async_client_mTLS.rs @@ -54,22 +54,13 @@ fn main() -> ! { init_logger(log::LevelFilter::Info); let peripherals = Peripherals::take(); - #[cfg(feature = "esp32")] - let mut system = peripherals.DPORT.split(); - #[cfg(not(feature = "esp32"))] - #[allow(unused_mut)] - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::max(system.clock_control).freeze(); #[cfg(feature = "esp32c3")] let timer = hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0; #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] - let timer = hal::timer::TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0; + let timer = hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0; let init = initialize( EspWifiInitFor::Wifi, timer, @@ -86,11 +77,7 @@ fn main() -> ! { let (wifi_interface, controller) = esp_wifi::wifi::new_with_mode(&init, wifi, WifiMode::Sta).unwrap(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let config = Config::dhcpv4(Default::default()); diff --git a/examples/async_server.rs b/examples/async_server.rs index a8beeb3..153ffa5 100644 --- a/examples/async_server.rs +++ b/examples/async_server.rs @@ -58,22 +58,13 @@ fn main() -> ! { init_logger(log::LevelFilter::Info); let peripherals = Peripherals::take(); - #[cfg(feature = "esp32")] - let mut system = peripherals.DPORT.split(); - #[cfg(not(feature = "esp32"))] - #[allow(unused_mut)] - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::max(system.clock_control).freeze(); #[cfg(feature = "esp32c3")] let timer = hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0; #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] - let timer = hal::timer::TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0; + let timer = hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0; let init = initialize( EspWifiInitFor::Wifi, timer, @@ -90,11 +81,7 @@ fn main() -> ! { let (wifi_interface, controller) = esp_wifi::wifi::new_with_mode(&init, wifi, WifiMode::Sta).unwrap(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let config = Config::dhcpv4(Default::default()); diff --git a/examples/async_server_mTLS.rs b/examples/async_server_mTLS.rs index 824ee3e..8d7e4e4 100644 --- a/examples/async_server_mTLS.rs +++ b/examples/async_server_mTLS.rs @@ -75,22 +75,13 @@ fn main() -> ! { init_logger(log::LevelFilter::Info); let peripherals = Peripherals::take(); - #[cfg(feature = "esp32")] - let mut system = peripherals.DPORT.split(); - #[cfg(not(feature = "esp32"))] - #[allow(unused_mut)] - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::max(system.clock_control).freeze(); #[cfg(feature = "esp32c3")] let timer = hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0; #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] - let timer = hal::timer::TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0; + let timer = hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0; let init = initialize( EspWifiInitFor::Wifi, timer, @@ -107,11 +98,7 @@ fn main() -> ! { let (wifi_interface, controller) = esp_wifi::wifi::new_with_mode(&init, wifi, WifiMode::Sta).unwrap(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let config = Config::dhcpv4(Default::default()); diff --git a/examples/crypto_self_test.rs b/examples/crypto_self_test.rs new file mode 100644 index 0000000..b5fac2d --- /dev/null +++ b/examples/crypto_self_test.rs @@ -0,0 +1,80 @@ +//! Run crypto self tests to ensure their functionnality +#![no_std] +#![no_main] + +#[doc(hidden)] +#[cfg(feature = "esp32")] +pub use esp32_hal as hal; +#[doc(hidden)] +#[cfg(feature = "esp32c3")] +pub use esp32c3_hal as hal; +#[doc(hidden)] +#[cfg(feature = "esp32s2")] +pub use esp32s2_hal as hal; +#[doc(hidden)] +#[cfg(feature = "esp32s3")] +pub use esp32s3_hal as hal; + +use esp_backtrace as _; +use esp_mbedtls::set_debug; +use esp_println::{logger::init_logger, println}; + +/// Only used for ROM functions +#[allow(unused_imports)] +use esp_wifi::{initialize, EspWifiInitFor}; +use hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Rng}; + +#[entry] +fn main() -> ! { + init_logger(log::LevelFilter::Info); + + // Init ESP-WIFI heap for malloc + let peripherals = Peripherals::take(); + #[cfg(feature = "esp32")] + let mut system = peripherals.DPORT.split(); + #[cfg(not(feature = "esp32"))] + #[allow(unused_mut)] + let mut system = peripherals.SYSTEM.split(); + let clocks = ClockControl::max(system.clock_control).freeze(); + + #[cfg(feature = "esp32c3")] + let timer = hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0; + #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] + let timer = hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0; + let _ = initialize( + EspWifiInitFor::Wifi, + timer, + Rng::new(peripherals.RNG), + system.radio_clock_control, + &clocks, + ) + .unwrap(); + + set_debug(0); + + // println!("Testing AES"); + // unsafe { + // esp_mbedtls::mbedtls_aes_self_test(1i32); + // } + // println!("Testing MD5"); + // unsafe { + // esp_mbedtls::mbedtls_md5_self_test(1i32); + // } + // println!("Testing RSA"); + // unsafe { + // esp_mbedtls::mbedtls_rsa_self_test(1i32); + // } + println!("Testing SHA"); + unsafe { + // esp_mbedtls::mbedtls_sha1_self_test(1i32); + #[cfg(not(feature = "esp32"))] + esp_mbedtls::mbedtls_sha224_self_test(1i32); + esp_mbedtls::mbedtls_sha256_self_test(1i32); + // esp_mbedtls::mbedtls_sha384_self_test(1i32); + esp_mbedtls::mbedtls_sha512_self_test(1i32); + } + + println!("Done"); + + loop {} +} diff --git a/examples/sync_client.rs b/examples/sync_client.rs index f82b4a3..35081dd 100644 --- a/examples/sync_client.rs +++ b/examples/sync_client.rs @@ -42,22 +42,13 @@ fn main() -> ! { init_logger(log::LevelFilter::Info); let peripherals = Peripherals::take(); - #[cfg(feature = "esp32")] - let mut system = peripherals.DPORT.split(); - #[cfg(not(feature = "esp32"))] - #[allow(unused_mut)] - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::max(system.clock_control).freeze(); #[cfg(feature = "esp32c3")] let timer = hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0; #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] - let timer = hal::timer::TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0; + let timer = hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0; let init = initialize( EspWifiInitFor::Wifi, timer, diff --git a/examples/sync_client_mTLS.rs b/examples/sync_client_mTLS.rs index be6916b..ad057bf 100644 --- a/examples/sync_client_mTLS.rs +++ b/examples/sync_client_mTLS.rs @@ -42,22 +42,13 @@ fn main() -> ! { init_logger(log::LevelFilter::Info); let peripherals = Peripherals::take(); - #[cfg(feature = "esp32")] - let mut system = peripherals.DPORT.split(); - #[cfg(not(feature = "esp32"))] - #[allow(unused_mut)] - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::max(system.clock_control).freeze(); #[cfg(feature = "esp32c3")] let timer = hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0; #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] - let timer = hal::timer::TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0; + let timer = hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0; let init = initialize( EspWifiInitFor::Wifi, timer, diff --git a/examples/sync_server.rs b/examples/sync_server.rs index 662dade..776947b 100644 --- a/examples/sync_server.rs +++ b/examples/sync_server.rs @@ -45,22 +45,13 @@ fn main() -> ! { init_logger(log::LevelFilter::Info); let peripherals = Peripherals::take(); - #[cfg(feature = "esp32")] - let mut system = peripherals.DPORT.split(); - #[cfg(not(feature = "esp32"))] - #[allow(unused_mut)] - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::max(system.clock_control).freeze(); #[cfg(feature = "esp32c3")] let timer = hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0; #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] - let timer = hal::timer::TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0; + let timer = hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0; let init = initialize( EspWifiInitFor::Wifi, timer, diff --git a/examples/sync_server_mTLS.rs b/examples/sync_server_mTLS.rs index f93199d..5747604 100644 --- a/examples/sync_server_mTLS.rs +++ b/examples/sync_server_mTLS.rs @@ -62,22 +62,13 @@ fn main() -> ! { init_logger(log::LevelFilter::Info); let peripherals = Peripherals::take(); - #[cfg(feature = "esp32")] - let mut system = peripherals.DPORT.split(); - #[cfg(not(feature = "esp32"))] - #[allow(unused_mut)] - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::max(system.clock_control).freeze(); #[cfg(feature = "esp32c3")] let timer = hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0; #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] - let timer = hal::timer::TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0; + let timer = hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0; let init = initialize( EspWifiInitFor::Wifi, timer, diff --git a/libs/riscv32imc-unknown-none-elf/libmbedcrypto.a b/libs/riscv32imc-unknown-none-elf/libmbedcrypto.a index 3959f1c..dc6817c 100644 Binary files a/libs/riscv32imc-unknown-none-elf/libmbedcrypto.a and b/libs/riscv32imc-unknown-none-elf/libmbedcrypto.a differ diff --git a/libs/riscv32imc-unknown-none-elf/libmbedtls.a b/libs/riscv32imc-unknown-none-elf/libmbedtls.a index 386d96f..2a5d39a 100644 Binary files a/libs/riscv32imc-unknown-none-elf/libmbedtls.a and b/libs/riscv32imc-unknown-none-elf/libmbedtls.a differ diff --git a/libs/xtensa-esp32-none-elf/libmbedcrypto.a b/libs/xtensa-esp32-none-elf/libmbedcrypto.a index 248fbd8..70f8623 100644 Binary files a/libs/xtensa-esp32-none-elf/libmbedcrypto.a and b/libs/xtensa-esp32-none-elf/libmbedcrypto.a differ diff --git a/libs/xtensa-esp32-none-elf/libmbedtls.a b/libs/xtensa-esp32-none-elf/libmbedtls.a index 0e8d78c..6cdcddb 100644 Binary files a/libs/xtensa-esp32-none-elf/libmbedtls.a and b/libs/xtensa-esp32-none-elf/libmbedtls.a differ diff --git a/libs/xtensa-esp32-none-elf/libmbedx509.a b/libs/xtensa-esp32-none-elf/libmbedx509.a index 6ee249a..2112444 100644 Binary files a/libs/xtensa-esp32-none-elf/libmbedx509.a and b/libs/xtensa-esp32-none-elf/libmbedx509.a differ diff --git a/libs/xtensa-esp32s2-none-elf/libmbedcrypto.a b/libs/xtensa-esp32s2-none-elf/libmbedcrypto.a index 14c6f34..18eccae 100644 Binary files a/libs/xtensa-esp32s2-none-elf/libmbedcrypto.a and b/libs/xtensa-esp32s2-none-elf/libmbedcrypto.a differ diff --git a/libs/xtensa-esp32s3-none-elf/libmbedcrypto.a b/libs/xtensa-esp32s3-none-elf/libmbedcrypto.a index 248fbd8..291cc3b 100644 Binary files a/libs/xtensa-esp32s3-none-elf/libmbedcrypto.a and b/libs/xtensa-esp32s3-none-elf/libmbedcrypto.a differ