keystore: remove unused second argument in keystore_mock_unlocked
What changed, and why it matters
This is a small code cleanup change that removes an unused test-only parameter. It only affects test helper code and does not change any real device behavior or security logic.
No action required. This is a benign refactoring of test-only code.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes the third argument (bip39_seed) from keystore_mock_unlocked(), a function only compiled under #ifdef TESTING. All callers passed NULL for this argument, so the change simply hardcodes _is_unlocked_bip39 = false and drops the unused parameter. No production code paths are modified.
Changed components
src/keystore.c (test-only mock function)src/keystore.h (test-only mock declaration)src/rust/bitbox02/src/keystore.rs (test-only Rust wrapper)Inspect captured patch +4 / −11
diff --git a/src/keystore.c b/src/keystore.c
index ad4bf4a..c30e367 100644
--- a/src/keystore.c
+++ b/src/keystore.c
@@ -539,7 +539,7 @@ bool keystore_secp256k1_sign(
}
#ifdef TESTING
-void keystore_mock_unlocked(const uint8_t* seed, size_t seed_len, const uint8_t* bip39_seed)
+void keystore_mock_unlocked(const uint8_t* seed, size_t seed_len)
{
_is_unlocked_device = seed != NULL;
if (seed != NULL) {
@@ -547,12 +547,7 @@ void keystore_mock_unlocked(const uint8_t* seed, size_t seed_len, const uint8_t*
Abort("couldn't retain seed");
}
}
- _is_unlocked_bip39 = bip39_seed != NULL;
- if (bip39_seed != NULL) {
- if (!_retain_bip39_seed(bip39_seed)) {
- Abort("couldn't retain bip39 seed");
- }
- }
+ _is_unlocked_bip39 = false;
}
const uint8_t* keystore_test_get_retained_seed_encrypted(size_t* len_out)
diff --git a/src/keystore.h b/src/keystore.h
index 9a88d2d..a00b14c 100644
--- a/src/keystore.h
+++ b/src/keystore.h
@@ -188,7 +188,7 @@ USE_RESULT bool keystore_secp256k1_sign(
/**
* convenience to mock the keystore state (locked, seed) in tests.
*/
-void keystore_mock_unlocked(const uint8_t* seed, size_t seed_len, const uint8_t* bip39_seed);
+void keystore_mock_unlocked(const uint8_t* seed, size_t seed_len);
const uint8_t* keystore_test_get_retained_seed_encrypted(size_t* len_out);
const uint8_t* keystore_test_get_retained_bip39_seed_encrypted(size_t* len_out);
diff --git a/src/rust/bitbox02/src/keystore.rs b/src/rust/bitbox02/src/keystore.rs
index 8b078db..5317754 100644
--- a/src/rust/bitbox02/src/keystore.rs
+++ b/src/rust/bitbox02/src/keystore.rs
@@ -219,7 +219,5 @@ pub fn _encrypt_and_store_seed(seed: &[u8], password: &str) -> Result<(), Error>
#[cfg(feature = "testing")]
pub fn mock_unlocked(seed: &[u8]) {
- unsafe {
- bitbox02_sys::keystore_mock_unlocked(seed.as_ptr(), seed.len() as _, core::ptr::null())
- }
+ unsafe { bitbox02_sys::keystore_mock_unlocked(seed.as_ptr(), seed.len() as _) }
}
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.