#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

menuconfig SUIT_PLATFORM
	bool "Enable SUIT component implementations"
	depends on SUIT_PROCESSOR
	depends on SUIT_UTILS
	depends on SUIT_MEMPTR_STORAGE

if SUIT_PLATFORM

config SUIT_DEVCONFIG
	bool "Enable manifest authorization and installation"
	depends on SUIT_STORAGE
	depends on SUIT_MCI
	depends on SUIT_METADATA

config SUIT_DIGEST
	bool "Enable digest calculation"
	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"
	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

if SUIT_PLATFORM_VARIANT_SDFW
rsource "sdfw/Kconfig"
endif # SUIT_PLATFORM_VARIANT_SDFW

rsource "sink_selector/Kconfig"
endif # SUIT_PLATFORM

config SUIT_CRYPTO
	bool "Enable crypto backend, suitable for SUIT components"
	imply MBEDTLS if !SOC_FAMILY_NORDIC_NRF
	imply NRF_SECURITY if SOC_FAMILY_NORDIC_NRF
	imply MBEDTLS_ENABLE_HEAP if SOC_FAMILY_NORDIC_NRF
	imply ENTROPY_GENERATOR
	imply PSA_CRYPTO_DRIVER_CRACEN
	imply PSA_WANT_ALG_PURE_EDDSA
	imply PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC if SOC_FAMILY_NORDIC_NRF
	imply PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT if SOC_FAMILY_NORDIC_NRF
	imply PSA_WANT_ECC_TWISTED_EDWARDS_255 if SOC_FAMILY_NORDIC_NRF


if MBEDTLS

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

# Instruct mbedTLS to use Zephyr entropy
config MBEDTLS_ZEPHYR_ENTROPY
	default y

config SUIT_DEFAULT_MBEDTLS_CONFIG
	bool "Use default mbedTLS configuration file"
	default y
	select MBEDTLS_USER_CONFIG_ENABLE

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

config SUIT_CHECK_IMAGE_MATCH
	bool "Enable image digest verification"
	depends on SUIT_CRYPTO
	depends on SUIT_DIGEST
	depends on SUIT_STREAM
	depends on SUIT_STREAM_SINK_DIGEST
	depends on SUIT_STREAM_SOURCE_MEMPTR

config SUIT_PLAT_CHECK_COMPONENT_COMPATIBILITY
	bool "Enable component ID check against supported manifest class IDs"
	depends on SUIT_UTILS
	depends on SUIT_METADATA

config SUIT_PLAT_CHECK_CLASSES
	bool "Enable vendor/class/device class ID checks"
	depends on SUIT_PLAT_CHECK_COMPONENT_COMPATIBILITY
