AN6007 · Application noteGetting started with STiRoT (ST immutable Root of Trust) for STM32H5 MCUs
Download .pdfOpen in the full document

STiRoT presentation

Overview

STiRoT stands for ST immutable (unchangeable) Root of Trust, and acts as the first boot stage. STiRoT targets a SESIP level 3 certified implementation.

STiRoT is embedded in an immutable area of the STM32H5 and provides two services:

  • The Secure Boot (root of trust services) is an immutable code, which is always executed after a system reset (1). It activates runtime protections and then, it verifies the authenticity and integrity of the application (2) code before every execution (3).
    Figure 1. Secure Boot


  • The Secure Firmware Update application is an immutable code that detects that a new firmware image is available. It verifies the image authenticity (1), integrity (2) and finally installs the decrypted firmware (3).
    Figure 2. Secure Firmware Update


The detailed startup sequence is described in STiRoT start-up sequence as well as the most efficient way of working during development phase in Application development phase.

Protection measures and security strategy

Cryptography ensures integrity, authentication, and confidentiality. However, the use of cryptography alone is not enough: a set of hardware and software security measures are supported by the STiRoT for protecting critical operations and sensitive data (such as a secret key). The SESIP level 3 certification is targeted.

The following cryptographic scheme is implemented in STiRoT:

  • ECDSA-P256 asymmetric cryptography for image authentication.

  • AES-CTR-128 symmetric cryptography with key ECIES-P256 encrypted for image confidentiality.

  • SHA256 cryptography for image integrity check.

  • All cryptography operations are hardware-accelerated.

STiRoT activation

