1#-------------------------------------------------------------------------------
2# Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7if (NOT DEFINED TGT)
8	message(FATAL_ERROR "mandatory parameter TGT is not defined.")
9endif()
10
11target_include_directories(${TGT} PRIVATE
12	"${MBEDTLS_INSTALL_DIR}/include"
13)
14target_sources(${TGT} PRIVATE
15	"${CMAKE_CURRENT_LIST_DIR}/mbedcrypto_backend.c"
16	)
17
18# Use secure storage client to realize PSA ITS C API used by libmbedcrypto for
19# persistent key storage.
20set(MBEDTLS_EXTRA_INCLUDES
21	"${TS_ROOT}/components/service/common/include"
22	"${TS_ROOT}/components/service/secure_storage/include"
23	CACHE STRING "PSA ITS for MbedTLS" FORCE)
24
25# Override the default crypto backend interface with an alternative that is
26# compatible with the configuration of mbedtls that this component imposes.
27target_compile_definitions(${TGT} PUBLIC
28	ALTERNATIVE_CRYPTO_BACKEND="${CMAKE_CURRENT_LIST_DIR}/mbedtls_psa_crypto_backend.h"
29	)
30