diff options
| author | René van Dorst <[email protected]> | 2025-08-19 17:02:36 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-19 17:02:36 +0200 |
| commit | 52464b35367f14797bf2757432163fa9dccc2361 (patch) | |
| tree | 78805e8f9d32b3cfee388a078eae5ca8af44400b /embassy-stm32 | |
| parent | 8aac4aa9d3fc7ee8a4825dd723f36bb1c6020a82 (diff) | |
| parent | 61dbd89bd4648cc6b16017bbbf4db8f5fdcb109a (diff) | |
Merge branch 'main' into i2c-pull-down-fix
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/CHANGELOG.md | 5 | ||||
| -rw-r--r-- | embassy-stm32/Cargo.toml | 8 | ||||
| -rw-r--r-- | embassy-stm32/src/hash/mod.rs | 16 |
3 files changed, 19 insertions, 10 deletions
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md index 26b643aa0..301c20055 100644 --- a/embassy-stm32/CHANGELOG.md +++ b/embassy-stm32/CHANGELOG.md | |||
| @@ -8,8 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 8 | <!-- next-header --> | 8 | <!-- next-header --> |
| 9 | ## Unreleased - ReleaseDate | 9 | ## Unreleased - ReleaseDate |
| 10 | 10 | ||
| 11 | - fix: Fix vrefbuf building with log feature | ||
| 12 | - fix: stm32/i2c: pull-down was enabled instead of pull-none when no internal pull-up was needed. | 11 | - fix: stm32/i2c: pull-down was enabled instead of pull-none when no internal pull-up was needed. |
| 12 | - feat: Improve blocking hash speed | ||
| 13 | - fix: Fix vrefbuf building with log feature | ||
| 14 | - fix: Fix performing a hash after performing a hmac | ||
| 15 | - chore: Updated stm32-metapac and stm32-data dependencies | ||
| 13 | 16 | ||
| 14 | ## 0.3.0 - 2025-08-12 | 17 | ## 0.3.0 - 2025-08-12 |
| 15 | 18 | ||
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 691ce3b90..45b351acf 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml | |||
| @@ -80,8 +80,8 @@ cortex-m = "0.7.6" | |||
| 80 | futures-util = { version = "0.3.30", default-features = false } | 80 | futures-util = { version = "0.3.30", default-features = false } |
| 81 | sdio-host = "0.9.0" | 81 | sdio-host = "0.9.0" |
| 82 | critical-section = "1.1" | 82 | critical-section = "1.1" |
| 83 | stm32-metapac = { version = "17" } | 83 | # stm32-metapac = { version = "17" } |
| 84 | # stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-9941f338734a2e6c1652267f64b13f7b35d8c9db" } | 84 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ecb93d42a6cbcd9e09cab74873908a2ca22327f7" } |
| 85 | 85 | ||
| 86 | vcell = "0.1.3" | 86 | vcell = "0.1.3" |
| 87 | nb = "1.0.0" | 87 | nb = "1.0.0" |
| @@ -109,8 +109,8 @@ proptest-state-machine = "0.3.0" | |||
| 109 | proc-macro2 = "1.0.36" | 109 | proc-macro2 = "1.0.36" |
| 110 | quote = "1.0.15" | 110 | quote = "1.0.15" |
| 111 | 111 | ||
| 112 | stm32-metapac = { version = "17", default-features = false, features = ["metadata"]} | 112 | # stm32-metapac = { version = "17", default-features = false, features = ["metadata"]} |
| 113 | #stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-9941f338734a2e6c1652267f64b13f7b35d8c9db", default-features = false, features = ["metadata"] } | 113 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ecb93d42a6cbcd9e09cab74873908a2ca22327f7", default-features = false, features = ["metadata"] } |
| 114 | 114 | ||
| 115 | [features] | 115 | [features] |
| 116 | default = ["rt"] | 116 | default = ["rt"] |
diff --git a/embassy-stm32/src/hash/mod.rs b/embassy-stm32/src/hash/mod.rs index e62151bb5..90c06c0d8 100644 --- a/embassy-stm32/src/hash/mod.rs +++ b/embassy-stm32/src/hash/mod.rs | |||
| @@ -198,6 +198,8 @@ impl<'d, T: Instance, M: Mode> Hash<'d, T, M> { | |||
| 198 | if key.len() > 64 { | 198 | if key.len() > 64 { |
| 199 | T::regs().cr().modify(|w| w.set_lkey(true)); | 199 | T::regs().cr().modify(|w| w.set_lkey(true)); |
| 200 | } | 200 | } |
| 201 | } else { | ||
| 202 | T::regs().cr().modify(|w| w.set_mode(false)); | ||
| 201 | } | 203 | } |
| 202 | 204 | ||
| 203 | T::regs().cr().modify(|w| w.set_init(true)); | 205 | T::regs().cr().modify(|w| w.set_init(true)); |
| @@ -351,13 +353,17 @@ impl<'d, T: Instance, M: Mode> Hash<'d, T, M> { | |||
| 351 | let num_valid_bits: u8 = (8 * (input.len() % 4)) as u8; | 353 | let num_valid_bits: u8 = (8 * (input.len() % 4)) as u8; |
| 352 | T::regs().str().modify(|w| w.set_nblw(num_valid_bits)); | 354 | T::regs().str().modify(|w| w.set_nblw(num_valid_bits)); |
| 353 | 355 | ||
| 354 | let mut i = 0; | 356 | let mut chunks = input.chunks_exact(4); |
| 355 | while i < input.len() { | 357 | for chunk in &mut chunks { |
| 358 | T::regs() | ||
| 359 | .din() | ||
| 360 | .write_value(u32::from_ne_bytes(chunk.try_into().unwrap())); | ||
| 361 | } | ||
| 362 | let rem = chunks.remainder(); | ||
| 363 | if !rem.is_empty() { | ||
| 356 | let mut word: [u8; 4] = [0; 4]; | 364 | let mut word: [u8; 4] = [0; 4]; |
| 357 | let copy_idx = min(i + 4, input.len()); | 365 | word[0..rem.len()].copy_from_slice(rem); |
| 358 | word[0..copy_idx - i].copy_from_slice(&input[i..copy_idx]); | ||
| 359 | T::regs().din().write_value(u32::from_ne_bytes(word)); | 366 | T::regs().din().write_value(u32::from_ne_bytes(word)); |
| 360 | i += 4; | ||
| 361 | } | 367 | } |
| 362 | } | 368 | } |
| 363 | 369 | ||
