Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Balint Dobszay | ff8e0cd | 2022-08-11 15:07:52 +0200 | [diff] [blame] | 2 | # Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved. |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
Balint Dobszay | 047aea8 | 2022-05-16 14:20:53 +0200 | [diff] [blame] | 7 | cmake_minimum_required(VERSION 3.18 FATAL_ERROR) |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 8 | include(../../deployment.cmake REQUIRED) |
| 9 | |
| 10 | #------------------------------------------------------------------------------- |
| 11 | # The CMakeLists.txt for building the libts deployment for linux-pc |
| 12 | # |
Gabor Toth | 7f7f442 | 2024-12-09 09:50:16 +0100 | [diff] [blame] | 13 | # Used for building the libts library for the linux-pc enviroment. |
| 14 | # For the linux-pc deployment, libts contains standalone versions of a set of |
| 15 | # trusted services to support client application development in a native PC |
| 16 | # environment. |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 17 | #------------------------------------------------------------------------------- |
| 18 | include(${TS_ROOT}/environments/linux-pc/env_shared_lib.cmake) |
| 19 | project(trusted-services LANGUAGES CXX C) |
| 20 | add_library(ts SHARED) |
| 21 | target_include_directories(ts PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
| 22 | |
| 23 | #------------------------------------------------------------------------------- |
Gabor Toth | ed8305b | 2024-09-24 12:47:26 +0200 | [diff] [blame] | 24 | # For user-specific tracing set to TRACE_LEVEL_NONE and implement: |
| 25 | # void trace_puts(const char *str) |
| 26 | #------------------------------------------------------------------------------- |
| 27 | |
| 28 | set(TRACE_PREFIX "LIBTS" CACHE STRING "Trace prefix") |
| 29 | set(TRACE_LEVEL "TRACE_LEVEL_DEBUG" CACHE STRING "Trace level") |
| 30 | #------------------------------------------------------------------------------- |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 31 | # External project source-level dependencies |
| 32 | # |
| 33 | #------------------------------------------------------------------------------- |
| 34 | include(${TS_ROOT}/external/tf_a/tf-a.cmake) |
| 35 | add_tfa_dependency(TARGET "ts") |
| 36 | |
| 37 | #------------------------------------------------------------------------------- |
Gabor Toth | 950e2b1 | 2023-11-15 12:46:35 +0100 | [diff] [blame] | 38 | # Options and variables |
| 39 | #------------------------------------------------------------------------------- |
| 40 | target_compile_definitions(ts PRIVATE |
| 41 | -DUEFI_AUTH_VAR |
| 42 | ) |
| 43 | |
| 44 | #------------------------------------------------------------------------------- |
Julian Hall | 2ca63d8 | 2022-12-21 15:20:43 +0000 | [diff] [blame] | 45 | # Define public interfaces for library |
| 46 | # |
| 47 | #------------------------------------------------------------------------------- |
| 48 | |
| 49 | # Extend libts public interface for linux-pc to allow for alternative fwu |
| 50 | # device configurations. This is intended for test. |
| 51 | target_compile_definitions(ts PRIVATE |
| 52 | EXPORT_PUBLIC_INTERFACE_FWU_SERVICE_CONTEXT |
| 53 | ) |
| 54 | |
Imre Kis | c895119 | 2023-11-03 17:11:33 +0100 | [diff] [blame] | 55 | # Enable RPMB authentication key write for host tests |
| 56 | set(RPMB_WRITE_KEY TRUE CACHE BOOL "Enable RPMB Authentication Key Write") |
| 57 | |
Julian Hall | 2ca63d8 | 2022-12-21 15:20:43 +0000 | [diff] [blame] | 58 | #------------------------------------------------------------------------------- |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 59 | # Components that are specific to deployment in the linux-pc environment. |
| 60 | # |
| 61 | #------------------------------------------------------------------------------- |
| 62 | add_components( |
| 63 | TARGET "ts" |
| 64 | BASE_DIR ${TS_ROOT} |
| 65 | COMPONENTS |
| 66 | "components/rpc/direct" |
Imre Kis | 63761fb | 2023-08-02 16:16:26 +0200 | [diff] [blame] | 67 | "components/rpc/common/endpoint" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 68 | "components/common/tlv" |
Julian Hall | b901999 | 2022-07-05 17:05:14 +0100 | [diff] [blame] | 69 | "components/common/uuid" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 70 | "components/common/endian" |
Julian Hall | 976f9cd | 2021-10-08 09:52:01 +0100 | [diff] [blame] | 71 | "components/common/utils" |
Balint Dobszay | 550ce87 | 2022-12-15 15:28:40 +0100 | [diff] [blame] | 72 | "components/common/crc32" |
Gabor Toth | af77b47 | 2024-04-05 11:19:37 +0200 | [diff] [blame] | 73 | "components/common/mbedtls" |
Julian Hall | 7048d30 | 2021-06-03 16:07:28 +0100 | [diff] [blame] | 74 | "components/config/ramstore" |
Julian Hall | a7e76c8 | 2021-04-14 11:12:11 +0100 | [diff] [blame] | 75 | "components/service/common/include" |
Julian Hall | 99a57e3 | 2021-07-28 14:18:50 +0100 | [diff] [blame] | 76 | "components/service/common/client" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 77 | "components/service/common/serializer/protobuf" |
| 78 | "components/service/common/provider" |
| 79 | "components/service/locator/standalone" |
| 80 | "components/service/locator/standalone/services/crypto" |
julhal01 | 3a4207d | 2021-03-08 13:32:08 +0000 | [diff] [blame] | 81 | "components/service/locator/standalone/services/internal-trusted-storage" |
| 82 | "components/service/locator/standalone/services/protected-storage" |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 83 | "components/service/locator/standalone/services/test-runner" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 84 | "components/service/locator/standalone/services/attestation" |
Julian Hall | eae7179 | 2022-07-05 15:57:40 +0100 | [diff] [blame] | 85 | "components/service/locator/standalone/services/block-storage" |
Julian Hall | 2ca63d8 | 2022-12-21 15:20:43 +0000 | [diff] [blame] | 86 | "components/service/locator/standalone/services/fwu" |
Imre Kis | c895119 | 2023-11-03 17:11:33 +0100 | [diff] [blame] | 87 | "components/service/locator/standalone/services/rpmb" |
Julian Hall | 976f9cd | 2021-10-08 09:52:01 +0100 | [diff] [blame] | 88 | "components/service/locator/standalone/services/smm-variable" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 89 | "components/service/attestation/include" |
| 90 | "components/service/attestation/claims" |
Julian Hall | 0446491 | 2021-05-18 15:32:49 +0100 | [diff] [blame] | 91 | "components/service/attestation/claims/sources/boot_seed_generator" |
| 92 | "components/service/attestation/claims/sources/null_lifecycle" |
| 93 | "components/service/attestation/claims/sources/instance_id" |
Julian Hall | b7db580 | 2021-07-26 16:20:40 +0100 | [diff] [blame] | 94 | "components/service/attestation/claims/sources/implementation_id" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 95 | "components/service/attestation/claims/sources/event_log" |
| 96 | "components/service/attestation/claims/sources/event_log/mock" |
Julian Hall | 644b57a | 2021-06-30 08:45:19 +0100 | [diff] [blame] | 97 | "components/service/attestation/reporter/local" |
| 98 | "components/service/attestation/reporter/eat" |
| 99 | "components/service/attestation/key_mngr/local" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 100 | "components/service/attestation/provider" |
| 101 | "components/service/attestation/provider/serializer/packed-c" |
Balint Dobszay | abec464 | 2024-01-16 10:51:51 +0100 | [diff] [blame] | 102 | "components/service/crypto/include" |
| 103 | "components/service/crypto/client/psa" |
Julian Hall | eae7179 | 2022-07-05 15:57:40 +0100 | [diff] [blame] | 104 | "components/service/block_storage/block_store" |
| 105 | "components/service/block_storage/block_store/device" |
| 106 | "components/service/block_storage/block_store/device/ram" |
Imre Kis | c895119 | 2023-11-03 17:11:33 +0100 | [diff] [blame] | 107 | "components/service/block_storage/block_store/device/rpmb" |
Julian Hall | eae7179 | 2022-07-05 15:57:40 +0100 | [diff] [blame] | 108 | "components/service/block_storage/block_store/partitioned" |
Julian Hall | af91035 | 2022-07-26 14:42:34 +0100 | [diff] [blame] | 109 | "components/service/block_storage/block_store/client" |
Julian Hall | eae7179 | 2022-07-05 15:57:40 +0100 | [diff] [blame] | 110 | "components/service/block_storage/provider" |
| 111 | "components/service/block_storage/provider/serializer/packed-c" |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 112 | "components/service/block_storage/config/gpt" |
Julian Hall | b901999 | 2022-07-05 17:05:14 +0100 | [diff] [blame] | 113 | "components/service/block_storage/config/ref" |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 114 | "components/service/block_storage/factory/ref_ram_gpt" |
Julian Hall | af91035 | 2022-07-26 14:42:34 +0100 | [diff] [blame] | 115 | "components/service/block_storage/factory/client" |
Imre Kis | c895119 | 2023-11-03 17:11:33 +0100 | [diff] [blame] | 116 | "components/service/block_storage/factory/rpmb" |
Julian Hall | 9061e6c | 2021-06-29 14:24:20 +0100 | [diff] [blame] | 117 | "components/service/crypto/provider" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 118 | "components/service/crypto/provider/serializer/protobuf" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 119 | "components/service/crypto/provider/serializer/packed-c" |
Julian Hall | 7bfb18e | 2021-07-13 15:48:13 +0100 | [diff] [blame] | 120 | "components/service/crypto/provider/extension/hash" |
| 121 | "components/service/crypto/provider/extension/hash/serializer/packed-c" |
Julian Hall | e7bccbe | 2021-07-16 09:50:34 +0100 | [diff] [blame] | 122 | "components/service/crypto/provider/extension/cipher" |
| 123 | "components/service/crypto/provider/extension/cipher/serializer/packed-c" |
Julian Hall | fe487b7 | 2021-07-19 10:29:59 +0100 | [diff] [blame] | 124 | "components/service/crypto/provider/extension/key_derivation" |
| 125 | "components/service/crypto/provider/extension/key_derivation/serializer/packed-c" |
Julian Hall | a6d3cbc | 2021-07-20 10:13:21 +0100 | [diff] [blame] | 126 | "components/service/crypto/provider/extension/mac" |
| 127 | "components/service/crypto/provider/extension/mac/serializer/packed-c" |
Julian Hall | ee8e824 | 2022-02-11 14:24:53 +0000 | [diff] [blame] | 128 | "components/service/crypto/provider/extension/aead" |
| 129 | "components/service/crypto/provider/extension/aead/serializer/packed-c" |
Julian Hall | 7bfb18e | 2021-07-13 15:48:13 +0100 | [diff] [blame] | 130 | "components/service/crypto/factory/full" |
Julian Hall | 9061e6c | 2021-06-29 14:24:20 +0100 | [diff] [blame] | 131 | "components/service/crypto/backend/mbedcrypto" |
| 132 | "components/service/crypto/backend/mbedcrypto/trng_adapter/linux" |
Imre Kis | c895119 | 2023-11-03 17:11:33 +0100 | [diff] [blame] | 133 | "components/service/rpmb/backend" |
| 134 | "components/service/rpmb/backend/emulated" |
| 135 | "components/service/rpmb/client" |
| 136 | "components/service/rpmb/frontend" |
| 137 | "components/service/rpmb/frontend/platform/default" |
| 138 | "components/service/rpmb/provider" |
Julian Hall | a7e76c8 | 2021-04-14 11:12:11 +0100 | [diff] [blame] | 139 | "components/service/secure_storage/include" |
julhal01 | 1260f10 | 2021-02-15 17:34:08 +0000 | [diff] [blame] | 140 | "components/service/secure_storage/frontend/psa/its" |
| 141 | "components/service/secure_storage/frontend/secure_storage_provider" |
| 142 | "components/service/secure_storage/backend/secure_storage_client" |
julhal01 | 3a4207d | 2021-03-08 13:32:08 +0000 | [diff] [blame] | 143 | "components/service/secure_storage/backend/mock_store" |
| 144 | "components/service/secure_storage/backend/null_store" |
Julian Hall | af91035 | 2022-07-26 14:42:34 +0100 | [diff] [blame] | 145 | "components/service/secure_storage/backend/secure_flash_store" |
| 146 | "components/service/secure_storage/backend/secure_flash_store/flash_fs" |
| 147 | "components/service/secure_storage/backend/secure_flash_store/flash" |
| 148 | "components/service/secure_storage/backend/secure_flash_store/flash/block_store_adapter" |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 149 | "components/service/test_runner/provider" |
| 150 | "components/service/test_runner/provider/serializer/packed-c" |
| 151 | "components/service/test_runner/provider/backend/mock" |
julhal01 | 5fe411b | 2021-02-08 17:11:28 +0000 | [diff] [blame] | 152 | "components/service/test_runner/provider/backend/simple_c" |
Julian Hall | 98656d5 | 2022-05-05 11:09:21 +0100 | [diff] [blame] | 153 | "components/service/uefi/smm_variable/backend" |
| 154 | "components/service/uefi/smm_variable/provider" |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 155 | "components/media/disk" |
| 156 | "components/media/disk/disk_images" |
| 157 | "components/media/disk/formatter" |
Julian Hall | 4a658ac | 2022-10-20 10:44:49 +0100 | [diff] [blame] | 158 | "components/media/volume" |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 159 | "components/media/volume/index" |
| 160 | "components/media/volume/base_io_dev" |
Julian Hall | 4a658ac | 2022-10-20 10:44:49 +0100 | [diff] [blame] | 161 | "components/media/volume/block_volume" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 162 | "protocols/rpc/common/packed-c" |
| 163 | "protocols/service/crypto/packed-c" |
| 164 | "protocols/service/crypto/protobuf" |
| 165 | "protocols/service/secure_storage/packed-c" |
| 166 | ) |
| 167 | |
| 168 | #------------------------------------------------------------------------------- |
| 169 | # Extend with components that are common across all deployments of |
| 170 | # libts |
| 171 | # |
| 172 | #------------------------------------------------------------------------------- |
| 173 | include(../libts.cmake REQUIRED) |
| 174 | |
| 175 | #------------------------------------------------------------------------------- |
| 176 | # Components used by libts from external projects |
| 177 | # |
| 178 | #------------------------------------------------------------------------------- |
| 179 | |
| 180 | # Nanopb |
| 181 | include(${TS_ROOT}/external/nanopb/nanopb.cmake) |
| 182 | target_link_libraries(ts PRIVATE nanopb::protobuf-nanopb-static) |
| 183 | protobuf_generate_all(TGT "ts" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols") |
| 184 | |
Julian Hall | a544317 | 2022-05-30 11:52:11 +0100 | [diff] [blame] | 185 | # MbedTLS |
Gabor Toth | 4ad8b99 | 2024-08-13 10:41:48 +0200 | [diff] [blame] | 186 | set(MBEDTLS_CONFIG_FILE "${TS_ROOT}/external/MbedTLS/config/crypto_provider_x509.h" |
Julian Hall | a544317 | 2022-05-30 11:52:11 +0100 | [diff] [blame] | 187 | CACHE STRING "Configuration file for Mbed TLS" FORCE) |
Balint Dobszay | 3c52ce6 | 2021-05-10 16:27:18 +0200 | [diff] [blame] | 188 | include(${TS_ROOT}/external/MbedTLS/MbedTLS.cmake) |
Balint Dobszay | ff8e0cd | 2022-08-11 15:07:52 +0200 | [diff] [blame] | 189 | target_link_libraries(ts PRIVATE MbedTLS::mbedcrypto) |
Julian Hall | a544317 | 2022-05-30 11:52:11 +0100 | [diff] [blame] | 190 | target_link_libraries(ts PRIVATE MbedTLS::mbedx509) |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 191 | |
Gabor Toth | ab7db21 | 2023-08-18 16:08:12 +0200 | [diff] [blame] | 192 | # Pass the location of the mbedtls config file to C preprocessor. |
| 193 | target_compile_definitions(ts PRIVATE |
Gabor Toth | 4ad8b99 | 2024-08-13 10:41:48 +0200 | [diff] [blame] | 194 | MBEDTLS_CONFIG_FILE="${MBEDTLS_CONFIG_FILE}" |
Gabor Toth | ab7db21 | 2023-08-18 16:08:12 +0200 | [diff] [blame] | 195 | ) |
| 196 | |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 197 | # Qcbor |
| 198 | include(${TS_ROOT}/external/qcbor/qcbor.cmake) |
| 199 | target_link_libraries(ts PRIVATE qcbor) |
| 200 | |
| 201 | # t_cose |
| 202 | include(${TS_ROOT}/external/t_cose/t_cose.cmake) |
| 203 | target_link_libraries(ts PRIVATE t_cose) |