David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 1 | ######################################## |
| 2 | Trusted Firmware-M Profile Medium Design |
| 3 | ######################################## |
| 4 | |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 5 | ************ |
| 6 | Introduction |
| 7 | ************ |
| 8 | |
| 9 | Compared with Profile Small, Profile Medium aims to securely connect devices to |
| 10 | Cloud services with asymmetric cipher support. |
| 11 | Profile Medium target devices need more resources for more cipher algorithms |
| 12 | and higher isolation levels. |
| 13 | |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 14 | ************** |
| 15 | Overall design |
| 16 | ************** |
| 17 | |
| 18 | TF-M Profile Medium defines the following feature set: |
| 19 | |
| 20 | - Firmware Framework |
| 21 | |
| 22 | - Inter-Process Communication (IPC) model [PSA-FF-M]_ |
| 23 | - Isolation level 2 [PSA-FF-M]_ |
| 24 | |
| 25 | - Internal Trusted Storage (ITS) |
| 26 | |
| 27 | - Crypto |
| 28 | |
David Hu | f40be93 | 2021-05-12 15:52:16 +0800 | [diff] [blame] | 29 | - Support both symmetric cryptography and asymmetric cryptography |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 30 | - Asymmetric key based cipher suite suggested in TLS/DTLS profiles for |
| 31 | IoT [RFC7925]_ and CoAP [RFC7252]_, including |
| 32 | |
| 33 | - Authenticated Encryption with Associated Data (AEAD) algorithm |
| 34 | - Asymmetric key algorithm based signature and verification |
| 35 | - Public-key cryptography based key exchange |
| 36 | - Hash function |
| 37 | - HMAC for default Pseudorandom Function (PRF) |
| 38 | |
| 39 | - Asymmetric digital signature and verification for Initial Attestation |
| 40 | Token (IAT) |
| 41 | |
| 42 | - Initial Attestation |
| 43 | |
| 44 | - Asymmetric key algorithm based Initial Attestation |
| 45 | |
| 46 | - Lightweight boot |
| 47 | |
| 48 | - Anti-rollback protection |
| 49 | - Multiple image boot |
| 50 | |
| 51 | - Protected Storage (PS) if off-chip storage device is integrated |
| 52 | |
| 53 | - Data confidentiality |
| 54 | - Data integrity |
| 55 | - Rollback protection |
| 56 | |
| 57 | ************** |
| 58 | Design details |
| 59 | ************** |
| 60 | |
| 61 | More details of TF-M Profile Medium design are described in following sections. |
| 62 | |
| 63 | Firmware framework |
| 64 | ================== |
| 65 | |
| 66 | Profile Medium with IPC model and isolation level 2 aims to support usage |
| 67 | scenarios which require more complicated secure service model and additional |
| 68 | protection to PSA RoT. |
| 69 | |
| 70 | Level 2 isolation |
| 71 | ----------------- |
| 72 | |
| 73 | Profile Medium selects isolation level 2 by default. In addition to isolation |
| 74 | level 1, the PSA Root of Trust (PSA RoT) is also protected from access by the |
| 75 | Application Root of Trust (App RoT) in level 2 isolation. |
| 76 | |
| 77 | IPC model |
| 78 | --------- |
| 79 | |
| 80 | Profile Medium enables IPC model by default. IPC model can achieve a more |
| 81 | flexible framework and higher levels of isolation, but may require more memory |
Summer Qin | 2db78c8 | 2022-10-10 17:17:44 +0800 | [diff] [blame] | 82 | footprint and bring in longer latency, compared to SFN model. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 83 | |
| 84 | TF-M IPC model implementation follows the PSA Firmware Framework for M |
| 85 | (PSA-FF-M) [PSA-FF-M]_. |
| 86 | |
| 87 | Crypto service |
| 88 | ============== |
| 89 | |
David Hu | f40be93 | 2021-05-12 15:52:16 +0800 | [diff] [blame] | 90 | Compared to Profile Small, Profile Medium includes asymmetric cryptography to |
| 91 | support direct connection to Cloud services via common protocols, such as |
| 92 | TLS/DTLS 1.2. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 93 | |
| 94 | As suggested in CoAP [RFC7252]_ and [RFC7925]_, TF-M Profile Medium by default |
| 95 | selects ``TLS_ECDHE_ECDSA_WITH_AES_128_CCM`` as reference, which requires: |
| 96 | |
| 97 | - ECDHE_ECDSA as key exchange algorithm. |
| 98 | - AES-128-CCM (AES CCM mode with 128-bit key) as AEAD algorithm. |
| 99 | Platforms can implement AES-128-CCM with truncated authentication tag to |
| 100 | achieve less network bandwidth [RFC7925]_. |
| 101 | - SHA256 as Hash function. |
| 102 | - HMAC as Message Authentication Code algorithm. |
| 103 | |
| 104 | Applications can also support TLS PSK [RFC4279]_ cipher suites, such as |
| 105 | ``TLS_PSK_WITH_AES_128_CCM`` [RFC7925]_. |
| 106 | |
| 107 | .. note :: |
| 108 | |
| 109 | **Implementation note** |
| 110 | |
| 111 | Developers can replace default algorithms with others or implement more |
| 112 | algorithms according to actual usage scenarios and device capabilities. |
| 113 | |
| 114 | If a Crypto hardware accelerator is integrated, the cipher suites and |
| 115 | algorithms also depend on those accelerator features. |
| 116 | |
| 117 | More details of cipher suite are described below. |
| 118 | |
| 119 | Digital signature and verification |
| 120 | ---------------------------------- |
| 121 | |
| 122 | ECDSA is selected by default in Profile Medium. |
| 123 | ECDSA requires much shorter keys compared with RSA at the same security level. |
| 124 | Therefore, ECDSA can cost less storage area for assets and less network |
| 125 | bandwidth to setup a TLS connection. |
| 126 | ECDSA is also preferred for forward compatibility of future TLS versions. |
| 127 | |
| 128 | As requested in [RFC7251]_, ECC curve ``secp256r1`` should be supported. More |
| 129 | ECC curves can be added based on the requirements in production. |
| 130 | |
| 131 | If usage scenarios require RSA algorithm for backward compatibility and legacy |
| 132 | applications, platforms can add RSA support or replace ECDSA with RSA. The |
| 133 | cipher suite should be switched accordingly. |
| 134 | |
| 135 | AEAD algorithm |
| 136 | -------------- |
| 137 | |
| 138 | If Protected Storage (PS) is implemented, it is recommended to select the same |
| 139 | AEAD algorithm for PS service as the one used by TLS/DTLS cipher suite. |
| 140 | |
| 141 | Internal Trusted Storage |
| 142 | ======================== |
| 143 | |
| 144 | The configuration of ITS is the same as those in Profile Small [PROFILE-S]_. |
| 145 | |
| 146 | Lightweight boot |
| 147 | ================ |
| 148 | |
| 149 | BL2 implementation can be device specific. Devices may implement diverse |
| 150 | boot processes with different features and configurations. |
| 151 | However, the boot loader must support anti-rollback protection. Boot loader must |
| 152 | be able to prevent unauthorized rollback, to protect devices from being |
| 153 | downgraded to earlier versions with known vulnerabilities. |
| 154 | |
| 155 | MCUBoot in TF-M is configured as multiple image boot by default in Profile |
| 156 | Medium. In multiple image boot, secure and non-secure images can be signed |
| 157 | independently with different keys and they can be updated separately. It can |
| 158 | support multiple vendors scenarios, in which non-secure and secure images are |
| 159 | generated and updated by different vendors. |
| 160 | Multiple image boot may require more storage area compared with single image |
| 161 | boot. |
| 162 | |
| 163 | Protected Storage |
| 164 | ================= |
| 165 | |
| 166 | PS service is required if an off-chip storage device is integrated and used on |
| 167 | the platform. |
| 168 | |
| 169 | TF-M PS service relies on an AEAD algorithm to ensure data confidentiality and |
| 170 | integrity. It is recommended to select the same AEAD algorithm as the one used |
| 171 | for TLS/DTLS cipher suite. |
| 172 | |
| 173 | Anti-rollback protection in PS relies on non-volatile counter(s) provided by |
| 174 | TF-M Platform Secure Partition (SP). |
| 175 | |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 176 | ************** |
| 177 | Implementation |
| 178 | ************** |
| 179 | |
| 180 | Overview |
| 181 | ======== |
| 182 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 183 | The basic idea is to add dedicated profile CMake configuration files under |
| 184 | folder ``config/profile`` for TF-M Profile Medium default configuration, the |
| 185 | same as Profile Small does. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 186 | |
| 187 | The top-level Profile Medium config file collects all the necessary |
| 188 | configuration flags and set them to default values, to explicitly enable the |
| 189 | features required in Profile Medium and disable the unnecessary ones, during |
| 190 | TF-M build. |
| 191 | |
| 192 | A platform/use case can provide a configuration extension file to overwrite |
| 193 | Profile Medium default setting and append other configurations. |
| 194 | This configuration extension file can be added via parameter |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 195 | ``TFM_EXTRA_CONFIG_PATH`` in build command line. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 196 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 197 | The behaviour of the Profile Medium build flow (particularly the order of |
| 198 | configuration loading and overriding) can be found at |
| 199 | :ref:`tfm_cmake_configuration` |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 200 | |
| 201 | The details of configurations will be covered in each module in |
| 202 | `Implementation details`_. |
| 203 | |
| 204 | Implementation details |
| 205 | ====================== |
| 206 | |
| 207 | This section discusses the details of Profile Medium implementation. |
| 208 | |
| 209 | Top-level configuration files |
| 210 | ----------------------------- |
| 211 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 212 | The firmware framework configurations in ``config/profile/profile_medium`` are |
| 213 | shown below. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 214 | |
| 215 | .. table:: Config flags in Profile Medium top-level CMake config file |
| 216 | :widths: auto |
| 217 | :align: center |
| 218 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 219 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
| 220 | | Configs | Default value | Descriptions | |
| 221 | +============================================+=====================================================================================================+=====================================+ |
| 222 | | ``TFM_ISOLATION_LEVEL`` | ``2`` | Select level 2 isolation | |
| 223 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 224 | | ``TFM_PARTITION_INTERNAL_TRUSTED_STORAGE`` | ``ON`` | Enable ITS SP | |
| 225 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
| 226 | | ``ITS_BUF_SIZE`` | ``32`` | ITS internal transient buffer size | |
| 227 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
| 228 | | ``TFM_PARTITION_CRYPTO`` | ``ON`` | Enable Crypto service | |
| 229 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 230 | | ``CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED`` | ``OFF`` | Enable Crypto asymmetric | |
David Hu | f40be93 | 2021-05-12 15:52:16 +0800 | [diff] [blame] | 231 | | | | encryption operations | |
| 232 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 233 | | ``TFM_MBEDCRYPTO_CONFIG_PATH`` | ``${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto/mbedcrypto_config/tfm_mbedcrypto_config_profile_medium.h`` | Mbed Crypto config file path | |
| 234 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
Summer Qin | b898d81 | 2022-06-08 15:01:35 +0800 | [diff] [blame] | 235 | | ``TFM_MBEDCRYPTO_PSA_CRYPTO_CONFIG_PATH`` | ``${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto/mbedcrypto_config/crypto_config_profile_medium.h`` | Mbed Crypto PSA config file path | |
| 236 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 237 | | ``TFM_PARTITION_INITIAL_ATTESTATION`` | ``ON`` | Enable Initial Attestation service | |
| 238 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
| 239 | | ``TFM_PARTITION_PROTECTED_STORAGE`` [1]_ | ``ON`` | Enable PS service | |
| 240 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
| 241 | | ``TFM_PARTITION_PLATFORM`` | ``ON`` | Enable TF-M Platform SP | |
| 242 | +--------------------------------------------+-----------------------------------------------------------------------------------------------------+-------------------------------------+ |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 243 | |
| 244 | .. [1] PS service is enabled by default. Platforms without off-chip storage |
| 245 | devices can turn off ``TFM_PARTITION_PROTECTED_STORAGE`` to disable PS |
| 246 | service. See `Protected Storage Secure Partition`_ for details. |
| 247 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 248 | .. Note:: |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 249 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 250 | Where a configuration is the same as the default in |
Anton Komlev | 1dfd209 | 2022-10-25 17:50:09 +0100 | [diff] [blame] | 251 | ``config/config_base.cmake``, it is omitted from the profile configuration |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 252 | file. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 253 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 254 | Test configuration |
| 255 | ^^^^^^^^^^^^^^^^^^ |
| 256 | |
| 257 | Standard regression test configuration applies. This means that enabling |
| 258 | regression testing via |
| 259 | |
| 260 | ``-DTEST_S=ON -DTEST_NS=ON`` |
| 261 | |
| 262 | Will enable testing for all enabled partitions. See above for details of enabled |
Ken Liu | 45dd87c | 2022-09-21 17:40:01 +0800 | [diff] [blame] | 263 | partitions. Because Profile Medium enables IPC model, the IPC tests are also |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 264 | enabled. |
| 265 | |
| 266 | Some cryptography tests are disabled due to the reduced Mbed Crypto config. |
| 267 | |
| 268 | .. table:: TFM options in Profile Medium top-level CMake config file |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 269 | :widths: auto |
| 270 | :align: center |
| 271 | |
Summer Qin | b898d81 | 2022-06-08 15:01:35 +0800 | [diff] [blame] | 272 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 273 | | Configs | Default value | Descriptions | |
| 274 | +============================================+===============+===============================================+ |
| 275 | | ``TFM_CRYPTO_TEST_ALG_CBC`` | ``OFF`` | Disable CBC mode test | |
| 276 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 277 | | ``TFM_CRYPTO_TEST_ALG_CCM`` | ``ON`` | Enable CCM mode test | |
| 278 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 279 | | ``TFM_CRYPTO_TEST_ALG_CFB`` | ``OFF`` | Disable CFB mode test | |
| 280 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 281 | | ``TFM_CRYPTO_TEST_ALG_ECB`` | ``OFF`` | Disable ECB mode test | |
| 282 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 283 | | ``TFM_CRYPTO_TEST_ALG_CTR`` | ``OFF`` | Disable CTR mode test | |
| 284 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 285 | | ``TFM_CRYPTO_TEST_ALG_OFB`` | ``OFF`` | Disable OFB mode test | |
| 286 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 287 | | ``TFM_CRYPTO_TEST_ALG_GCM`` | ``OFF`` | Disable GCM mode test | |
| 288 | +--------------------------------------------+---------------+-----------------------------------------------+ |
Summer Qin | 32e41f5 | 2022-06-08 15:37:13 +0800 | [diff] [blame] | 289 | | ``TFM_CRYPTO_TEST_ALG_SHA_384`` | ``OFF`` | Disable SHA-384 algorithm test | |
| 290 | +--------------------------------------------+---------------+-----------------------------------------------+ |
Summer Qin | b898d81 | 2022-06-08 15:01:35 +0800 | [diff] [blame] | 291 | | ``TFM_CRYPTO_TEST_ALG_SHA_512`` | ``OFF`` | Disable SHA-512 algorithm test | |
| 292 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 293 | | ``TFM_CRYPTO_TEST_HKDF`` | ``OFF`` | Disable HKDF algorithm test | |
| 294 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 295 | | ``TFM_CRYPTO_TEST_ECDH`` | ``ON`` | Enable ECDH key agreement test | |
| 296 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 297 | | ``TFM_CRYPTO_TEST_CHACHA20`` | ``OFF`` | Disable ChaCha20 stream cipher test | |
| 298 | +--------------------------------------------+---------------+-----------------------------------------------+ |
| 299 | | ``TFM_CRYPTO_TEST_CHACHA20_POLY1305`` | ``OFF`` | Disable ChaCha20-Poly1305 AEAD algorithm test | |
| 300 | +--------------------------------------------+---------------+-----------------------------------------------+ |
David Hu | e69294d | 2022-06-21 22:21:37 +0800 | [diff] [blame] | 301 | | ``TFM_CRYPTO_TEST_SINGLE_PART_FUNCS`` | ``OFF`` | Test single-part operations in hash, MAC, | |
| 302 | | | | AEAD and symmetric ciphers | |
| 303 | +--------------------------------------------+---------------+-----------------------------------------------+ |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 304 | |
| 305 | Device configuration extension |
| 306 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 307 | |
| 308 | To change default configurations and add platform specific configurations, |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 309 | a platform can add a platform configuration file at |
| 310 | ``platform/ext<TFM_PLATFORM>/config.cmake`` |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 311 | |
| 312 | Crypto service configurations |
| 313 | ----------------------------- |
| 314 | |
| 315 | Crypto Secure Partition |
| 316 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 317 | |
David Hu | f40be93 | 2021-05-12 15:52:16 +0800 | [diff] [blame] | 318 | TF-M Profile Medium enables Crypto SP in top-level CMake config file. |
| 319 | The following PSA Crypto operationts are enabled by default. |
| 320 | |
| 321 | - Hash operations |
| 322 | - Message authentication codes |
| 323 | - Symmetric ciphers |
| 324 | - AEAD operations |
| 325 | - Asymmetric key algorithm based signature and verification |
| 326 | - Key derivation |
| 327 | - Key management |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 328 | |
| 329 | Mbed Crypto configurations |
| 330 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 331 | |
| 332 | TF-M Profile Medium adds a dedicated Mbed Crypto config file |
Summer Qin | b898d81 | 2022-06-08 15:01:35 +0800 | [diff] [blame] | 333 | ``tfm_mbedcrypto_config_profile_medium.h`` and Mbed Crypto PSA config file |
| 334 | ``crypto_config_profile_medium.h`` at ``/lib/ext/mbedcrypto/mbedcrypto_config`` |
| 335 | folder, instead of the common one ``tfm_mbedcrypto_config_default.h`` and |
| 336 | ``crypto_config_default.h`` [CRYPTO-DESIGN]_. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 337 | |
| 338 | Major Mbed Crypto configurations are set as listed below: |
| 339 | |
| 340 | - Enable SHA256 |
| 341 | - Enable generic message digest wrappers |
| 342 | - Enable AES |
| 343 | - Enable CCM mode for symmetric ciphers |
| 344 | - Disable other modes for symmetric ciphers |
| 345 | - Enable ECDH |
| 346 | - Enable ECDSA |
| 347 | - Select ECC curve ``secp256r1`` |
| 348 | - Other configurations required by selected option above |
| 349 | |
| 350 | Other configurations can be selected to optimize the memory footprint of Crypto |
| 351 | module. |
| 352 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 353 | A device/use case can append an extra config header to the Profile Medium |
| 354 | default Mbed Crypto config file. This can be done by setting the |
| 355 | ``TFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH`` cmake variable in the platform |
| 356 | config file ``platform/ext<TFM_PLATFORM>/config.cmake``. This cmake variable is |
| 357 | a wrapper around the ``MBEDTLS_USER_CONFIG_FILE`` options, but is preferred as |
| 358 | it keeps all configuration in cmake. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 359 | |
| 360 | Internal Trusted Storage configurations |
| 361 | --------------------------------------- |
| 362 | |
| 363 | ITS service is enabled in top-level Profile Medium CMake config file by default. |
| 364 | |
| 365 | The internal transient buffer size ``ITS_BUF_SIZE`` [ITS-INTEGRATE]_ is set to |
| 366 | 32 bytes by default. A platform/use case can overwrite the buffer size in its |
| 367 | specific configuration extension according to its actual requirement of assets |
| 368 | and Flash attributes. |
| 369 | |
| 370 | Profile Medium CMake config file won't touch the configurations of device |
| 371 | specific Flash hardware attributes [ITS-INTEGRATE]_. |
| 372 | |
| 373 | Protected Storage Secure Partition |
| 374 | ---------------------------------- |
| 375 | |
| 376 | Data confidentiality, integrity and anti-rollback protection are enabled by |
| 377 | default in PS. |
| 378 | |
| 379 | If PS is selected, AES-CCM is used as AEAD algorithm by default. It requires to |
| 380 | enable PS implementation to select diverse AEAD algorithm. |
| 381 | |
| 382 | If platforms don't integrate any off-chip storage device, platforms can disable |
| 383 | PS in platform specific configuration extension file via |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 384 | ``platform/ext<TFM_PLATFORM>/config.cmake``. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 385 | |
| 386 | BL2 setting |
| 387 | ----------- |
| 388 | |
| 389 | Profile Medium enables MCUBoot provided by TF-M by default. A platform can |
| 390 | overwrite this configuration by disabling MCUBoot in its configuration extension |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 391 | file ``platform/ext<TFM_PLATFORM>/config.cmake``. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 392 | |
| 393 | If MCUBoot provided by TF-M is enabled, multiple image boot is selected by |
| 394 | default in TF-M Profile Medium top-level CMake config file. |
| 395 | |
| 396 | If a device implements its own boot loader, the configurations are |
| 397 | implementation defined. |
| 398 | |
| 399 | **************** |
| 400 | Platform support |
| 401 | **************** |
| 402 | |
| 403 | To enable Profile Medium on a platform, the platform specific CMake file should |
| 404 | be added into the platform support list in top-level Profile Medium CMake config |
| 405 | file. |
| 406 | |
| 407 | Building Profile Medium |
| 408 | ======================= |
| 409 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 410 | To build Profile Medium, argument ``TFM_PROFILE`` in build command line should be |
| 411 | set to ``profile_medium``. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 412 | |
| 413 | Take AN521 as an example: |
| 414 | |
| 415 | The following commands build Profile Medium without test cases on **AN521** with |
| 416 | build type **MinSizeRel**, built by **Armclang**. |
| 417 | |
| 418 | .. code-block:: bash |
| 419 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 420 | cd <TFM root dir> |
| 421 | mkdir build && cd build |
Summer Qin | 2de23d0 | 2021-05-14 13:44:14 +0800 | [diff] [blame] | 422 | cmake -DTFM_PLATFORM=arm/mps2/an521 \ |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 423 | -DTFM_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \ |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 424 | -DTFM_PROFILE=profile_medium \ |
| 425 | -DCMAKE_BUILD_TYPE=MinSizeRel \ |
| 426 | ../ |
| 427 | cmake --build ./ -- install |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 428 | |
| 429 | The following commands build Profile Medium with regression test cases on |
| 430 | **AN521** with build type **MinSizeRel**, built by **Armclang**. |
| 431 | |
| 432 | .. code-block:: bash |
| 433 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 434 | cd <TFM root dir> |
| 435 | mkdir build && cd build |
Summer Qin | 2de23d0 | 2021-05-14 13:44:14 +0800 | [diff] [blame] | 436 | cmake -DTFM_PLATFORM=arm/mps2/an521 \ |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 437 | -DTFM_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \ |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 438 | -DTFM_PROFILE=profile_medium \ |
| 439 | -DCMAKE_BUILD_TYPE=MinSizeRel \ |
| 440 | -DTEST_S=ON -DTEST_NS=ON \ |
| 441 | ../ |
| 442 | cmake --build ./ -- install |
| 443 | |
| 444 | .. Note:: |
| 445 | |
| 446 | - For devices with more contrained memory and flash requirements, it is |
| 447 | possible to build with either only TEST_S enabled or only TEST_NS enabled. |
| 448 | This will decrease the size of the test images. Note that both test suites |
| 449 | must still be run to ensure correct operation. |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 450 | |
| 451 | More details of building instructions and parameters can be found TF-M build |
| 452 | instruction guide [TFM-BUILD]_. |
| 453 | |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 454 | ********* |
| 455 | Reference |
| 456 | ********* |
| 457 | |
| 458 | .. [PSA-FF-M] `Arm Platform Security Architecture Firmware Framework 1.0 <https://developer.arm.com/-/media/Files/pdf/PlatformSecurityArchitecture/Architect/DEN0063-PSA_Firmware_Framework-1.0.0-2.pdf?revision=2d1429fa-4b5b-461a-a60e-4ef3d8f7f4b4>`_ |
| 459 | |
| 460 | .. [RFC7925] `Transport Layer Security (TLS) / Datagram Transport Layer Security (DTLS) Profiles for the Internet of Things <https://tools.ietf.org/html/rfc7925>`_ |
| 461 | |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 462 | .. [PROFILE-S] :doc:`Trusted Firmware-M Profile Small Design </configuration/profiles/tfm_profile_small>` |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 463 | |
| 464 | .. [RFC7252] `The Constrained Application Protocol (CoAP) <https://tools.ietf.org/html/rfc7252>`_ |
| 465 | |
| 466 | .. [RFC4279] `Pre-Shared Key Ciphersuites for Transport Layer Security (TLS) <https://tools.ietf.org/html/rfc4279>`_ |
| 467 | |
| 468 | .. [RFC7251] `AES-CCM Elliptic Curve Cryptography (ECC) Cipher Suites for TLS <https://tools.ietf.org/html/rfc7251>`_ |
| 469 | |
Anton Komlev | 3356ba3 | 2022-03-31 22:02:11 +0100 | [diff] [blame] | 470 | .. [CRYPTO-DESIGN] :doc:`Crypto design </technical_references/design_docs/tfm_crypto_design>` |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 471 | |
Anton Komlev | 3356ba3 | 2022-03-31 22:02:11 +0100 | [diff] [blame] | 472 | .. [ITS-INTEGRATE] :doc:`ITS integration guide </integration_guide/services/tfm_its_integration_guide>` |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 473 | |
Anton Komlev | 0dbe8f1 | 2022-06-17 16:48:12 +0100 | [diff] [blame] | 474 | .. [TFM-BUILD] :doc:`TF-M build instruction </building/tfm_build_instruction>` |
David Hu | 5fc31c1 | 2020-05-16 22:36:06 +0800 | [diff] [blame] | 475 | |
| 476 | -------------- |
| 477 | |
Summer Qin | b898d81 | 2022-06-08 15:01:35 +0800 | [diff] [blame] | 478 | *Copyright (c) 2020-2022, Arm Limited. All rights reserved.* |