diff --git a/subsys/suit/platform/src/suit_plat_components.c b/subsys/suit/platform/src/suit_plat_components.c index bbdfd77a62d8..36c4116da7c6 100644 --- a/subsys/suit/platform/src/suit_plat_components.c +++ b/subsys/suit/platform/src/suit_plat_components.c @@ -94,7 +94,7 @@ int suit_plat_release_component_handle(suit_component_t handle) return SUIT_SUCCESS; } -int suit_plat_create_component_handle(struct zcbor_string *component_id, +int suit_plat_create_component_handle(struct zcbor_string *component_id, bool dependency, suit_component_t *component_handle) { suit_memptr_storage_err_t err; @@ -130,6 +130,12 @@ int suit_plat_create_component_handle(struct zcbor_string *component_id, return SUIT_ERR_UNSUPPORTED_COMPONENT_ID; } + if (dependency && (component_type != SUIT_COMPONENT_TYPE_CAND_MFST) && + (component_type != SUIT_COMPONENT_TYPE_INSTLD_MFST)) { + LOG_ERR("Unsupported dependency component type: %d", component_type); + return SUIT_ERR_UNAUTHORIZED_COMPONENT; + } + if ((component_type == SUIT_COMPONENT_TYPE_CAND_IMG) || (component_type == SUIT_COMPONENT_TYPE_CAND_MFST)) { err = suit_memptr_storage_get(&component->impl_data); diff --git a/tests/subsys/suit/cache_pool_digest/src/main.c b/tests/subsys/suit/cache_pool_digest/src/main.c index 7be36ec17587..6edac14975e7 100644 --- a/tests/subsys/suit/cache_pool_digest/src/main.c +++ b/tests/subsys/suit/cache_pool_digest/src/main.c @@ -107,7 +107,8 @@ ZTEST(cache_pool_digest_tests, test_cache_get_slot_ok) suit_component_t dst_component; - ret = suit_plat_create_component_handle(&valid_cand_img_component_id, &dst_component); + ret = suit_plat_create_component_handle(&valid_cand_img_component_id, false, + &dst_component); zassert_equal(SUIT_SUCCESS, ret, "test error - create_component_handle failed: %d", ret); struct zcbor_string src_uri = { diff --git a/tests/subsys/suit/check_content/src/main.c b/tests/subsys/suit/check_content/src/main.c index a74975920fb9..216685c9c0aa 100644 --- a/tests/subsys/suit/check_content/src/main.c +++ b/tests/subsys/suit/check_content/src/main.c @@ -50,7 +50,7 @@ ZTEST(suit_check_content_tests, test_mem_matching) }; suit_component_t component; - int err = suit_plat_create_component_handle(&matching_src_component_id, &component); + int err = suit_plat_create_component_handle(&matching_src_component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -88,7 +88,7 @@ ZTEST(suit_check_content_tests, test_mem_different_size) }; suit_component_t component; - int err = suit_plat_create_component_handle(&valid_src_component_id, &component); + int err = suit_plat_create_component_handle(&valid_src_component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -127,7 +127,8 @@ ZTEST(suit_check_content_tests, test_mem_not_matching) }; suit_component_t component; - int err = suit_plat_create_component_handle(¬_matching_src_component_id, &component); + int err = suit_plat_create_component_handle(¬_matching_src_component_id, false, + &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); diff --git a/tests/subsys/suit/check_image_match/src/main.c b/tests/subsys/suit/check_image_match/src/main.c index 593aa23c8206..352b16962489 100644 --- a/tests/subsys/suit/check_image_match/src/main.c +++ b/tests/subsys/suit/check_image_match/src/main.c @@ -60,7 +60,7 @@ ZTEST(check_image_match_tests, test_mem_valid) void *impl_data = NULL; suit_component_t component; - int err = suit_plat_create_component_handle(&valid_src_component_id, &component); + int err = suit_plat_create_component_handle(&valid_src_component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -96,7 +96,7 @@ ZTEST(check_image_match_tests, test_mem_wrong_size) void *impl_data = NULL; suit_component_t component; - int err = suit_plat_create_component_handle(&valid_src_component_id, &component); + int err = suit_plat_create_component_handle(&valid_src_component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -134,7 +134,7 @@ ZTEST(check_image_match_tests, test_mem_wrong_digest) void *impl_data = NULL; suit_component_t component; - int err = suit_plat_create_component_handle(&valid_src_component_id, &component); + int err = suit_plat_create_component_handle(&valid_src_component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -171,7 +171,7 @@ ZTEST(check_image_match_tests, test_mem_invalid_component) suit_component_t component; /* WHEN a component handle is created */ - int err = suit_plat_create_component_handle(&invalid_src_component_id, &component); + int err = suit_plat_create_component_handle(&invalid_src_component_id, false, &component); /* THEN it is not supported */ zassert_equal(SUIT_ERR_UNSUPPORTED_COMPONENT_ID, err, @@ -185,7 +185,8 @@ ZTEST(check_image_match_tests, test_cand_img_match) /* GIVEN CAND_IMG component pointing to the data */ suit_component_t component; - int err = suit_plat_create_component_handle(&valid_cand_img_component_id, &component); + int err = + suit_plat_create_component_handle(&valid_cand_img_component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -215,7 +216,8 @@ ZTEST(check_image_match_tests, test_cand_img_mismatch) /* GIVEN CAND_IMG component pointing to the data */ suit_component_t component; - int err = suit_plat_create_component_handle(&valid_cand_img_component_id, &component); + int err = + suit_plat_create_component_handle(&valid_cand_img_component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -252,7 +254,7 @@ ZTEST(check_image_match_tests, test_soc_spec_1) void *impl_data = NULL; suit_component_t component; - int err = suit_plat_create_component_handle(&component_id, &component); + int err = suit_plat_create_component_handle(&component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -284,7 +286,7 @@ ZTEST(check_image_match_tests, test_soc_spec_2) void *impl_data = NULL; suit_component_t component; - int err = suit_plat_create_component_handle(&component_id, &component); + int err = suit_plat_create_component_handle(&component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -317,7 +319,7 @@ ZTEST(check_image_match_tests, test_soc_spec_3) void *impl_data = NULL; suit_component_t component; - int err = suit_plat_create_component_handle(&component_id, &component); + int err = suit_plat_create_component_handle(&component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -348,7 +350,7 @@ ZTEST(check_image_match_tests, test_soc_spec_none) void *impl_data = NULL; suit_component_t component; - int err = suit_plat_create_component_handle(&component_id, &component); + int err = suit_plat_create_component_handle(&component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); @@ -387,7 +389,7 @@ ZTEST(check_image_match_tests, test_unhandled_component) }; suit_component_t component; - int err = suit_plat_create_component_handle(&valid_src_component_id, &component); + int err = suit_plat_create_component_handle(&valid_src_component_id, true, &component); zassert_equal(SUIT_SUCCESS, err, "test error - create_component_handle failed: %d", err); diff --git a/tests/subsys/suit/copy/src/main.c b/tests/subsys/suit/copy/src/main.c index 355b9b0e36d5..b349c2ff800e 100644 --- a/tests/subsys/suit/copy/src/main.c +++ b/tests/subsys/suit/copy/src/main.c @@ -45,7 +45,7 @@ ZTEST(copy_tests, test_integrated_fetch_to_memptr_and_copy_to_msink_OK) .len = sizeof(valid_src_value), }; - int ret = suit_plat_create_component_handle(&valid_src_component_id, &src_handle); + int ret = suit_plat_create_component_handle(&valid_src_component_id, false, &src_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -80,7 +80,7 @@ ZTEST(copy_tests, test_integrated_fetch_to_memptr_and_copy_to_msink_OK) .len = sizeof(valid_dst_value), }; - ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); arbiter_mem_access_check_fake.return_val = ARBITER_STATUS_OK; @@ -132,7 +132,7 @@ ZTEST(copy_tests, test_integrated_fetch_to_memptr_and_copy_to_msink_NOK_dst_hand .len = sizeof(valid_src_value), }; - int ret = suit_plat_create_component_handle(&valid_src_component_id, &src_handle); + int ret = suit_plat_create_component_handle(&valid_src_component_id, false, &src_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -167,7 +167,7 @@ ZTEST(copy_tests, test_integrated_fetch_to_memptr_and_copy_to_msink_NOK_dst_hand .len = sizeof(valid_dst_value), }; - ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); ret = suit_plat_release_component_handle(dst_handle); @@ -203,7 +203,7 @@ ZTEST(copy_tests, test_integrated_fetch_to_memptr_and_copy_to_msink_NOK_src_hand .len = sizeof(valid_src_value), }; - int ret = suit_plat_create_component_handle(&valid_src_component_id, &src_handle); + int ret = suit_plat_create_component_handle(&valid_src_component_id, false, &src_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -238,7 +238,7 @@ ZTEST(copy_tests, test_integrated_fetch_to_memptr_and_copy_to_msink_NOK_src_hand .len = sizeof(valid_dst_value), }; - ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); ret = suit_plat_release_component_handle(src_handle); @@ -271,7 +271,7 @@ ZTEST(copy_tests, test_integrated_fetch_to_memptr_and_copy_to_msink_NOK_memptr_e .len = sizeof(valid_src_value), }; - int ret = suit_plat_create_component_handle(&valid_src_component_id, &src_handle); + int ret = suit_plat_create_component_handle(&valid_src_component_id, false, &src_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -286,7 +286,7 @@ ZTEST(copy_tests, test_integrated_fetch_to_memptr_and_copy_to_msink_NOK_memptr_e .len = sizeof(valid_dst_value), }; - ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); ret = suit_plat_copy(dst_handle, src_handle, NULL); diff --git a/tests/subsys/suit/fetch/src/main.c b/tests/subsys/suit/fetch/src/main.c index c49a5068656e..1ba05b466497 100644 --- a/tests/subsys/suit/fetch/src/main.c +++ b/tests/subsys/suit/fetch/src/main.c @@ -101,7 +101,7 @@ ZTEST(fetch_tests, test_integrated_fetch_to_msink_OK) .len = sizeof(valid_dst_value), }; - int ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + int ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -145,7 +145,7 @@ ZTEST(fetch_tests, test_integrated_fetch_to_memptr_OK) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &component_handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &component_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -187,7 +187,7 @@ ZTEST(fetch_tests, test_fetch_to_memptr_OK) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &component_handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &component_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -219,7 +219,7 @@ ZTEST(fetch_tests, test_fetch_to_memptr_NOK_uri_not_in_cache) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &component_handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &component_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -252,7 +252,7 @@ ZTEST(fetch_tests, test_fetch_to_memptr_NOK_invalid_component_id) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &component_handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &component_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -284,7 +284,7 @@ ZTEST(fetch_tests, test_integrated_fetch_to_memptr_NOK_data_ptr_NULL) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &component_handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &component_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -312,7 +312,7 @@ ZTEST(fetch_tests, test_integrated_fetch_to_memptr_NOK_data_size_zero) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &component_handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &component_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -339,7 +339,7 @@ ZTEST(fetch_tests, test_integrated_fetch_to_memptr_NOK_handle_NULL) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &component_handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &component_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); diff --git a/tests/subsys/suit/invoke/src/main.c b/tests/subsys/suit/invoke/src/main.c index 7d3d811e890a..b5b838faec2f 100644 --- a/tests/subsys/suit/invoke/src/main.c +++ b/tests/subsys/suit/invoke/src/main.c @@ -29,7 +29,7 @@ ZTEST(invoke_tests, test_invoke_OK) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -52,7 +52,7 @@ ZTEST(invoke_tests, test_invoke_NOK_unsupported_component_type) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -73,7 +73,7 @@ ZTEST(invoke_tests, test_invoke_NOK_unsupported_cpu_id) .len = sizeof(valid_value), }; - int ret = suit_plat_create_component_handle(&valid_component_id, &handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); diff --git a/tests/subsys/suit/sink_selector/src/main.c b/tests/subsys/suit/sink_selector/src/main.c index 697b433bc3a6..6a7c43c2b00c 100644 --- a/tests/subsys/suit/sink_selector/src/main.c +++ b/tests/subsys/suit/sink_selector/src/main.c @@ -34,7 +34,7 @@ ZTEST(sink_selector_tests, test_select_memptr_sink_OK) }; struct stream_sink sink; - int ret = suit_plat_create_component_handle(&valid_component_id, &handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -56,7 +56,7 @@ ZTEST(sink_selector_tests, test_select_flash_sink_OK) }; struct stream_sink sink; - int ret = suit_plat_create_component_handle(&valid_component_id, &handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -80,7 +80,7 @@ ZTEST(sink_selector_tests, test_select_ram_sink_OK) }; struct stream_sink sink; - int ret = suit_plat_create_component_handle(&valid_component_id, &handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -103,7 +103,7 @@ ZTEST(sink_selector_tests, test_select_sdfw_sink_OK) }; struct stream_sink sink; - int ret = suit_plat_create_component_handle(&valid_component_id, &handle); + int ret = suit_plat_create_component_handle(&valid_component_id, false, &handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -126,7 +126,7 @@ ZTEST(sink_selector_tests, test_select_invalid_component_id) .len = sizeof(invalid_value), }; - int ret = suit_plat_create_component_handle(&invalid_component_id, &handle); + int ret = suit_plat_create_component_handle(&invalid_component_id, false, &handle); zassert_equal(ret, SUIT_ERR_UNSUPPORTED_COMPONENT_ID, "create_component_handle unexpected error %i", ret); @@ -146,7 +146,7 @@ ZTEST(sink_selector_tests, test_select_unsupported_component) }; struct stream_sink sink; - int ret = suit_plat_create_component_handle(&invalid_component_id, &handle); + int ret = suit_plat_create_component_handle(&invalid_component_id, true, &handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); diff --git a/tests/subsys/suit/unit/mocks/include/mock_suit_platform.h b/tests/subsys/suit/unit/mocks/include/mock_suit_platform.h index cca47d537755..3ee7f9d4add0 100644 --- a/tests/subsys/suit/unit/mocks/include/mock_suit_platform.h +++ b/tests/subsys/suit/unit/mocks/include/mock_suit_platform.h @@ -17,7 +17,8 @@ FAKE_VALUE_FUNC(int, suit_plat_check_digest, enum suit_cose_alg, struct zcbor_st FAKE_VALUE_FUNC(int, suit_plat_authenticate_manifest, struct zcbor_string *, enum suit_cose_alg, struct zcbor_string *, struct zcbor_string *, struct zcbor_string *); FAKE_VALUE_FUNC(int, suit_plat_authorize_unsigned_manifest, struct zcbor_string *); -FAKE_VALUE_FUNC(int, suit_plat_create_component_handle, struct zcbor_string *, suit_component_t *); +FAKE_VALUE_FUNC(int, suit_plat_create_component_handle, struct zcbor_string *, bool, + suit_component_t *); FAKE_VALUE_FUNC(int, suit_plat_release_component_handle, suit_component_t); #ifdef CONFIG_CHECK_IMAGE_MATCH_TEST diff --git a/tests/subsys/suit/unit/suit_plat_components/src/main.c b/tests/subsys/suit/unit/suit_plat_components/src/main.c index ec24c095abb2..2b0a171dd61b 100644 --- a/tests/subsys/suit/unit/suit_plat_components/src/main.c +++ b/tests/subsys/suit/unit/suit_plat_components/src/main.c @@ -115,7 +115,8 @@ static void create_valid_component(suit_component_type_t type) suit_memptr_storage_get_fake.custom_fake = suit_memptr_storage_get_correct_fake_func; suit_plat_decode_component_type_fake.custom_fake = suit_plat_decode_component_type_correct_fake_func; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_SUCCESS, ret, "Failed to create valid component handle"); /* Reset mocks to only look at the results of the next call*/ @@ -128,7 +129,7 @@ ZTEST_SUITE(suit_plat_components_tests, NULL, NULL, test_before, NULL, NULL); ZTEST(suit_plat_components_tests, test_create_component_handle_null_component_handle) { - int ret = suit_plat_create_component_handle(&valid_mem_component_id, NULL); + int ret = suit_plat_create_component_handle(&valid_mem_component_id, false, NULL); zassert_equal(SUIT_ERR_UNSUPPORTED_PARAMETER, ret, "Failed to catch null argument"); @@ -144,7 +145,7 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_null_component_ha ZTEST(suit_plat_components_tests, test_create_component_handle_null_component_id) { - int ret = suit_plat_create_component_handle(NULL, &component_handles[0]); + int ret = suit_plat_create_component_handle(NULL, false, &component_handles[0]); zassert_equal(SUIT_ERR_UNSUPPORTED_PARAMETER, ret, "Failed to catch null argument"); @@ -164,7 +165,7 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_too_many_componen int ret; for (size_t i = 0; i < SUIT_MAX_NUM_COMPONENT_PARAMS; i++) { - ret = suit_plat_create_component_handle(&valid_mem_component_id, + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, &component_handles[i]); zassert_equal(SUIT_SUCCESS, ret, "Failed to create valid component handle"); } @@ -174,7 +175,7 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_too_many_componen FFF_RESET_HISTORY(); mocks_return_values_reset(); - ret = suit_plat_create_component_handle(&valid_mem_component_id, &test_handle); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, &test_handle); zassert_equal(SUIT_ERR_UNSUPPORTED_COMPONENT_ID, ret, "Failed to record overflow in " @@ -199,7 +200,8 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_other_component_t component_type = SUIT_COMPONENT_TYPE_SOC_SPEC; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_SUCCESS, ret, "Failed to create valid component handle"); @@ -228,7 +230,8 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_mem_ok) component_type = SUIT_COMPONENT_TYPE_MEM; memptr_address = 0x12345000; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_SUCCESS, ret, "Failed to create valid component handle"); @@ -261,7 +264,8 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_mem_decode_compon suit_plat_decode_component_type_fake.return_val = SUIT_PLAT_ERR_CBOR_DECODING; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_ERR_UNSUPPORTED_COMPONENT_ID, ret, "Incorrect returned error code"); @@ -292,7 +296,8 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_mem_decode_addres component_type = SUIT_COMPONENT_TYPE_MEM; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_ERR_UNSUPPORTED_COMPONENT_ID, ret, "Incorrect returned error code"); @@ -326,7 +331,8 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_mem_memptr_storag component_type = SUIT_COMPONENT_TYPE_MEM; memptr_address = 0x12345000; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_ERR_CRASH, ret, "Incorrect returned error code"); @@ -357,7 +363,8 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_cand_img_memptr_s component_type = SUIT_COMPONENT_TYPE_CAND_IMG; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_ERR_CRASH, ret, "Incorrect returned error code"); @@ -392,7 +399,8 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_mem_memptr_storag component_type = SUIT_COMPONENT_TYPE_MEM; memptr_address = 0x12345000; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_ERR_CRASH, ret, "Incorrect returned error code"); @@ -429,7 +437,7 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_cand_img_ok) component_type = SUIT_COMPONENT_TYPE_CAND_IMG; - ret = suit_plat_create_component_handle(&valid_cand_img_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_cand_img_id, false, &component_handles[0]); zassert_equal(SUIT_SUCCESS, ret, "Failed to create valid component handle"); @@ -457,7 +465,7 @@ ZTEST(suit_plat_components_tests, test_create_component_handle_cand_mfst_ok) component_type = SUIT_COMPONENT_TYPE_CAND_MFST; - ret = suit_plat_create_component_handle(&valid_cand_mfst_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_cand_mfst_id, true, &component_handles[0]); zassert_equal(SUIT_SUCCESS, ret, "Failed to create valid component handle"); @@ -492,7 +500,8 @@ ZTEST(suit_plat_components_tests, test_release_component_handle_invalid_handle) "Incorrect number of suit_memptr_storage_release() calls"); /* Unaligned handle */ - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_SUCCESS, ret, "Failed to create valid component handle"); /* Reset mocks to only look at the results of the next call*/ mocks_reset(); @@ -513,7 +522,8 @@ ZTEST(suit_plat_components_tests, test_release_component_handle_already_released { int ret; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_SUCCESS, ret, "Failed to create valid component handle"); ret = suit_plat_release_component_handle(component_handles[0]); @@ -537,7 +547,8 @@ ZTEST(suit_plat_components_tests, test_release_component_handle_decoding_type_fa { int ret; - ret = suit_plat_create_component_handle(&valid_mem_component_id, &component_handles[0]); + ret = suit_plat_create_component_handle(&valid_mem_component_id, false, + &component_handles[0]); zassert_equal(SUIT_SUCCESS, ret, "Failed to create valid component handle"); /* Reset mocks to only look at the results of the next call*/ diff --git a/tests/subsys/suit/unit/suit_plat_override_image_size/src/main.c b/tests/subsys/suit/unit/suit_plat_override_image_size/src/main.c index c6468b31316c..8a5b16cf0115 100644 --- a/tests/subsys/suit/unit/suit_plat_override_image_size/src/main.c +++ b/tests/subsys/suit/unit/suit_plat_override_image_size/src/main.c @@ -78,7 +78,7 @@ static void test_before(void *data) suit_plat_decode_component_type_fake_mem_ok; suit_plat_decode_address_size_fake.custom_fake = suit_plat_decode_address_size_fake_ok; - int err = suit_plat_create_component_handle(&component_id, &component); + int err = suit_plat_create_component_handle(&component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test setup error - create_component_handle failed: %d", err); @@ -268,7 +268,7 @@ ZTEST(suit_platform_override_image_size_tests, suit_plat_decode_component_type_fake.custom_fake = suit_plat_decode_component_type_fake_mem_ok; suit_plat_decode_address_size_fake.custom_fake = suit_plat_decode_address_size_fake_ok; - err = suit_plat_create_component_handle(&component_id, &component); + err = suit_plat_create_component_handle(&component_id, false, &component); zassert_equal(SUIT_SUCCESS, err, "test setup error - create_component_handle failed: %d", err); } diff --git a/tests/subsys/suit/write/src/main.c b/tests/subsys/suit/write/src/main.c index c4d90d24f602..4e695687ea31 100644 --- a/tests/subsys/suit/write/src/main.c +++ b/tests/subsys/suit/write/src/main.c @@ -49,7 +49,7 @@ ZTEST(write_tests, test_write_to_flash_sink_OK) .len = sizeof(valid_dst_value), }; - int ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + int ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -96,7 +96,7 @@ ZTEST(write_tests, test_write_to_ram_sink_OK) .len = sizeof(valid_dst_value), }; - int ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + int ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -127,7 +127,7 @@ ZTEST(write_tests, test_write_flash_sink_NOK_size_not_aligned) .len = sizeof(valid_dst_value), }; - int ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + int ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -169,7 +169,7 @@ ZTEST(write_tests, test_write_to_flash_sink_NOK_source_null) .len = sizeof(valid_dst_value), }; - int ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + int ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -198,7 +198,7 @@ ZTEST(write_tests, test_write_to_flash_sink_NOK_source_value_null) .len = sizeof(valid_dst_value), }; - int ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + int ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); @@ -228,7 +228,7 @@ ZTEST(write_tests, test_write_to_flash_sink_NOK_source_len_0) .len = sizeof(valid_dst_value), }; - int ret = suit_plat_create_component_handle(&valid_dst_component_id, &dst_handle); + int ret = suit_plat_create_component_handle(&valid_dst_component_id, false, &dst_handle); zassert_equal(ret, SUIT_SUCCESS, "create_component_handle failed - error %i", ret); diff --git a/west.yml b/west.yml index f213c66f9f45..893872836344 100644 --- a/west.yml +++ b/west.yml @@ -249,7 +249,7 @@ manifest: revision: 6d31d4f4c761b8fb7c6dc5c8a3c09bd354943957 path: modules/lib/suit-generator - name: suit-processor - revision: pull/95/head + revision: 7d94614168540359651391e64aa4de6515e43fca path: modules/lib/suit-processor - name: doc-internal repo-path: doc-internal