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

# This file is populated with custom configuration for TF-M to state that the PSA core is built externally
# This can be rewritten when solving NCSDK-XXXXX
set(PSA_CRYPTO_EXTERNAL_CORE                  ON    CACHE BOOL      "Enable building PSA core externally")

# This file is populated with paths needed building nrf_security with and without TF-M
# It is added to circumvent issues with install-targets inside TF-M and to unify the
# CMake code with Zephyr builds
set(NRF_DIR                              C:/NCS/v3.4.0/nrf                                        CACHE STRING "nrf folder")
set(NRF_SECURITY_DIR                     C:/NCS/v3.4.0/nrf/subsys/nrf_security                    CACHE STRING "nrf_security folder")
set(TFM_BOARDS_NRF_DIR                   C:/NCS/v3.4.0/nrf/modules/trusted-firmware-m/tfm_boards  CACHE STRING "tfm_boards folder")
set(ZEPHYR_NRFXLIB_MODULE_DIR            C:/NCS/v3.4.0/nrfxlib                      CACHE STRING "nrfxlib folder")
set(ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR  C:/NCS/v3.4.0/modules/crypto/oberon-psa-crypto            CACHE STRING "oberon-psa-crypto folder")
set(ZEPHYR_MBEDTLS_MODULE_DIR            C:/NCS/v3.4.0/modules/crypto/mbedtls                      CACHE STRING "mbedtls folder")

# This file is populated with the Mbed TLS config file names
set(CONFIG_MBEDTLS_CONFIG_FILE            nrf-config.h              CACHE STRING "Mbed TLS config file")
set(CONFIG_TF_PSA_CRYPTO_CONFIG_FILE      nrf-psa-crypto-config.h        CACHE STRING "TF-PSA-Crypto config file (PSA_WANT)")
set(CONFIG_TF_PSA_CRYPTO_USER_CONFIG_FILE nrf-psa-crypto-user-config.h   CACHE STRING "TF-PSA-Crypto user config file (PSA_NEED)")

# This file is populated with the generated include-folders for PSA interface (for main app, ns-services) as
# well as the include-folder for library build of the crypto toolbo with or without TF-M
set(PSA_CRYPTO_CONFIG_INTERFACE_PATH    C:/Users/amhs/Downloads/ecdsa-brainpool-verify/build/ecdsa-brainpool-verify/generated/interface_nrf_security_psa CACHE STRING "Path used for generated PSA crypto configuratiosn for the interface")
set(PSA_CRYPTO_CONFIG_LIBRARY_PATH      C:/Users/amhs/Downloads/ecdsa-brainpool-verify/build/ecdsa-brainpool-verify/generated/library_nrf_security_psa CACHE STRING "Path used for generated PSA crypto for library builds")

# Defines used by including external_core.cmake multiple times (to clean up for CMake trace)
# This definitely needs to be reworked in upstream TF-M
set(EXTERNAL_CRYPTO_CORE_HANDLED_TFM_API_NS False CACHE BOOL "Use to ensure we add links only once")
set(EXTERNAL_CRYPTO_CORE_HANDLED_PSA_INTERFACE False CACHE BOOL "Use to ensure we add links only once")
set(EXTERNAL_CRYPTO_CORE_HANDLED_PSA_CRYPTO_CONFIG False CACHE BOOL "Use to ensure we add links only once")
set(EXTERNAL_CRYPTO_CORE_HANDLED_PSA_CRYPTO_LIBRARY_CONFIG False CACHE BOOL "Use to ensure we add links only once")
set(EXTERNAL_CRYPTO_CORE_HANDLED_TFM_PSA_ROT_PARTITION_CRYPTO False CACHE BOOL "Use to ensure we add links only once")
set(EXTERNAL_CRYPTO_CORE_HANDLED_TFM_SPRT False CACHE BOOL "Use to ensure we add links only once")
