-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
Aligned suit orchestrator tests after making it use the validator module. Also added two tests for verifying this part of the orchestrator. Signed-off-by: Artur Hadasz <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
if (CONFIG_SUIT_VALIDATOR_IMPL_CUSTOM) | ||
zephyr_library_named(validator_test) | ||
zephyr_library_sources(validator_test.c) | ||
zephyr_library_link_libraries(suit_validator) | ||
|
||
target_link_libraries(app PUBLIC validator_test) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#include <suit_validator.h> | ||
|
||
static suit_plat_err_t validate_candidate_location_common(uintptr_t address, | ||
size_t size) | ||
{ | ||
|
||
/* For the purpose of the "mock" in tests, set the forbidden | ||
address range to 0x0001000 - 0x0001FFF */ | ||
Check warning on line 14 in tests/subsys/suit/common/validator_test/validator_test.c GitHub Actions / Run compliance checks on patch series (PR)BLOCK_COMMENT_STYLE
Check warning on line 14 in tests/subsys/suit/common/validator_test/validator_test.c GitHub Actions / Run compliance checks on patch series (PR)BLOCK_COMMENT_STYLE
|
||
if(((uint32_t) address >= 0x0001000 && (uint32_t) address <= 0x0001FFF) | ||
Check failure on line 15 in tests/subsys/suit/common/validator_test/validator_test.c GitHub Actions / Run compliance checks on patch series (PR)OPEN_BRACE
|
||
|| ((uint32_t) address + size >= 0x0001000 && (uint32_t) address + size <= 0x0001FFF)) | ||
{ | ||
return SUIT_PLAT_ERR_ACCESS; | ||
} | ||
|
||
return SUIT_PLAT_SUCCESS; | ||
} | ||
|
||
suit_plat_err_t suit_validator_validate_update_candidate_location(const uint8_t *address, | ||
size_t size) | ||
{ | ||
return validate_candidate_location_common((uintptr_t) address, size); | ||
Check failure on line 27 in tests/subsys/suit/common/validator_test/validator_test.c GitHub Actions / Run compliance checks on patch series (PR)CODE_INDENT
Check warning on line 27 in tests/subsys/suit/common/validator_test/validator_test.c GitHub Actions / Run compliance checks on patch series (PR)SPACE_BEFORE_TAB
|
||
} | ||
|
||
suit_plat_err_t suit_validator_validate_dfu_partition_location(const uint8_t *address, | ||
size_t size) | ||
{ | ||
return validate_candidate_location_common((uintptr_t) address, size); | ||
Check failure on line 33 in tests/subsys/suit/common/validator_test/validator_test.c GitHub Actions / Run compliance checks on patch series (PR)CODE_INDENT
Check warning on line 33 in tests/subsys/suit/common/validator_test/validator_test.c GitHub Actions / Run compliance checks on patch series (PR)SPACE_BEFORE_TAB
|
||
} |