What changed, and why it matters
This commit only updates internal unit tests to use a more specific mock object (TestingMemory instead of TestingHal). It does not change any production code, security behavior, or user-facing functionality. There is no security issue here.
No action required. This is a routine test refactoring with no security relevance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies test-only code in src/rust/bitbox02-rust/src/salt.rs. It replaces the broader TestingHal mock with the narrower TestingMemory mock for tests of hash_data(), adjusting only test setup and call sites. The function under test, its inputs, outputs, and production implementation are unchanged.
Changed components
src/rust/bitbox02-rust/src/salt.rs (test module only)Inspect captured patch +7 / −7
diff --git a/src/rust/bitbox02-rust/src/salt.rs b/src/rust/bitbox02-rust/src/salt.rs
index 76e1521..9889ea1 100644
--- a/src/rust/bitbox02-rust/src/salt.rs
+++ b/src/rust/bitbox02-rust/src/salt.rs
@@ -29,7 +29,7 @@ pub fn hash_data(
#[cfg(test)]
mod tests {
use super::*;
- use crate::hal::testing::TestingHal;
+ use crate::hal::testing::TestingMemory;
use core::convert::TryInto;
use hex_lit::hex;
@@ -38,24 +38,24 @@ mod tests {
#[test]
fn test_hash_data() {
- let mut mock_hal = TestingHal::new();
- mock_hal.memory.set_salt_root(&MOCK_SALT_ROOT);
+ let mut memory = TestingMemory::new();
+ memory.set_salt_root(&MOCK_SALT_ROOT);
let data = hex!("001122334455667788");
let expected = hex!("62db8dcd47ddf8e81809c377ed96643855d3052bb73237100ca81f0f5a7611e6");
- let hash = hash_data(&mut mock_hal.memory, &data, "test purpose").unwrap();
+ let hash = hash_data(&mut memory, &data, "test purpose").unwrap();
assert_eq!(hash.as_slice(), &expected);
}
#[test]
fn test_hash_data_empty_inputs() {
- let mut mock_hal = TestingHal::new();
- mock_hal.memory.set_salt_root(&MOCK_SALT_ROOT);
+ let mut memory = TestingMemory::new();
+ memory.set_salt_root(&MOCK_SALT_ROOT);
let expected = hex!("2dbb05dd73d94edba6946611aaca367f76c809e96f20499ad674e596050f9833");
- let hash = hash_data(&mut mock_hal.memory, &[], "").unwrap();
+ let hash = hash_data(&mut memory, &[], "").unwrap();
assert_eq!(hash.as_slice(), &expected);
}
}
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.