On STM32H5, STiRoT activation is done by:

  1. Configuring the BOOT_UBE option byte (refer to AN6007_generalinformation.html#id_62441__p_xgv_1b3_pyb or AN6007_generalinformation.html#id_62441__p_mhd_gz3_c3c for more details) in order to boot on STiRoT.
  2. Defining STiRoT configuration. The main parameters are:
    • Location, size of each area hosting user application code and data images in user flash memory.
    • Authentication and encryption keys used by STiRoT.

    OBKeys configuration file provides details on all configuration parameters.

Both operations are part of the provisioning process.

STiRoT is activated in two different use cases:

  • One boot stage: The STiRoT integrated inside the STM32H5 manages directly the user application.
  • Two boot stages: The STiRoT integrated inside the STM32H5 manages an updatable boot stage (uRoT) located in the user flash memory which manages the user application. The updatable boot stage can be customized to fit customer needs.
Table 5. Boot time performance
ConfigurationBoot time
-256 Kbytes512 Kbytes1 Mbytes
Execution @ 64MHz41,5 ms70 ms128 ms
Execution @ 200MHz18 ms27,5ms46ms
Execution @ 250MHz16ms23,5ms38ms

One boot stage

At reset, STiRoT is executed in temporal isolation 1 (HDPL1). Refer to AN6007_generalinformation.html#id_62441__p_mhd_gz3_c3c or AN6007_generalinformation.html#id_62441__p_xgv_1b3_pyb for more details on temporal isolation levels. After a successful verification of the authenticity and the integrity of the user application code and data images, STiRoT execute the user application in secure mode (HDPL2). In case of verification failure, STiRoT jumps into the bootloader to provide the end user a way to download a new user application code and/or data images if the external access is configured as allowed.

Figure 3. STiRoT behavior in case of verification failure


The user application can be fully secure or divided in a secure and nonsecure application. In both cases, the image stored in the download area is a single image. The secure part of the user application must contain at least the vector table and the reset handler. If this is not the case, the application does not start as STiRoT executed it in secure mode.

The secrets (data) associated to the user application are installed by STiRoT in the protected HDPL2 OBKeys. When no secrets are required by the application, the data image management can be deactivated through STiRoT configuration.

To ensure the security of the device, the MPU is configured to allow only the application code area to be executed when STiRoT jumps into application, minimizing the risk of unauthorized code execution. It is the user application responsibility to reconfigure the secure MPU to fit with its security needs.

The following figure gives an example of the memory mapping when STiRoT is activated in a one boot stage configuration.

Figure 4. STM32H5 - STiRoT - User application executed after STiRoT


An example of one boot stage application is provided with STM32CubeH5 MCU Package.

Note:

When required, this is the user application responsibility to move to HDPL3 and to switch in nonsecure mode.

Two boot stages

The uRoT (updatable Root of Trust) located in the user flash memory act as a second boot stage. At reset, STiRoT is executed in temporal isolation 1, HDPL1. Refer to AN6007_generalinformation.html#id_62441__p_mhd_gz3_c3c or AN6007_generalinformation.html#id_62441__p_xgv_1b3_pyb or more details on temporal isolation levels. After a successful verification of the authenticity and the integrity of uRoT code and data images, STiRoT executes uRoT in HDPL2 and in secure mode. Then, uRoT verify the user application before executing it. In case of verification failure of uRoT code and/or data image, STiRoT jumps into the bootloader to provide the end user a way to download a new uRoT code and/or data images if the external access is configured as allowed. See Figure 3 STiRoT behavior in case of verification failure in case of verification failure.

The uRoT is a fully secure application. The secret keys managed by uRoT and hosted in the data image are installed by STiRoT in the protected HDPL2 OBKeys.

To ensure the security of the device, the MPU is configured to allow only the uRoT code area to be executed when STiRoT jumps into uRoT, minimizing the risk of unauthorized code execution. It is the uRoT responsibility to reconfigure the secure MPU to fit with its security needs. In this case, the security of the user application depends on the uRoT strategy.

Figure 5. STM32H5 - STiRoT - User application executed after uRoT


An example of a two boot stages application is provided with the STM32H5 series MCU Package.

STiRoT constraints

The list of constraints to be taken into account when activating the STiRoT boot path is the following:

  • The independent watchdog (IWDG) peripheral offers a high safety level, thanks to its capability to prevent malfunctions due to software or hardware failures in a disturbed environment. For application requesting such high safety level, it is recommended to activate IWDG via option bytes when using STiRoT and regularly reload the IWDG on the application side.
  • WWDG activation by option byte is not supported by STiRoT. Only IWDG can be activated through option byte.
  • STiRoT does not support potential mode for the tampers. It resets in loop until power-off if tamper event in potential mode occurs during its execution (or during Standby mode or VBAT mode).
  • When a tamper event occurs during STiRoT execution (or Standby mode or VBAT mode), then STiRoT saves the content of the TAMP status register, and write a magic value at the end of backup SRAM. The application can check the presence of this magic value and stored status register in backup SRAM to identify which tamper event(s) occurred, then decides the appropriated action and clears the magic value.
    Note:

    This is applicable from the SFSP version 2.7.0 on STM32H573xx products , the SFSP version 1.3.0 on STM32H533xx products , the SFSP version 1.3.0 on STM32H553xx products, and SFSP version 1.1.0 on STM32H5F5xx products. For previous SFSP version, when a tamper fault occurs, the system resets in loop until a backup domain power-on reset is performed. Refer to document AN6007_generalinformation.html#id_62441__p_gf1_hls_3hc to get all the information about SFSP version tracking.

  • Internal tamper 9 (fault generation for cryptographic peripherals (SAES, PKA, AES, RNG) and internal tamper 15 (system fault detection) are activated by default during STiRoT execution and remains activated when jumping into the user application. The usage of these tampers in STiRoT can be deactivated through STiRoT OBKeys configuration (see OBKeys configuration file).
    Note:

    This is applicable from the SFSP version 2.7.0 on STM32H573xx products , the SFSP version 1.3.0 on STM32H533xx products , the SFSP version 1.3.0 on STM32H553xx products, and SFSP version 1.1.0 on STM32H5F5xx products. For previous SFSP version, when a tamper fault occurs, the system resets in loop until a backup domain power-on reset is performed. Refer to document AN6007_generalinformation.html#id_62441__p_gf1_hls_3hc to get all the information about SFSP version tracking.

  • MPU is configured to only allow the user application code area to be executed when STiRoT jumps into the user application. It is the user application responsibility to reconfigure the MPU to fit with its security needs.
  • SRAM2 is used by STiRoT and is therefore erased at each reset.
  • SWAP_BANK activation by option byte is not supported by STiRoT.
Table 6. STM32H5F5xx and STM32H573xx backup SRAM mapping
Backup SRAM mappingSize (bytes)Description
0x5003 73FC0x4Tamper status register copy (indicates which tamper(s) have occurred)
0x5003 73F80x4Magic value (if a tamper fault occurred, it equals 0x003981BB)
Table 7. STM32H553xx and STM32H533xx backup SRAM mapping
Backup SRAM mappingSize (bytes)Description
0x5003 6BFC0x4Tamper status register copy (indicates which tamper(s) have occurred)
0x5003 6BF80x4Magic value (if a tamper fault occurred, it equals 0x003981BB)