Skip to content

Commit c94224a

Browse files
committed
Merge branch 'protected-write'
2 parents c28cc55 + da75ba1 commit c94224a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/rust/bitbox02-rust/src/hww/api/bluetooth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async fn _process_upgrade(
106106
firmware_checksum ^= byte;
107107
}
108108

109-
spi_mem::write(inactive_ble_fw_address + chunk_offset, &chunk)
109+
spi_mem::write_protected(inactive_ble_fw_address + chunk_offset, &chunk)
110110
.map_err(|_| Error::Memory)?;
111111

112112
// Update progress.

src/rust/bitbox02-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const ALLOWLIST_FNS: &[&str] = &[
114114
"memory_get_platform",
115115
"memory_get_securechip_type",
116116
"memory_spi_get_active_ble_firmware_version",
117-
"spi_mem_write",
117+
"spi_mem_protected_area_write",
118118
"menu_create",
119119
"mock_memory_factoryreset",
120120
"spi_mem_full_erase",

src/rust/bitbox02/src/spi_mem.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ pub use bitbox02_sys::MEMORY_SPI_BLE_FIRMWARE_MAX_SIZE as BLE_FIRMWARE_MAX_SIZE;
2020

2121
use alloc::string::String;
2222

23-
pub fn write(address: u32, data: &[u8]) -> Result<(), ()> {
24-
match unsafe { bitbox02_sys::spi_mem_write(address, data.as_ptr(), data.len()) } {
23+
pub fn write_protected(address: u32, data: &[u8]) -> Result<(), ()> {
24+
match unsafe { bitbox02_sys::spi_mem_protected_area_write(address, data.as_ptr(), data.len()) }
25+
{
2526
true => Ok(()),
2627
false => Err(()),
2728
}

0 commit comments

Comments
 (0)