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

Provisioning process

Provisioning process

The product provisioning to activate and configure STiRoT is done following the three steps below when executing provisioning.bat:

  1. Configuration of the STiRoT. At this stage, the number of images managed (firmware image only, or firmware and data images), the location of the images, and the cryptographic keys are defined.
  2. Generation of the image(s).
  3. Programming of the option bytes, OBKeys, and image(s) in the device.
Note:

A set of scripts is provided in the STM32CubeH5 FW package (Firmware/Projects/Board/ROT_Provisioning/STiRoT folder). It guides the user all along the provisioning process. Refer to AN6007_generalinformation.html#id_62441__entry_ltl_1gh_lmb for more information.

Figure 6. STiRoT provisioning process


OBKeys configuration file

STiRoT OBKeys configuration file (STiRoT_Config.obk) is generated using STM32 Trusted Package Creator with a template file listing all the different parameters (STiRoT_Config.xml) as input.

STiRoT configuration provides the possibility to:

  • Define the user flash memory mapping: select the location and the size of each area.
  • Configure the authentication and encryption keys.
  • Activate the optional management of a data image.
  • Allow the jump in the bootloader (external access) when no valid image is installed.

Some parameters are considered as advanced configuration, and are therefore hidden when the STiRoT configuration is displayed by STM32 Trusted Package Creator. If required, the <Hidden> </Hidden> property can be switched from 1 to 0 in the STiRoT_Config.xml file.

The list of all the parameters is the following:

Table 8. STiRoT Configuration

ParameterHiddenDescriptionAdditional controls/constraints
Number of images managed by STiRoTNo
  • 1: Firmware image only. Configuration selected for any application which does not manage secret information.
  • 2: Firmware and data images. As example, in the two boot stages use case, the data image contains the cryptographic keys managed by uRoT application.
Slot definition of data image (size and offset) will be available trough STM32 Trusted Package Creator as soon as two images configuration is selected.
High speed clock activationYes
  • 0: 64 MHz, initial clock configuration

  • 1: 200 MHz (default value), best speed clock supporting the full range of temperature

  • 2: 250 MHz, max speed clock

-
Is the firmware full secureNo
  • Yes: The firmware booting is fully secure. Refer to the example STiRoT_Appli provided in STM32H5 series Cube.

  • No: The firmware booting is made of a secure part and a nonsecure part. Refer to the example STiRoT_Appli_TrustZone provided in STM32H5 series Cube.

The size of the secure area inside the firmware execution area must be specified as soon as the firmware is not fully secure. In this configuration, the image generation triggered by the post build command of the nonsecure project is preceded by an assembly command of the secure and nonsecure binaries.
Jump into ST bootloaderYes
  • Yes (default value): STiRoT jump into the ST bootloader when no valid firmware image is installed.

  • No: Jump into the ST bootloader is not allowed.

When a jump is not allowed, a reset in loop is generated when no valid firmware image is installed.
Firmware execution area offsetNo

The offset is from the beginning of the user flash memory.

It must be aligned on a sector start address.

No overlap is allowed between the execution areas and the download areas.

A firmware execution area cannot be mapped between the two download areas.

Firmware download area offsetNo

The offset is from the beginning of the user flash memory.

It must be aligned on a sector start address.

No overlap is allowed between the execution areas and the download areas.

A firmware execution area cannot be mapped between the two download areas.

Both firmware and data download areas can overlap. In this case, the installation of a data and firmware image in a single execution using the dependency feature is not possible.

Firmware area sizeNo

Must be a multiple of the sector size.

No overlap is allowed between the execution areas and the download areas.

A firmware execution area cannot be mapped between the two download areas.

Data area offset in HDPL2 OBKeysNoThe offset is from the beginning of the HDPL2 OBKeys area (0xFFD0900).
  • The range allowed is from 0xFFD0900 to 0xFFD0BF0: there is no overlap with the HDPL3 OBKeys.

  • This parameter is disabled for the "one image configuration".

Data slot size in HDPL2 OBKeysNoThe maximum is 0x2F0.
  • The range allowed is from 0xFFD0900 to 0xFFD0BF0: there is no overlap with HDPL3 OBKeys.

  • This parameter is disabled for the "one image configuration".

Data download area offsetNo

The offset is from the beginning of the user flash memory.

It must be aligned on a sector start address.

Both firmware and data download areas can overlap. In this case, the installation of a data and firmware image in a single execution using the dependency feature is not possible.
Data download slot sizeYesMust be a multiple of the sector size.Must be 0x2000 for STM32H5 series product (parameter hidden).
Size of the secure area inside the firmware execution areaNo

Must be a multiple of the sector size.

This parameter is disabled for the "firmware fully secure" configuration.

STiRoT configures the MPU to allow execution only for the secure part of the firmware. Then, it is up to the secure application to reconfigure the MPU depending on its needs.

SRAM2 erasing in case of resetYes

Must be yes: the SRAM2 is automatically erased by hardware in case of reset. It ensure that all secrets are erased in case of reset.

This information is duplicated to ensure that the option bytes are correctly configured.
SRAM2 ECC management activationYes
  • Yes (default value): a reset is generated in case of ECC detection. ECC is a mechanism to detect memory tampering.

  • No: ECC is not managed when SRAM tampering detection is not required.

This information is duplicated to ensure that the option bytes are correctly configured.

Product state minimal allowed

No

Open, Provisioning, Provisioned, TZ-Closed, Closed, Locked: STiRoT only execute the firmware if the product state programmed in the option byte is equal or greater than the “product state minimal allowed”.

If the user plans to use partial regression, then they must set the product state minimal to TZ-Closed (at maximum).

Encryption key

No

The key used to encrypt the firmware and data images.

When this key is regenerated, both firmware and data images must be regenerated with the STM32 Trusted Package Creator “Image Gen” tab (STiRoT_Code_Image.xml and STiRoT_Data_Image.xml)

Authentication key

No

The key used to authenticate the firmware and data images.

When this key is regenerated, both firmware and data images must be regenerated with the STM32 Trusted Package Creator “Image Gen” tab (STiRoT_Code_Image.xml and STiRoT_Data_Image.xml)

Internal tamper 9 and 15 activation.(1)Yes

Yes (default value): Internal tamper 9 and 15 are activated during STiRoT execution.

No: Internal tampers 9 and 15 are deactivated during STiRoT execution.

-

A detailed presentation of the format of STiRoT_Config.obk file is provided in STiRoT Config.obk file format.

1 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.

Images generation

STiRoT manages images at MCUboot format including:

  • A header,
  • The encrypted firmware or data binary,
  • Metadata informations (TLV format: Tags Length Value) allowing the control of the image (SHA256, encryption key…),
  • A magic number to trigger the installation.

Further information about the MCUboot open source software is available at AN6007_generalinformation.html#id_62441__p_lrv_tvx_pyb.

STM32 Trusted Package Creator is provided to generate both firmware and data images. These images are encrypted and signed using the keys configured in the OBKeys configuration file.

Two types of images are generated:

  • Initial image: Image in clear to be programmed in execution area during initial device programming,

  • Update image: Encrypted image to be programmed in download area. It is installed during secure firmware update process.

Initial firmware image generation

STiRoT_Code_Init_Image.xml contains all the parameters driving the image generation such as:

  • The authentication keys.
  • The version.

STiRoT_Code_Init_Image.xml can be edited with STM32 Trusted Package Creator in order to modify the version information. The keys are directly inherited from the STiRoT_Config.xml file.

The following figure shows the firmware image generation:

Figure 7. Firmware init image generation


The list of all parameters is detailed in the appendix Code init image XML file.