Remove C salt unit test now covered by Rust
What changed, and why it matters
This commit simply deletes an old C-language unit test for a salt-hashing function because the same behavior is now tested in Rust. It does not change any production firmware code, cryptographic logic, or how devices operate. There is no security issue here.
No action required. Verify that equivalent Rust unit tests for salt_hash_data exist and pass, then close.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes test/unit-test/test_salt.c and its CMake registration. The deleted test verified deterministic outputs of salt_hash_data() for known inputs, including empty/NULL data edge cases. No implementation code in the firmware is modified, and the commit message states the coverage has moved to Rust tests. This is a routine test-suite refactoring.
Changed components
test/unit-test/test_salt.ctest/unit-test/CMakeLists.txtInspect captured patch +0 / −66
diff --git a/test/unit-test/CMakeLists.txt b/test/unit-test/CMakeLists.txt
index efda070..569b4be 100644
--- a/test/unit-test/CMakeLists.txt
+++ b/test/unit-test/CMakeLists.txt
@@ -66,8 +66,6 @@ set(TEST_LIST
"-Wl,--wrap=memory_read_chunk_fake,--wrap=memory_write_chunk_fake,--wrap=rust_noise_generate_static_private_key,--wrap=memory_read_shared_bootdata_fake,--wrap=memory_write_to_address_fake,--wrap=random_32_bytes_mcu"
memory_functional
""
- salt
- "-Wl,--wrap=memory_get_salt_root"
cipher
"-Wl,--wrap=cipher_fake_iv"
util
diff --git a/test/unit-test/test_salt.c b/test/unit-test/test_salt.c
deleted file mode 100644
index fd52609..0000000
--- a/test/unit-test/test_salt.c
+++ /dev/null
@@ -1,64 +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 <stddef.h>
-#include <cmocka.h>
-
-#include <salt.h>
-
-#include <stdint.h>
-#include <string.h>
-
-static void _test_salt_hash_data(void** state)
-{
- uint8_t data[9] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
- uint8_t hash[32];
- assert_true(salt_hash_data(data, sizeof(data), "test purpose", hash));
- uint8_t expected_result[32] = {
- 0x62, 0xdb, 0x8d, 0xcd, 0x47, 0xdd, 0xf8, 0xe8, 0x18, 0x09, 0xc3,
- 0x77, 0xed, 0x96, 0x64, 0x38, 0x55, 0xd3, 0x05, 0x2b, 0xb7, 0x32,
- 0x37, 0x10, 0x0c, 0xa8, 0x1f, 0x0f, 0x5a, 0x76, 0x11, 0xe6,
- };
- assert_memory_equal(hash, expected_result, 32);
-}
-
-static void _test_salt_hash_data_empty(void** state)
-{
- const char* data = "";
- uint8_t hash[32];
- uint8_t expected_result[32] = {
- 0x2d, 0xbb, 0x05, 0xdd, 0x73, 0xd9, 0x4e, 0xdb, 0xa6, 0x94, 0x66,
- 0x11, 0xaa, 0xca, 0x36, 0x7f, 0x76, 0xc8, 0x09, 0xe9, 0x6f, 0x20,
- 0x49, 0x9a, 0xd6, 0x74, 0xe5, 0x96, 0x05, 0x0f, 0x98, 0x33,
- };
-
- assert_true(salt_hash_data((const uint8_t*)data, 0, "", hash));
- assert_memory_equal(hash, expected_result, 32);
-
- assert_true(salt_hash_data(NULL, 0, "", hash));
- assert_memory_equal(hash, expected_result, 32);
-
- assert_false(salt_hash_data(NULL, 1, "", hash));
-}
-
-int main(void)
-{
- const struct CMUnitTest tests[] = {
- cmocka_unit_test(_test_salt_hash_data),
- cmocka_unit_test(_test_salt_hash_data_empty),
- };
- return cmocka_run_group_tests(tests, NULL, NULL);
-}
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.