Skip to content

Commit a085e26

Browse files
committed
Merge branch 'v9.23.3-patches' into release-v9.23.3
2 parents e968d12 + 6162f5d commit a085e26

File tree

117 files changed

+17504
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+17504
-83
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ customers cannot upgrade their bootloader, its changes are recorded separately.
88

99
### [Unreleased]
1010

11+
### v9.23.3
12+
- Bluetooth: fix communication timeout when creating/restoring a wallet
13+
1114
### 9.23.2
1215
- Improve touch sensor reliability when the sdcard is inserted
1316

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ endif()
9595
#
9696
# Versions MUST contain three parts and start with lowercase 'v'.
9797
# Example 'v1.0.0'. They MUST not contain a pre-release label such as '-beta'.
98-
set(FIRMWARE_VERSION "v9.23.2")
99-
set(FIRMWARE_BTC_ONLY_VERSION "v9.23.2")
98+
set(FIRMWARE_VERSION "v9.23.3")
99+
set(FIRMWARE_BTC_ONLY_VERSION "v9.23.3")
100100
set(BOOTLOADER_VERSION "v1.1.1")
101101

102102
find_package(PythonInterp 3.6 REQUIRED)

src/keystore.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ keystore_error_t keystore_encrypt_and_store_seed(
240240
if (!_validate_seed_length(seed_length)) {
241241
return KEYSTORE_ERR_SEED_SIZE;
242242
}
243+
244+
usb_processing_timeout_reset(LONG_TIMEOUT);
245+
243246
if (securechip_init_new_password(password)) {
244247
return KEYSTORE_ERR_SECURECHIP;
245248
}

src/rust/Cargo.lock

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rust/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ sha3 = { version = "0.10.8", default-features = false }
4444
# writing, this might fluctuate over time).
4545
keccak = { version = "0.1.4", default-features = false, features = ["no_unroll"] }
4646
zeroize = "1.7.0"
47+
futures-lite = { version = "2.6.1", default-features = false }
4748

4849
[patch.crates-io]
4950
rtt-target = { git = "https://github.com/probe-rs/rtt-target.git", rev = "117d9519a5d3b1f4bc024bc05f9e3c5dec0a57f5" }

src/rust/bitbox02-rust/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ bitcoin = { workspace = true }
5656
# small-hash feature to reduce the binary size, saving around 2784 bytes (as measured at time of
5757
# writing, this might fluctuate over time).
5858
bitcoin_hashes = { version = "0.14.0", default-features = false, features = ["small-hash"] }
59+
futures-lite = { workspace = true }
5960

6061
[dependencies.prost]
6162
# keep version in sync with tools/prost-build/Cargo.toml.

src/rust/bitbox02-rust/src/backup.rs

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,18 @@ fn bitwise_recovery(buf1: &[u8], buf2: &[u8], buf3: &[u8]) -> Result<Zeroizing<V
158158
Ok(recovered_contents)
159159
}
160160

