1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8if (NOT TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
9    return()
10endif()
11
12cmake_minimum_required(VERSION 3.21)
13
14add_library(tfm_psa_rot_partition_its STATIC)
15
16add_dependencies(tfm_psa_rot_partition_its manifest_tool)
17
18target_include_directories(tfm_psa_rot_partition_its
19    PRIVATE
20        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
21        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage
22    PUBLIC
23        # Required for ps_object_defs.h
24        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../protected_storage>
25)
26target_include_directories(tfm_partitions
27    INTERFACE
28        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage
29)
30
31target_sources(tfm_psa_rot_partition_its
32    PRIVATE
33        tfm_its_req_mngr.c
34        tfm_internal_trusted_storage.c
35        its_utils.c
36        $<$<BOOL:${ITS_ENCRYPTION}>:its_crypto_interface.c>
37        flash/its_flash.c
38        flash/its_flash_nand.c
39        flash/its_flash_nor.c
40        flash/its_flash_ram.c
41        flash_fs/its_flash_fs.c
42        flash_fs/its_flash_fs_dblock.c
43        flash_fs/its_flash_fs_mblock.c
44)
45
46# The generated sources
47target_sources(tfm_psa_rot_partition_its
48    PRIVATE
49        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage/auto_generated/intermedia_tfm_internal_trusted_storage.c
50)
51target_sources(tfm_partitions
52    INTERFACE
53        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage/auto_generated/load_info_tfm_internal_trusted_storage.c
54)
55
56target_link_libraries(tfm_psa_rot_partition_its
57    PRIVATE
58        platform_s
59        tfm_config
60        tfm_sprt
61)
62
63target_compile_definitions(tfm_psa_rot_partition_its
64    PUBLIC
65        PS_CRYPTO_AEAD_ALG=${PS_CRYPTO_AEAD_ALG}
66)
67
68################ Display the configuration being applied #######################
69
70include(utils)
71    dump_options("Storage config"
72    "
73        PS_CRYPTO_AEAD_ALG;
74    "
75    )
76
77############################ Partition Defs ####################################
78
79target_link_libraries(tfm_partitions
80    INTERFACE
81        tfm_psa_rot_partition_its
82)
83
84target_compile_definitions(tfm_config
85    INTERFACE
86        TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
87)
88