Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suit: General fixup #20064

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions subsys/suit/cache/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ if SUIT_CACHE
config SUIT_CACHE_MAX_CACHES
int "The maximum number of caches that will be handled"
range 1 16
default 8
help
The maximum number of user-defined caches is limited to 15.
User defined cache partitions names start at index 1 as suit_cache_0 is predefined.
The default value is 8, and the minimum is 1.
default 8

config APP_LINK_WITH_SUIT_CACHE_INTERFACE
bool
Expand All @@ -30,8 +30,8 @@ config SUIT_MAX_URI_LENGTH
range 1 512
default 128
help
This option determines the longest URI that can be read or written from
the cache.
This option determines the longest URI that can be read or written from
the cache.

config SUIT_CACHE_RW
bool "Enable write mode for SUIT cache"
Expand Down
2 changes: 2 additions & 0 deletions subsys/suit/mci/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ target_link_libraries(suit_mci INTERFACE suit_platform_err)
target_link_libraries(suit_mci INTERFACE suit_metadata)

zephyr_library()

if(CONFIG_SUIT_MCI_IMPL_SDFW)
zephyr_library_sources(src/suit_mci_${CONFIG_SOC}.c)
endif()

zephyr_library_sources(src/suit_generic_ids.c)

zephyr_library_link_libraries(suit_mci)
Expand Down
7 changes: 3 additions & 4 deletions subsys/suit/mci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if SUIT_MCI

config SUPPORT_SUIT_MCI_IMPL_SDFW
bool
default y if SOC_SERIES_NRF54HX
default y if SOC_SERIES_NRF54HX && SUIT_PLATFORM_VARIANT_SDFW

choice SUIT_MCI_IMPL
prompt "MCI implementation"
Expand All @@ -22,12 +22,11 @@ choice SUIT_MCI_IMPL

config SUIT_MCI_IMPL_SDFW
bool "Secure domain"
depends on SUIT_PLATFORM_VARIANT_SDFW
depends on SUPPORT_SUIT_MCI_IMPL_SDFW

config SUIT_MCI_IMPL_CUSTOM
bool "custom"
bool "Custom"

endchoice #MCI implementation
endchoice # SUIT_MCI_IMPL

endif # SUIT_MCI
7 changes: 4 additions & 3 deletions subsys/suit/memptr_storage/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ if SUIT_MEMPTR_STORAGE
config SUIT_MAX_NUMBER_OF_INTEGRATED_PAYLOADS
int "The maximum number of envelope reference components that will be handled"
range 0 255
help
Index is of type uint8_t, which restricts number of components of this type to 255.
Default value is 8 and minimal 0. Where 0 means that Envelope Reference component is disabled.
default 8
help
Index is of type uint8_t, which restricts number of components of this type to 255.
Default value is 8 and minimal 0. Where 0 means that Envelope Reference component is
disabled.

endif # SUIT_MEMPTR_STORAGE
13 changes: 7 additions & 6 deletions subsys/suit/platform/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,22 @@ config SUIT_DIGEST
depends on SUIT_STREAM_SINK_DIGEST

config MAX_NUMBER_OF_MANIFEST_CLASS_IDS
int "Maximum number of supported manifest class IDs that can be handled"
int "Maximum number of supported manifest class IDs that can be handled"
range 1 200
default 11 if SOC_SERIES_NRF54HX
default 5 if SOC_NRF52840
default 5 if SOC_POSIX
help
Check SUIT_STORAGE_N_ENVELOPES
Check SUIT_STORAGE_N_ENVELOPES

if SUIT_PLATFORM_VARIANT_SDFW

rsource "sdfw/Kconfig"

endif # SUIT_PLATFORM_VARIANT_SDFW

rsource "sink_selector/Kconfig"

endif # SUIT_PLATFORM

config SUIT_CRYPTO
Expand All @@ -51,17 +54,14 @@ config SUIT_CRYPTO
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE
imply PSA_WANT_ECC_TWISTED_EDWARDS_255


if MBEDTLS && SOC_POSIX

# Make sure that PSA API compatibility layer is enabled
config MBEDTLS_PSA_CRYPTO_C
bool
default y

# Instruct mbedTLS to use Zephyr entropy
config MBEDTLS_ZEPHYR_ENTROPY
bool
config MBEDTLS_ENTROPY_POLL_ZEPHYR
default y

