Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2020, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | set(BL2 ON CACHE BOOL "Whether to build BL2") |
| 9 | set(NS ON CACHE BOOL "Whether to build NS app") |
| 10 | |
| 11 | set(TEST_S OFF CACHE BOOL "Whether to build S regression tests") |
| 12 | set(TEST_NS OFF CACHE BOOL "Whether to build NS regression tests") |
| 13 | set(TEST_PSA_API "" CACHE STRING "Which (if any) of the PSA API tests should be compiled") |
| 14 | |
| 15 | set(TFM_PSA_API OFF CACHE BOOL "Use PSA api (IPC mode) instead of secure library mode") |
| 16 | set(TFM_ISOLATION_LEVEL 1 CACHE STRING "Isolation level") |
| 17 | set(TFM_PROFILE "" CACHE STRING "Profile to use") |
| 18 | |
| 19 | set(TFM_NS_CLIENT_IDENTIFICATION OFF CACHE BOOL "Enable NS client identification") |
| 20 | |
| 21 | set(TFM_EXTRA_CONFIG_PATH "" CACHE PATH "Path to extra cmake config file") |
| 22 | set(TFM_EXTRA_MANIFEST_LIST_PATH "" CACHE PATH "Path to extra manifest file, used to declare extra partitions. Appended to standard TFM manifest") |
| 23 | set(TFM_EXTRA_GENERATED_FILE_LIST_PATH "" CACHE PATH "Path to extra generated file list. Appended to stardard TFM generated file list.") |
| 24 | |
| 25 | ########################## BL2 ################################################# |
| 26 | |
| 27 | set(MCUBOOT_IMAGE_NUMBER 2 CACHE STRING "Whether to combine S and NS into either 1 image, or sign each seperately") |
| 28 | set(MCUBOOT_EXECUTION_SLOT 1 CACHE STRING "Slot from which to execute the image, used for XIP mode") |
| 29 | set(MCUBOOT_LOG_LEVEL "INFO" CACHE STRING "Level of logging to use for MCUboot [OFF, ERROR, WARNING, INFO, DEBUG]") |
| 30 | set(MCUBOOT_HW_KEY ON CACHE BOOL "Whether to embed the entire public key in the image metadata instead of the hash only") |
Tamas Ban | f4023f3 | 2020-09-16 11:02:52 +0100 | [diff] [blame] | 31 | set(MCUBOOT_UPGRADE_STRATEGY "OVERWRITE_ONLY" CACHE STRING "Upgrade strategy for images [OVERWRITE_ONLY, SWAP, DIRECT_XIP, RAM_LOAD]") |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 32 | set(MCUBOOT_MEASURED_BOOT ON CACHE BOOL "Add boot measurement values to boot status. Used for initial attestation token") |
| 33 | set(MCUBOOT_HW_ROLLBACK_PROT ON CACHE BOOL "Enable security counter validation against non-volatile HW counters") |
| 34 | set(MCUBOOT_ENC_IMAGES OFF CACHE BOOL "Enable encrypted image upgrade support") |
| 35 | set(MCUBOOT_ENCRYPT_RSA OFF CACHE BOOL "Use RSA for encrypted image upgrade support") |
Tamas Ban | 1bfc9da | 2020-07-09 13:55:38 +0100 | [diff] [blame] | 36 | set(MCUBOOT_FIH_PROFILE OFF CACHE STRING "Fault injection hardening profile [OFF, LOW, MEDIUM, HIGH]") |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 37 | |
| 38 | # Note - If either SIGNATURE_TYPE or KEY_LEN are changed, the entries for KEY_S |
| 39 | # and KEY_NS will either have to be updated manually or removed from the cache. |
| 40 | # `cmake .. -UMCUBOOT_KEY_S -UMCUBOOT_KEY_NS`. Once removed from the cache it |
| 41 | # will be set to default again. |
| 42 | set(MCUBOOT_SIGNATURE_TYPE "RSA" CACHE STRING "Algorithm to use for signature validation") |
| 43 | set(MCUBOOT_SIGNATURE_KEY_LEN 3072 CACHE STRING "Key length to use for signature validation") |
| 44 | set(MCUBOOT_KEY_S "${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/root-${MCUBOOT_SIGNATURE_TYPE}-${MCUBOOT_SIGNATURE_KEY_LEN}.pem" CACHE FILEPATH "Path to key with which to sign secure binary") |
| 45 | set(MCUBOOT_KEY_NS "${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/root-${MCUBOOT_SIGNATURE_TYPE}-${MCUBOOT_SIGNATURE_KEY_LEN}_1.pem" CACHE FILEPATH "Path to key with which to sign non-secure binary") |
| 46 | |
| 47 | set(MCUBOOT_IMAGE_VERSION_S ${TFM_VERSION} CACHE STRING "Version number of S image") |
| 48 | set(MCUBOOT_IMAGE_VERSION_NS 0.0.0 CACHE STRING "Version number of NS image") |
| 49 | set(MCUBOOT_SECURITY_COUNTER_S "auto" CACHE STRING "Security counter for S image. auto sets it to IMAGE_VERSION_S") |
| 50 | set(MCUBOOT_SECURITY_COUNTER_NS "auto" CACHE STRING "Security counter for NS image. auto sets it to IMAGE_VERSION_NS") |
| 51 | set(MCUBOOT_S_IMAGE_MIN_VER 0.0.0+0 CACHE STRING "Minimum version for upgrade of secure image") |
| 52 | set(MCUBOOT_NS_IMAGE_MIN_VER 0.0.0+0 CACHE STRING "Minimum version for upgrade of non-secure image") |
| 53 | |
| 54 | ############################ Platform ########################################## |
| 55 | |
| 56 | set(TFM_MULTI_CORE_TOPOLOGY OFF CACHE BOOL "Whether to build for a dual-cpu architecture") |
David Hu | 6086394 | 2020-10-14 14:49:19 +0800 | [diff] [blame] | 57 | set(TFM_MULTI_CORE_MULTI_CLIENT_CALL OFF CACHE BOOL "Whether to enable multiple PSA client calls feature") |
| 58 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 59 | set(DEBUG_AUTHENTICATION CHIP_DEFAULT CACHE STRING "Debug authentication setting. [CHIP_DEFAULT, NONE, NS_ONLY, FULL") |
| 60 | set(SECURE_UART1 OFF CACHE BOOL "Enable secure UART1") |
| 61 | |
| 62 | set(CRYPTO_HW_ACCELERATOR OFF CACHE BOOL "Whether to enable the crypto hardware accelerator on supported platforms") |
| 63 | set(CRYPTO_HW_ACCELERATOR_OTP_STATE OFF CACHE STRING "Whether to enable the crypto hardware accelerator OTP memory on supported platforms (Set to PROVISIONING to enable OTP provisioning)") |
| 64 | |
| 65 | set(PLATFORM_DUMMY_ATTEST_HAL TRUE CACHE BOOL "Use dummy attest hal implementation. Should not be used in production.") |
| 66 | set(PLATFORM_DUMMY_NV_COUNTERS TRUE CACHE BOOL "Use dummy nv counter implementation. Should not be used in production.") |
| 67 | set(PLATFORM_DUMMY_CRYPTO_KEYS TRUE CACHE BOOL "Use dummy crypto keys. Should not be used in production.") |
| 68 | set(PLATFORM_DUMMY_ROTPK TRUE CACHE BOOL "Use dummy root of trust public key. Dummy key is the public key for the default keys in bl2. Should not be used in production.") |
| 69 | set(PLATFORM_DUMMY_IAK TRUE CACHE BOOL "Use dummy initial attestation_key. Should not be used in production.") |
| 70 | |
| 71 | ############################ Partitions ######################################## |
| 72 | |
| 73 | set(TFM_PARTITION_PROTECTED_STORAGE ON CACHE BOOL "Enable Protected Storage partition") |
| 74 | set(PS_CREATE_FLASH_LAYOUT ON CACHE BOOL "Create flash fs if it doesn't exist for Protected Storage partition") |
| 75 | set(PS_ENCRYPTION ON CACHE BOOL "Enable encryption for Protected Storage partition") |
| 76 | set(PS_RAM_FS OFF CACHE BOOL "Enable emulated RAM FS for platforms that don't have flash for Protected Storage partition") |
| 77 | set(PS_ROLLBACK_PROTECTION ON CACHE BOOL "Enable rollback protection for Protected Storage partition") |
Jamie Fox | 34a7a23 | 2020-10-20 16:19:09 +0100 | [diff] [blame] | 78 | set(PS_VALIDATE_METADATA_FROM_FLASH ON CACHE BOOL "Validate filesystem metadata every time it is read from flash") |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 79 | set(PS_CRYPTO_AEAD_ALG PSA_ALG_GCM CACHE STRING "The AEAD algorithm to use for authenticated encryption in protected storage") |
| 80 | |
| 81 | set(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE ON CACHE BOOL "Enable Internal Trusted Storage partition") |
| 82 | set(ITS_CREATE_FLASH_LAYOUT ON CACHE BOOL "Create flash fs if it doesn't exist for Interal Trusted Storage partition") |
| 83 | set(ITS_RAM_FS OFF CACHE BOOL "Enable emulated RAM FS for platforms that don't have flash for Interal Trusted Storage partition") |
Jamie Fox | 34a7a23 | 2020-10-20 16:19:09 +0100 | [diff] [blame] | 84 | set(ITS_VALIDATE_METADATA_FROM_FLASH ON CACHE BOOL "Validate filesystem metadata every time it is read from flash") |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 85 | set(ITS_BUF_SIZE "" CACHE STRING "Size of the ITS internal data transfer buffer (defaults to ITS_MAX_ASSET_SIZE if not set)") |
| 86 | |
| 87 | set(TFM_PARTITION_CRYPTO ON CACHE BOOL "Enable Crypto partition") |
Soby Mathew | 4739c73 | 2020-10-07 12:11:05 +0100 | [diff] [blame] | 88 | # CRYPTO_ENGINE_BUF_SIZE needs to be >8KB for EC signing by attest module. |
Summer Qin | e8412b4 | 2020-10-15 14:20:21 +0800 | [diff] [blame] | 89 | set(CRYPTO_ENGINE_BUF_SIZE 0x2080 CACHE STRING "Heap size for the crypto backend") |
Soby Mathew | 4739c73 | 2020-10-07 12:11:05 +0100 | [diff] [blame] | 90 | set(CRYPTO_CONC_OPER_NUM 8 CACHE STRING "The max number of concurrent operations that can be active (allocated) at any time in Crypto") |
| 91 | set(CRYPTO_KEY_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto Key module") |
| 92 | set(CRYPTO_AEAD_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto AEAD module") |
| 93 | set(CRYPTO_MAC_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto MAC module") |
| 94 | set(CRYPTO_HASH_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto Hash module") |
| 95 | set(CRYPTO_CIPHER_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto Cipher module") |
| 96 | set(CRYPTO_GENERATOR_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto Key Derivation module") |
| 97 | set(CRYPTO_ASYMMETRIC_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto Asymmetric key module") |
| 98 | set(CRYPTO_IOVEC_BUFFER_SIZE 5120 CACHE STRING "Default size of the internal scratch buffer used for PSA FF IOVec allocations") |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 99 | |
| 100 | set(TFM_PARTITION_INITIAL_ATTESTATION ON CACHE BOOL "Enable Initial Attestation partition") |
| 101 | set(SYMMETRIC_INITIAL_ATTESTATION OFF CACHE BOOL "Use symmetric crypto for inital attestation") |
| 102 | set(ATTEST_INCLUDE_OPTIONAL_CLAIMS ON CACHE BOOL "Include optional claims in initial attestation token") |
| 103 | set(ATTEST_INCLUDE_COSE_KEY_ID OFF CACHE BOOL "Include COSE key-id in initial attestation token") |
| 104 | |
| 105 | set(TFM_PARTITION_PLATFORM ON CACHE BOOL "Enable Platform partition") |
| 106 | |
| 107 | set(TFM_PARTITION_AUDIT_LOG ON CACHE BOOL "Enable Audit Log partition") |
| 108 | |
| 109 | ################################## Tests ####################################### |
| 110 | |
Raef Coles | abe4f2c | 2020-10-02 10:32:35 +0100 | [diff] [blame] | 111 | set(TFM_INTERACTIVE_TEST OFF CACHE BOOL "Enable interactive tests") |
Raef Coles | c342d5c | 2020-10-12 10:08:38 +0100 | [diff] [blame] | 112 | set(TFM_IRQ_TEST OFF CACHE BOOL "Enable IRQ tests") |
| 113 | set(TFM_PERIPH_ACCESS_TEST OFF CACHE BOOL "Enable peripheral access tests") |
Raef Coles | abe4f2c | 2020-10-02 10:32:35 +0100 | [diff] [blame] | 114 | |
Jamie Fox | 8701484 | 2020-10-22 23:28:10 +0100 | [diff] [blame^] | 115 | set(PS_TEST_NV_COUNTERS OFF CACHE BOOL "Use the test NV counters to test Protected Storage rollback scenarios") |
| 116 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 117 | set(TFM_CRYPTO_TEST_ALG_CBC ON CACHE BOOL "Test CBC cryptography mode") |
| 118 | set(TFM_CRYPTO_TEST_ALG_CCM ON CACHE BOOL "Test CCM cryptography mode") |
| 119 | set(TFM_CRYPTO_TEST_ALG_CFB ON CACHE BOOL "Test CFB cryptography mode") |
| 120 | set(TFM_CRYPTO_TEST_ALG_CTR ON CACHE BOOL "Test CTR cryptography mode") |
| 121 | set(TFM_CRYPTO_TEST_ALG_GCM ON CACHE BOOL "Test GCM cryptography mode") |
| 122 | set(TFM_CRYPTO_TEST_ALG_SHA_512 ON CACHE BOOL "Test SHA-512 cryptography algorithm") |
| 123 | set(TFM_CRYPTO_TEST_HKDF ON CACHE BOOL "Test SHA-512 cryptography algorithm") |
| 124 | |
| 125 | ################################## Dependencies ################################ |
| 126 | |
| 127 | set(MBEDCRYPTO_PATH "DOWNLOAD" CACHE PATH "Path to Mbed Crypto (or DOWNLOAD to fetch automatically") |
Summer Qin | e8412b4 | 2020-10-15 14:20:21 +0800 | [diff] [blame] | 128 | set(MBEDCRYPTO_VERSION "mbedtls-2.24.0" CACHE STRING "The version of Mbed Crypto to use") |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 129 | set(MBEDCRYPTO_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Build type of Mbed Crypto library") |
| 130 | set(TFM_MBEDCRYPTO_CONFIG_PATH "${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto/mbedcrypto_config/tfm_mbedcrypto_config_default.h" CACHE PATH "Config to use for Mbed Crypto") |
| 131 | set(TFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH "" CACHE PATH "Config to append to standard Mbed Crypto config, used by platforms to cnfigure feature support") |
| 132 | |
| 133 | set(TFM_TEST_REPO_PATH "DOWNLOAD" CACHE PATH "Path to TFM-TEST repo (or DOWNLOAD to fetch automatically") |
Raef Coles | 9c2ce9b | 2020-10-22 13:07:12 +0100 | [diff] [blame] | 134 | set(TFM_TEST_REPO_VERSION "master" CACHE PATH "The version of tf-m-tests to use") |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 135 | set(CMSIS_5_PATH "DOWNLOAD" CACHE PATH "Path to CMSIS_5 (or DOWNLOAD to fetch automatically") |
| 136 | |
| 137 | set(MCUBOOT_PATH "DOWNLOAD" CACHE PATH "Path to MCUboot (or DOWNLOAD to fetch automatically") |
Tamas Ban | ad442ad | 2020-11-02 08:27:50 +0000 | [diff] [blame] | 138 | set(MCUBOOT_VERSION "1.7.0-rc1" CACHE STRING "The version of MCUboot to use") |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 139 | |
| 140 | set(PSA_ARCH_TESTS_PATH "DOWNLOAD" CACHE PATH "Path to PSA arch tests (or DOWNLOAD to fetch automatically") |
| 141 | set(PSA_ARCH_TESTS_VERSION "master" CACHE STRING "The version of PSA arch tests to use") |