Simulate securechip stretching as well
What changed, and why it matters
This commit only changes the graphical simulator used for testing the BitBox02 firmware. It adds a one-second artificial delay to the simulated secure chip's key-stretching function so that developers can visually test the unlock animation. It does not affect the real hardware firmware or any user-facing security behavior.
No security action required. This is a benign simulator-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch introduces a simulator-graphical feature flag in bitbox-platform-host and, when that flag is enabled (and testing is not), inserts an awaited 1000 ms delay inside the host-side FakeSecureChip::stretch implementation. The graphical simulator crates are updated to enable this feature. This is purely a test/UX simulation change; the real secure-chip stretching path on device is untouched.
Changed components
src/rust/bitbox-platform-host/src/securechip.rssrc/rust/bitbox-platform-host/Cargo.tomlsrc/rust/bitbox02-rust/Cargo.tomltest/simulator-graphical-bb03/Cargo.tomltest/simulator-graphical/Cargo.tomlInspect captured patch +14 / −2
diff --git a/src/rust/bitbox-platform-host/Cargo.toml b/src/rust/bitbox-platform-host/Cargo.toml
index 56b48ea..991e52d 100644
--- a/src/rust/bitbox-platform-host/Cargo.toml
+++ b/src/rust/bitbox-platform-host/Cargo.toml
@@ -15,6 +15,8 @@ zeroize = { workspace = true }
[features]
app-u2f = ["bitbox-hal/app-u2f"]
+simulator-graphical = []
+testing = []
[dev-dependencies]
async_test = { path = "../async_test" }
diff --git a/src/rust/bitbox-platform-host/src/securechip.rs b/src/rust/bitbox-platform-host/src/securechip.rs
index a785d25..aa6321f 100644
--- a/src/rust/bitbox-platform-host/src/securechip.rs
+++ b/src/rust/bitbox-platform-host/src/securechip.rs
@@ -3,6 +3,9 @@
use alloc::collections::VecDeque;
use alloc::{boxed::Box, vec::Vec};
+#[cfg(all(feature = "simulator-graphical", not(feature = "testing")))]
+use bitbox_hal::Timer;
+
use bitcoin::hashes::Hash;
use hex_lit::hex;
@@ -128,6 +131,12 @@ impl bitbox_hal::SecureChip for FakeSecureChip {
));
engine.input(msg);
let hmac_result: Hmac<sha256::Hash> = Hmac::from_engine(engine);
+
+ // Keep KDF completion visibly delayed on the host so unlock animation start/play can be
+ // manually tested in the graphical simulators.
+ #[cfg(all(feature = "simulator-graphical", not(feature = "testing")))]
+ crate::timer::HostTimer::delay_for(core::time::Duration::from_millis(1000)).await;
+
Ok(Box::new(zeroize::Zeroizing::new(
hmac_result.to_byte_array(),
)))
diff --git a/src/rust/bitbox02-rust/Cargo.toml b/src/rust/bitbox02-rust/Cargo.toml
index 81208f7..757c54f 100644
--- a/src/rust/bitbox02-rust/Cargo.toml
+++ b/src/rust/bitbox02-rust/Cargo.toml
@@ -100,6 +100,7 @@ app-cardano = [
testing = [
"dep:bitbox-platform-host",
+ "bitbox-platform-host?/testing",
"bitbox02/testing",
"bitbox-secp256k1/testing",
"util/testing"
diff --git a/test/simulator-graphical-bb03/Cargo.toml b/test/simulator-graphical-bb03/Cargo.toml
index a48bc18..f34f62a 100644
--- a/test/simulator-graphical-bb03/Cargo.toml
+++ b/test/simulator-graphical-bb03/Cargo.toml
@@ -5,7 +5,7 @@ edition = "2024"
[dependencies]
bitbox-hal = { path = "../../src/rust/bitbox-hal" }
-bitbox-platform-host = { path = "../../src/rust/bitbox-platform-host" }
+bitbox-platform-host = { path = "../../src/rust/bitbox-platform-host", features = ["simulator-graphical"] }
bitbox-usb-report-queue = { path = "../../src/rust/bitbox-usb-report-queue" }
bitbox02-rust = { path = "../../src/rust/bitbox02-rust", features = ["simulator-graphical"] }
bitbox-aes = { path = "../../src/rust/bitbox-aes" }
diff --git a/test/simulator-graphical/Cargo.toml b/test/simulator-graphical/Cargo.toml
index d5effad..ea81ec8 100644
--- a/test/simulator-graphical/Cargo.toml
+++ b/test/simulator-graphical/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2024"
bitbox02-rust = { path="../../src/rust/bitbox02-rust", features=["simulator-graphical"] }
bitbox02-rust-c = { path="../../src/rust/bitbox02-rust-c", features=["simulator-graphical"] }
bitbox02 = { path="../../src/rust/bitbox02", features=["simulator-graphical"] }
-bitbox-platform-host = { path = "../../src/rust/bitbox-platform-host" }
+bitbox-platform-host = { path = "../../src/rust/bitbox-platform-host", features = ["simulator-graphical"] }
bitbox-aes = { path="../../src/rust/bitbox-aes"}
winit = "0.30.12"
tracing = {version = "0.1.41", features=["log"]}
Why this scored 15/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.