config SUIT_DEFAULT_MBEDTLS_CONFIG
Expand All @@ -71,6 +71,7 @@ config SUIT_DEFAULT_MBEDTLS_CONFIG

config MBEDTLS_USER_CONFIG_FILE
default "user-tls-conf.h" if SUIT_DEFAULT_MBEDTLS_CONFIG

endif

config SUIT_CHECK_IMAGE_MATCH
Expand Down
9 changes: 7 additions & 2 deletions subsys/suit/storage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ target_link_libraries(suit_storage_interface INTERFACE suit_platform_err)
target_link_libraries(suit_storage_interface INTERFACE suit_utils)

zephyr_library()
zephyr_library_sources_ifdef(CONFIG_SUIT_STORAGE_LAYOUT_TEST src/suit_storage_test.c)
zephyr_library_sources_ifdef(CONFIG_SUIT_STORAGE_LAYOUT_NRF54H20 src/suit_storage_nrf54h20.c)

if(CONFIG_SUIT_STORAGE_LAYOUT_SOC)
zephyr_library_sources(src/suit_storage_${CONFIG_SOC}.c)
elseif(CONFIG_SUIT_STORAGE_LAYOUT_TEST)
zephyr_library_sources(src/suit_storage_test.c)
endif()

zephyr_library_sources(src/suit_storage_update.c)
zephyr_library_sources(src/suit_storage_encode.c)
zephyr_library_sources(src/suit_storage_envelope.c)
Expand Down
19 changes: 14 additions & 5 deletions subsys/suit/storage/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,26 @@ menuconfig SUIT_STORAGE

if SUIT_STORAGE

config SUPPORT_SUIT_STORAGE_LAYOUT_SOC
bool
default y if SOC_SERIES_NRF54HX

config SUPPORT_SUIT_STORAGE_LAYOUT_TEST
bool

choice SUIT_STORAGE_LAYOUT
prompt "MCU-specific layout of the SUIT storage"
default SUIT_STORAGE_LAYOUT_NRF54H20 if SOC_SERIES_NRF54HX
default SUIT_STORAGE_LAYOUT_TEST if !SOC_SERIES_NRF54HX
default SUIT_STORAGE_LAYOUT_SOC if SUPPORT_SUIT_STORAGE_LAYOUT_SOC
default SUIT_STORAGE_LAYOUT_TEST if SUPPORT_SUIT_STORAGE_LAYOUT_TEST

config SUIT_STORAGE_LAYOUT_NRF54H20
bool "nRF54H20"
config SUIT_STORAGE_LAYOUT_SOC
bool "SoC default"
depends on SUPPORT_SUIT_STORAGE_LAYOUT_SOC
select PSA_WANT_ALG_SHA_256 if SUIT_CRYPTO

config SUIT_STORAGE_LAYOUT_TEST
bool "tests"
bool "Tests"
depends on SUPPORT_SUIT_STORAGE_LAYOUT_TEST
help
Configuration to be used for running SUIT tests

Expand Down
8 changes: 6 additions & 2 deletions subsys/suit/stream/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ config SUIT_STREAM_SINK_DIGEST
imply PSA_WANT_ALG_SHA_512 if SOC_FAMILY_NORDIC_NRF

if SUIT_STREAM_SINK_DIGEST
config SUIT_STREAM_SINK_DIGEST_CONTEXT_COUNT

config SUIT_STREAM_SINK_DIGEST_CONTEXT_COUNT
int "Maximum number of contexts"
default 1

endif # SUIT_STREAM_SINK_DIGEST

config SUIT_STREAM_SOURCE_CACHE
Expand Down Expand Up @@ -166,9 +168,11 @@ config SUIT_STREAM_IPC_PROVIDER
depends on SUIT_STREAM_FETCH_SOURCE_MGR

config SUIT_STREAM_IPC_PROVIDER_BUFFERS
int "The number of buffers supported by provider. For optimal performance should be equal to CONFIG_SUIT_STREAM_IPC_REQUESTOR_MAX_CHUNKS"
int "The number of buffers supported by provider"
default 3
depends on SUIT_STREAM_IPC_PROVIDER
help
For optimal performance should be equal to CONFIG_SUIT_STREAM_IPC_REQUESTOR_MAX_CHUNKS

