blob: dd6f60c08e8f7a3d3709c36a183aeec034d87e93 [file] [log] [blame]
Julian Hallc02fffb2020-11-23 18:22:06 +01001#-------------------------------------------------------------------------------
Gabor Tothab7db212023-08-18 16:08:12 +02002# Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
Julian Hallc02fffb2020-11-23 18:22:06 +01003#
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
Gabor Tothab7db212023-08-18 16:08:12 +020011target_include_directories(${TGT} PRIVATE
12 "${MBEDTLS_INSTALL_DIR}/include"
13)
Julian Hallc02fffb2020-11-23 18:22:06 +010014target_sources(${TGT} PRIVATE
Julian Hall9061e6c2021-06-29 14:24:20 +010015 "${CMAKE_CURRENT_LIST_DIR}/mbedcrypto_backend.c"
Julian Hallc02fffb2020-11-23 18:22:06 +010016 )
17
Julian Halla5443172022-05-30 11:52:11 +010018# Use secure storage client to realize PSA ITS C API used by libmbedcrypto for
19# persistent key storage.
Balint Dobszay3c52ce62021-05-10 16:27:18 +020020set(MBEDTLS_EXTRA_INCLUDES
Julian Halla7e76c82021-04-14 11:12:11 +010021 "${TS_ROOT}/components/service/common/include"
22 "${TS_ROOT}/components/service/secure_storage/include"
Julian Halla5443172022-05-30 11:52:11 +010023 CACHE STRING "PSA ITS for MbedTLS" FORCE)
Balint Dobszayabec4642024-01-16 10:51:51 +010024
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 )