What changed, and why it matters
This commit is a straightforward code cleanup: it moves a tiny function that reports the hardware security chip model from C to Rust. The function always returned the same fixed value (OPTIGA_TRUST_M_V3), and after the change it still returns that same fixed value. There is no security-relevant change in behavior.
No security action needed; treat as normal refactoring review.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change removes optiga_model() from src/optiga/optiga.c/optiga.h and the bindgen allowlist in build.rs, replacing the FFI call in src/rust/bitbox-securechip/src/optiga.rs with a direct Rust return of Model::OPTIGA_TRUST_M_V3. The value is identical to the previous C implementation, so this is a pure refactoring/porting commit with no functional or security change.
Changed components
src/optiga/optiga.csrc/optiga/optiga.hsrc/rust/bitbox-securechip-sys/build.rssrc/rust/bitbox-securechip/src/optiga.rsInspect captured patch +1 / −13
diff --git a/src/optiga/optiga.c b/src/optiga/optiga.c
index 2e8fa6d..4d7f209 100644
--- a/src/optiga/optiga.c
+++ b/src/optiga/optiga.c
@@ -1899,9 +1899,3 @@ bool optiga_u2f_counter_inc(uint32_t* counter)
return _write_arbitrary_data(&data) == OPTIGA_LIB_SUCCESS;
}
#endif
-
-bool optiga_model(securechip_model_t* model_out)
-{
- *model_out = OPTIGA_TRUST_M_V3;
- return true;
-}
diff --git a/src/optiga/optiga.h b/src/optiga/optiga.h
index 693c895..6a71afc 100644
--- a/src/optiga/optiga.h
+++ b/src/optiga/optiga.h
@@ -109,6 +109,5 @@ USE_RESULT bool optiga_u2f_counter_set(uint32_t counter);
#if APP_U2F == 1
USE_RESULT bool optiga_u2f_counter_inc(uint32_t* counter);
#endif
-USE_RESULT bool optiga_model(securechip_model_t* model_out);
#endif // _OPTIGA_H_
diff --git a/src/rust/bitbox-securechip-sys/build.rs b/src/rust/bitbox-securechip-sys/build.rs
index 5b444f5..965d314 100644
--- a/src/rust/bitbox-securechip-sys/build.rs
+++ b/src/rust/bitbox-securechip-sys/build.rs
@@ -29,7 +29,6 @@ const ALLOWLIST_FNS: &[&str] = &[
"optiga_gen_attestation_key",
"optiga_init_new_password",
"optiga_kdf_external",
- "optiga_model",
"optiga_monotonic_increments_remaining",
"optiga_random",
"optiga_reset_keys",
diff --git a/src/rust/bitbox-securechip/src/optiga.rs b/src/rust/bitbox-securechip/src/optiga.rs
index a96c541..1875d57 100644
--- a/src/rust/bitbox-securechip/src/optiga.rs
+++ b/src/rust/bitbox-securechip/src/optiga.rs
@@ -100,9 +100,5 @@ pub fn u2f_counter_set(counter: u32) -> Result<(), ()> {
}
pub fn model() -> Result<Model, ()> {
- let mut model = core::mem::MaybeUninit::uninit();
- match unsafe { bitbox_securechip_sys::optiga_model(model.as_mut_ptr()) } {
- true => Ok(unsafe { model.assume_init() }),
- false => Err(()),
- }
+ Ok(Model::OPTIGA_TRUST_M_V3)
}
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.