config SUIT_STREAM_IPC_PROVIDER_BUFFER_SIZE
int "Size of single buffer in bytes"
Expand Down
5 changes: 4 additions & 1 deletion subsys/suit/validator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ target_include_directories(suit_validator INTERFACE include)
target_link_libraries(suit_validator INTERFACE suit_platform_err)

zephyr_library()
zephyr_library_sources_ifdef(CONFIG_SUIT_VALIDATOR_IMPL_NRF54H20_SDFW src/suit_validator_nrf54h20.c)

if(CONFIG_SUIT_VALIDATOR_IMPL_SDFW)
zephyr_library_sources(src/suit_validator_${CONFIG_SOC}.c)
endif()

zephyr_library_link_libraries(suit_validator)
zephyr_library_link_libraries(suit_memory_layout_interface)
15 changes: 10 additions & 5 deletions subsys/suit/validator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ menuconfig SUIT_VALIDATOR

if SUIT_VALIDATOR

config SUPPORT_SUIT_VALIDATOR_IMPL_SDFW
bool
default y if SOC_SERIES_NRF54HX && SUIT_PLATFORM_VARIANT_SDFW

choice SUIT_VALIDATOR_IMPL
prompt "SUIT validator implementation"
default SUIT_VALIDATOR_IMPL_SDFW if SUPPORT_SUIT_VALIDATOR_IMPL_SDFW
default SUIT_VALIDATOR_IMPL_CUSTOM

config SUIT_VALIDATOR_IMPL_NRF54H20_SDFW
bool "nRF54H20: Secure domain"
depends on SOC_SERIES_NRF54HX
depends on SUIT_PLATFORM_VARIANT_SDFW
config SUIT_VALIDATOR_IMPL_SDFW
bool "Secure domain"
depends on SUPPORT_SUIT_VALIDATOR_IMPL_SDFW

config SUIT_VALIDATOR_IMPL_CUSTOM
bool "custom"
bool "Custom"

endchoice # SUIT_VALIDATOR_IMPL

Expand Down
1 change: 0 additions & 1 deletion tests/subsys/suit/cache_pool_digest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(integration_test_cache_pool_digest)
include(../cmake/test_template.cmake)


zephyr_library_link_libraries(suit_stream_sinks_interface)
zephyr_library_link_libraries(suit_utils)
zephyr_library_link_libraries(suit_platform_interface)
Expand Down
9 changes: 9 additions & 0 deletions tests/subsys/suit/check_content/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

rsource "../tests/Kconfig"

source "Kconfig.zephyr"
9 changes: 9 additions & 0 deletions tests/subsys/suit/check_image_match/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

rsource "../tests/Kconfig"

source "Kconfig.zephyr"
54 changes: 27 additions & 27 deletions tests/subsys/suit/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,35 @@ add_subdirectory(validator_test)
add_subdirectory_ifdef(CONFIG_SUIT_STREAM_FILTER_DECRYPT decrypt_utils)
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/include)

if (CONFIG_MBEDTLS)
if (CONFIG_SUIT_PLATFORM)
# Link SUIT platform (incl. crypto) module with mbedTLS library, that provides PSA crypto APIs.
target_link_libraries(suit_platform_interface INTERFACE mbedTLS)
endif() # CONFIG_SUIT_PLATFORM

if (CONFIG_SUIT_STREAM_SINK_DIGEST)
target_link_libraries(suit_stream_sinks_interface INTERFACE mbedTLS)
if(CONFIG_MBEDTLS)
if(CONFIG_SUIT_PLATFORM)
# Link SUIT platform (incl. crypto) module with mbedTLS library, that provides PSA crypto APIs.
target_link_libraries(suit_platform_interface INTERFACE mbedTLS)
endif()

if(CONFIG_SUIT_STREAM_SINK_DIGEST)
target_link_libraries(suit_stream_sinks_interface INTERFACE mbedTLS)
endif()

if(CONFIG_SUIT_STREAM_FILTER_DECRYPT)
target_link_libraries(suit_stream_filters_interface INTERFACE mbedTLS)
target_link_libraries(suit_decrypt_test_utils PUBLIC mbedTLS)
endif()

if(CONFIG_SUIT_STORAGE_LAYOUT_SOC)
target_link_libraries(suit_storage_interface INTERFACE mbedTLS)
endif()

