diff options
| author | Gerhard de Clercq <[email protected]> | 2025-04-15 20:16:09 +0200 |
|---|---|---|
| committer | Gerhard de Clercq <[email protected]> | 2025-05-23 12:40:19 +0200 |
| commit | 68a45490fc1675f2171131ccbf01f690c4123f01 (patch) | |
| tree | 42606d9fa51bf50e6d7d84623123616600a70cce /embassy-boot/src/firmware_updater/blocking.rs | |
| parent | f7405493c184ce453ac3f7ba97f7f2689f978194 (diff) | |
[embassy-usb-dfu] support ed25519 verification
This commit adds the ability to verify that USB DFU updates are correctly signed using ed25519.
This required adding support to embassy-boot for reading from the DFU partition.
Diffstat (limited to 'embassy-boot/src/firmware_updater/blocking.rs')
| -rw-r--r-- | embassy-boot/src/firmware_updater/blocking.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/embassy-boot/src/firmware_updater/blocking.rs b/embassy-boot/src/firmware_updater/blocking.rs index 08062b0d0..0fedac1ea 100644 --- a/embassy-boot/src/firmware_updater/blocking.rs +++ b/embassy-boot/src/firmware_updater/blocking.rs | |||
| @@ -196,6 +196,17 @@ impl<'d, DFU: NorFlash, STATE: NorFlash> BlockingFirmwareUpdater<'d, DFU, STATE> | |||
| 196 | Ok(()) | 196 | Ok(()) |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | /// Read a slice of data from the DFU storage peripheral, starting the read | ||
| 200 | /// operation at the given address offset, and reading `buf.len()` bytes. | ||
| 201 | /// | ||
| 202 | /// # Errors | ||
| 203 | /// | ||
| 204 | /// Returns an error if the arguments are not aligned or out of bounds. | ||
| 205 | pub fn read_dfu(&mut self, offset: u32, buf: &mut [u8]) -> Result<(), FirmwareUpdaterError> { | ||
| 206 | self.dfu.read(offset, buf)?; | ||
| 207 | Ok(()) | ||
| 208 | } | ||
| 209 | |||
| 199 | /// Mark to trigger firmware swap on next boot. | 210 | /// Mark to trigger firmware swap on next boot. |
| 200 | #[cfg(not(feature = "_verify"))] | 211 | #[cfg(not(feature = "_verify"))] |
| 201 | pub fn mark_updated(&mut self) -> Result<(), FirmwareUpdaterError> { | 212 | pub fn mark_updated(&mut self) -> Result<(), FirmwareUpdaterError> { |
