time: Use `gmtime` instead of `localtime`
What changed, and why it matters
This commit fixes a timezone bug in how the BitBox02 converts a timestamp into a human-readable date. It swaps localtime (which adjusts for the device's timezone) for gmtime (which always uses UTC). The change only affects displayed dates/times and was motivated by failing unit tests on machines not set to UTC. There is no security vulnerability here.
No security action required. Treat as a normal functional/correctness fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The Rust firmware wrapper changed its C FFI binding from localtime() to gmtime(). get_datetime() now returns struct tm in UTC rather than in the device’s local timezone. This is a correctness/consistency fix for timestamp-to-calendar conversion. No memory safety, bounds, or cryptographic changes are present.
Changed components
src/rust/bitbox02-sys/build.rssrc/rust/bitbox02/src/lib.rsget_datetime() Rust wrapperInspect captured patch +4 / −4
diff --git a/src/rust/bitbox02-sys/build.rs b/src/rust/bitbox02-sys/build.rs
index 22f1879..2f61dfc 100644
--- a/src/rust/bitbox02-sys/build.rs
+++ b/src/rust/bitbox02-sys/build.rs
@@ -86,7 +86,7 @@ const ALLOWLIST_FNS: &[&str] = &[
"keystore_test_get_retained_seed_encrypted",
"keystore_test_get_retained_bip39_seed_encrypted",
"label_create",
- "localtime",
+ "gmtime",
"memory_set_salt_root",
"memory_add_noise_remote_static_pubkey",
"memory_bootloader_hash",
diff --git a/src/rust/bitbox02/src/lib.rs b/src/rust/bitbox02/src/lib.rs
index 4e93f47..06d0f38 100644
--- a/src/rust/bitbox02/src/lib.rs
+++ b/src/rust/bitbox02/src/lib.rs
@@ -175,12 +175,12 @@ impl Tm {
pub fn get_datetime(timestamp: u32) -> Result<Tm, ()> {
Ok(Tm {
tm: unsafe {
- let localtime = bitbox02_sys::localtime(&(timestamp as bitbox02_sys::time_t));
- if localtime.is_null() {
+ let gmtime = bitbox02_sys::gmtime(&(timestamp as bitbox02_sys::time_t));
+ if gmtime.is_null() {
return Err(());
}
- *localtime
+ *gmtime
},
})
}
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.