What changed, and why it matters
This commit simply deletes an unused test helper file (mock_memory.c) and removes it from the test build list. It is a routine cleanup of dead test code and does not change any firmware behavior or fix any security issue.
No security action needed. Treat as normal code hygiene.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes test/unit-test/framework/src/mock_memory.c, which provided cmocka-based wrapper functions for memory.* interfaces used in unit tests. The file is no longer referenced by the test suite, so it is removed from test/unit-test/CMakeLists.txt’s add_library(mocks …) list. No production firmware code is modified, and no security-relevant behavior changes.
Changed components
test/unit-test/framework/src/mock_memory.ctest/unit-test/CMakeLists.txtInspect captured patch +0 / −77
diff --git a/test/unit-test/CMakeLists.txt b/test/unit-test/CMakeLists.txt
index 569b4be..1cebf04 100644
--- a/test/unit-test/CMakeLists.txt
+++ b/test/unit-test/CMakeLists.txt
@@ -34,7 +34,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-missing-prototype
add_library(mocks STATIC EXCLUDE_FROM_ALL
framework/src/mock_gestures.c
framework/src/mock_screen_stack.c
- framework/src/mock_memory.c
framework/src/mock_qtouch.c
)
target_link_libraries(mocks PUBLIC c-unit-tests_rust_c ${CMOCKA_LDFLAGS})
diff --git a/test/unit-test/framework/src/mock_memory.c b/test/unit-test/framework/src/mock_memory.c
deleted file mode 100644
index fc23ca2..0000000
--- a/test/unit-test/framework/src/mock_memory.c
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2019 Shift Cryptosecurity AG
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <cmocka.h>
-
-#include <fake_memory.h>
-#include <flags.h>
-#include <memory/memory.h>
-#include <stdio.h>
-#include <string.h>
-
-bool __wrap_memory_is_initialized(void)
-{
- return mock();
-}
-
-bool __wrap_memory_is_seeded(void)
-{
- return mock();
-}
-
-static uint8_t _encrypted_seed_and_hmac[96];
-static uint8_t _encrypted_seed_and_hmac_len;
-
-bool __wrap_memory_set_encrypted_seed_and_hmac(uint8_t* encrypted_seed_and_hmac, uint8_t len)
-{
- memcpy(_encrypted_seed_and_hmac, encrypted_seed_and_hmac, len);
- _encrypted_seed_and_hmac_len = len;
- return true;
-}
-
-bool __wrap_memory_get_encrypted_seed_and_hmac(
- uint8_t* encrypted_seed_and_hmac_out,
- uint8_t* len_out)
-{
- *len_out = _encrypted_seed_and_hmac_len;
- memcpy(encrypted_seed_and_hmac_out, _encrypted_seed_and_hmac, *len_out);
- return true;
-}
-
-void __wrap_memory_get_device_name(char* name_out)
-{
- snprintf(name_out, MEMORY_DEVICE_NAME_MAX_LEN, "%s", (const char*)mock());
-}
-
-bool __wrap_memory_set_device_name(const char* name)
-{
- return mock();
-}
-
-bool __wrap_memory_set_mnemonic_passphrase_enabled(bool enabled)
-{
- check_expected(enabled);
- return mock();
-}
-
-bool __wrap_memory_get_salt_root(uint8_t* salt_root_out)
-{
- memcpy(salt_root_out, fake_memory_get_salt_root(), 32);
- return true;
-}
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.