What changed, and why it matters
This is a small internal cleanup in the BitBox02 firmware. It changes two places that set the U2F security counter so they use a newer hardware-abstraction helper instead of calling the old low-level function directly. A test was also updated to match the new helper. There is no indication this fixes a security bug or changes device behavior for users.
No security action required. Treat as normal code-quality/maintenance review.
Security signals we found
No security-relevant behavior change: same U2F counter value is passed, and errors are still ignored intentionally.
No bounds checking, input validation, or cryptographic changes.
No vendor disclosure or advisory language in commit title/message.
No CVE or researcher attribution present in commit or supplied references.
Evidence from the diff
The commit refactors calls to bitbox02::securechip::u2f_counter_set(...) into hal.securechip().u2f_counter_set(...) in restore.rs (both from_file and from_mnemonic). It also updates the reset unit test to use the method-style call on the testing HAL. The change is gated by #[cfg(feature = "app-u2f")] and imports crate::hal::SecureChip only when that feature is enabled. This appears to be a consistency/cleanup patch to use the HAL abstraction that was previously introduced, not a functional security fix.
Changed components
src/rust/bitbox02-rust/src/hww/api/restore.rssrc/rust/bitbox02-rust/src/reset.rsInspect captured patch +6 / −4
diff --git a/src/rust/bitbox02-rust/src/hww/api/restore.rs b/src/rust/bitbox02-rust/src/hww/api/restore.rs
index fa78f4d..f723bf8 100644
--- a/src/rust/bitbox02-rust/src/hww/api/restore.rs
+++ b/src/rust/bitbox02-rust/src/hww/api/restore.rs
@@ -17,7 +17,10 @@ use crate::pb;
use pb::response::Response;
+#[cfg(feature = "app-u2f")]
+use crate::hal::SecureChip;
use crate::hal::Ui;
+
use crate::workflow::{confirm, mnemonic, password, unlock};
pub async fn from_file(
@@ -80,7 +83,7 @@ pub async fn from_file(
{
// Ignore error - the U2f counter not being set can lead to problems with U2F, but it should
// not fail the recovery, so the user can access their coins.
- let _ = bitbox02::securechip::u2f_counter_set(request.timestamp);
+ let _ = hal.securechip().u2f_counter_set(request.timestamp);
}
bitbox02::memory::set_initialized().or(Err(Error::Memory))?;
@@ -153,7 +156,7 @@ pub async fn from_mnemonic(
{
// Ignore error - the U2f counter not being set can lead to problems with U2F, but it should
// not fail the recovery, so the user can access their coins.
- let _ = bitbox02::securechip::u2f_counter_set(timestamp);
+ let _ = hal.securechip().u2f_counter_set(timestamp);
}
bitbox02::memory::set_initialized().or(Err(Error::Memory))?;
diff --git a/src/rust/bitbox02-rust/src/reset.rs b/src/rust/bitbox02-rust/src/reset.rs
index 4cb34c4..03ca91e 100644
--- a/src/rust/bitbox02-rust/src/reset.rs
+++ b/src/rust/bitbox02-rust/src/reset.rs
@@ -84,7 +84,6 @@ pub(crate) async fn reset(hal: &mut impl crate::hal::Hal, status: bool) {
mod tests {
use super::*;
- use crate::hal::SecureChip;
use crate::hal::testing::TestingHal;
use crate::keystore;
use crate::keystore::testing::mock_unlocked;
@@ -107,7 +106,7 @@ mod tests {
hal.securechip.mock_reset_keys_fails();
// Simulate a non-zero U2F counter before reset.
- SecureChip::u2f_counter_set(&mut hal.securechip, 42).unwrap();
+ hal.securechip.u2f_counter_set(42).unwrap();
hal.securechip.event_counter_reset();
block_on(reset(&mut hal, true));
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.