# Fix the mbedTLS build scripts:
# The "mbedtls/library/psa_crypto_cipher.c" file includes "<psa_crypto_cipher.h>",
# but this header is not a part of mbedTLS public API, thus it is not found and
# the compiler reports this as an error.
target_include_directories(mbedTLS INTERFACE ${ZEPHYR_MBEDTLS_MODULE_DIR}/library)
endif()

if (CONFIG_SUIT_STREAM_FILTER_DECRYPT)
target_link_libraries(suit_stream_filters_interface INTERFACE mbedTLS)
target_link_libraries(suit_decrypt_test_utils PUBLIC mbedTLS)
endif()

if (CONFIG_SUIT_STORAGE_LAYOUT_NRF54H20)
target_link_libraries(suit_storage_interface INTERFACE mbedTLS)
endif()

# Fix the mbedTLS build scripts:
# The "mbedtls/library/psa_crypto_cipher.c" file includes "<psa_crypto_cipher.h>",
# but this header is not a part of mbedTLS public API, thus it is not found and
# the compiler reports this as an error.
target_include_directories(mbedTLS INTERFACE ${ZEPHYR_MBEDTLS_MODULE_DIR}/library)
endif()

if (CONFIG_SUIT_DEFAULT_MBEDTLS_CONFIG)
# Add include path for the default, customized mbedTLS configuration header.
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/tls_config)
if(CONFIG_SUIT_DEFAULT_MBEDTLS_CONFIG)
# Add include path for the default, customized mbedTLS configuration header.
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/tls_config)
endif()

zephyr_interface_library_named(suit_update_magic_values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ project(integration_suit_component_compatibility_check)
include(../cmake/test_template.cmake)

target_include_directories(app PRIVATE
${SUIT_SUBSYS_DIR}/mci//include
${SUIT_SUBSYS_DIR}/mci/include
${SUIT_SUBSYS_DIR}/storage/include
)

target_sources(app PRIVATE
# Use nRF54H20-specific MCI implementation.
${SUIT_SUBSYS_DIR}/mci/src/suit_mci_nrf54h20.c
${SUIT_SUBSYS_DIR}/platform/sdfw/src/suit_plat_component_compatibility.c
${SUIT_SUBSYS_DIR}/storage/src/suit_storage_nrf54h20.c
)

# Link with the CMake target, that includes SUIT platform internal APIs header
Expand Down
2 changes: 0 additions & 2 deletions tests/subsys/suit/component_compatibility_check/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ CONFIG_SUIT_MEMPTR_STORAGE=y
CONFIG_SUIT_PLATFORM=y
CONFIG_SUIT_PLATFORM_VARIANT_SDFW=y

# Force SUIT storage memory layout to match nRF54H20-specific implementation.
CONFIG_SUIT_STORAGE=y
CONFIG_SUIT_STORAGE_LAYOUT_NRF54H20=y
CONFIG_SUIT_METADATA=y
# nRF54H20 storage uses SHA-256 to protect MPI and NVVs:
CONFIG_SUIT_CRYPTO=y
Expand Down
1 change: 1 addition & 0 deletions tests/subsys/suit/copy/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@

# Include and define MOCK_* Kconfigs
rsource "../mocks/Kconfig"
rsource "../tests/Kconfig"

source "Kconfig.zephyr"
3 changes: 1 addition & 2 deletions tests/subsys/suit/digest_sink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(integration_test_suit_digest_sink)
include(../cmake/test_template.cmake)


# link with the cmake target, that includes suit platform internal apis header
# Link with the CMake target, that includes suit platform internal apis header
zephyr_library_link_libraries(suit_stream_sinks_interface)
9 changes: 9 additions & 0 deletions tests/subsys/suit/envelope_decoder/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

rsource "../tests/Kconfig"

source "Kconfig.zephyr"
9 changes: 9 additions & 0 deletions tests/subsys/suit/fetch_integrated_payload_flash/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

rsource "../tests/Kconfig"

source "Kconfig.zephyr"
2 changes: 1 addition & 1 deletion tests/subsys/suit/flash_sink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(integration_test_flash_sink)
include(../cmake/test_template.cmake)

# link with the cmake target, that includes suit platform internal apis header
# Link with the CMake target, that includes suit platform internal apis header
zephyr_library_link_libraries(suit_utils)
zephyr_library_link_libraries(suit_stream_sinks_interface)
Loading