161-
pub fn load(
161+
pub async fn load(
162162
hal: &mut impl crate::hal::Hal,
163163
dir: &str,
164164
) -> Result<(Zeroizing<BackupData>, pb_backup::BackupMetaData), ()> {
165-
let files = hal.sd().list_subdir(Some(dir))?;
165+
let files = hal.sd().list_subdir(Some(dir)).await?;
166166
if files.len() != 3 {
167167
return Err(());
168168
}
169169
let file_contents: [Zeroizing<Vec<u8>>; 3] = [
170-
hal.sd().load_bin(&files[0], dir)?,
171-
hal.sd().load_bin(&files[1], dir)?,
172-
hal.sd().load_bin(&files[2], dir)?,
170+
hal.sd().load_bin(&files[0], dir).await?,
171+
hal.sd().load_bin(&files[1], dir).await?,
172+
hal.sd().load_bin(&files[2], dir).await?,
173173
];
174174
for contents in file_contents.iter() {
175175
if let o @ Ok(_) = load_from_buffer(contents) {
@@ -186,7 +186,7 @@ pub fn load(
186186
)?)
187187
}
188188

189-
pub fn create(
189+
pub async fn create(
190190
hal: &mut impl crate::hal::Hal,
191191
seed: &[u8],
192192
name: &str,
@@ -232,7 +232,11 @@ pub fn create(
232232
};
233233
let backup_encoded = backup.encode_to_vec();
234234
let dir = id(seed);
235-
let files = hal.sd().list_subdir(Some(&dir)).or(Err(Error::SdList))?;
235+
let files = hal
236+
.sd()
237+
.list_subdir(Some(&dir))
238+
.await
239+
.or(Err(Error::SdList))?;
236240

237241
let filename_datetime = {
238242
let tm = bitbox02::get_datetime(backup_create_timestamp).map_err(|_| Error::Generic)?;
@@ -255,10 +259,12 @@ pub fn create(
255259
}
256260
hal.sd()
257261
.write_bin(&filename, &dir, &backup_encoded)
262+
.await
258263
.or(Err(Error::SdWrite))?;
259264
if hal
260265
.sd()
261266
.load_bin(&filename, &dir)
267+
.await
262268
.or(Err(Error::SdRead))?
263269
.as_slice()
264270
!= backup_encoded.as_slice()
@@ -268,7 +274,7 @@ pub fn create(
268274
}
269275
let mut stale = false;
270276
for file in files {
271-
if hal.sd().erase_file_in_subdir(&file, &dir).is_err() {
277+
if hal.sd().erase_file_in_subdir(&file, &dir).await.is_err() {
272278
stale = true
273279
}
274280
}
@@ -285,6 +291,8 @@ mod tests {
285291
use crate::hal::testing::TestingHal;
286292
use core::convert::TryInto;
287293

294+
use crate::bb02_async::block_on;
295+
288296
#[test]
289297
fn test_id() {
290298
// Seeds of different lengths (16, 24, 32 bytes)
@@ -307,11 +315,21 @@ mod tests {
307315
let mut mock_hal = TestingHal::new();
308316
let timestamp = 1601281809;
309317
let birthdate = timestamp - 32400;
310-
assert!(create(&mut mock_hal, seed, "test name", timestamp, birthdate).is_ok());
318+
assert!(block_on(create(
319+
&mut mock_hal,
320+
seed,
321+
"test name",
322+
timestamp,
323+
birthdate
324+
))
325+
.is_ok());
311326
let dir = id(seed);
312-
assert_eq!(mock_hal.sd.list_subdir(None), Ok(vec![dir.clone()]));
313327
assert_eq!(
314-
mock_hal.sd.list_subdir(Some(&dir)),
328+
block_on(mock_hal.sd.list_subdir(None)),
329+
Ok(vec![dir.clone()])
330+
);
331+
assert_eq!(
332+
block_on(mock_hal.sd.list_subdir(Some(&dir))),
315333
Ok(vec![
316334
"backup_Mon_2020-09-28T08-30-09Z_0.bin".into(),
317335
"backup_Mon_2020-09-28T08-30-09Z_1.bin".into(),
@@ -320,42 +338,55 @@ mod tests {
320338
);
321339

322340
// Recreating using same timestamp is not allowed and doesn't change the backups.
323-
assert!(create(&mut mock_hal, seed, "new name", timestamp, birthdate).is_err());
341+
assert!(block_on(create(
342+
&mut mock_hal,
343+
seed,
344+
"new name",
345+
timestamp,
346+
birthdate
347+
))
348+
.is_err());
324349
assert_eq!(
325-
mock_hal.sd.list_subdir(Some(&dir)),
350+
block_on(mock_hal.sd.list_subdir(Some(&dir))),
326351
Ok(vec![
327352
"backup_Mon_2020-09-28T08-30-09Z_0.bin".into(),
328353
"backup_Mon_2020-09-28T08-30-09Z_1.bin".into(),
329354
"backup_Mon_2020-09-28T08-30-09Z_2.bin".into()
330355
])
331356
);
332357

333-
let contents: [zeroize::Zeroizing<Vec<u8>>; 3] = mock_hal
334-
.sd
335-
.list_subdir(Some(&dir))
336-
.unwrap()
337-
.iter()
338-
.map(|file| mock_hal.sd.load_bin(file, &dir).unwrap())
339-
.collect::<Vec<_>>()
340-
.try_into()
341-
.unwrap();
358+
let contents: [zeroize::Zeroizing<Vec<u8>>; 3] =
359+
block_on(mock_hal.sd.list_subdir(Some(&dir)))
360+
.unwrap()
361+
.iter()
362+
.map(|file| block_on(mock_hal.sd.load_bin(file, &dir)).unwrap())
363+
.collect::<Vec<_>>()
364+
.try_into()
365+
.unwrap();
342366
assert!(
343367
contents[0].as_slice() == contents[1].as_slice()
344368
&& contents[0].as_slice() == contents[2].as_slice()
345369
);
346370

347371
// Recreating the backup removes the previous files.
348-
assert!(create(&mut mock_hal, seed, "new name", timestamp + 1, birthdate).is_ok());
372+
assert!(block_on(create(
373+
&mut mock_hal,
374+
seed,
375+
"new name",
376+
timestamp + 1,
377+
birthdate
378+
))
379+
.is_ok());
349380
assert_eq!(
350-
mock_hal.sd.list_subdir(Some(&dir)),
381+
block_on(mock_hal.sd.list_subdir(Some(&dir))),
351382
Ok(vec![
352383
"backup_Mon_2020-09-28T08-30-10Z_0.bin".into(),
353384
"backup_Mon_2020-09-28T08-30-10Z_1.bin".into(),
354385
"backup_Mon_2020-09-28T08-30-10Z_2.bin".into()
355386
])
356387
);
357388

358-
let (backup_data, metadata) = load(&mut mock_hal, &dir).unwrap();
389+
let (backup_data, metadata) = block_on(load(&mut mock_hal, &dir)).unwrap();
359390
assert_eq!(backup_data.get_seed(), seed);
360391
assert_eq!(backup_data.0.birthdate, birthdate);
361392
assert_eq!(metadata.name.as_str(), "new name");

0 commit comments

Comments
 (0)