3. System security

The STM32H5 devices are designed with a comprehensive set of security features, some of them based on the standard Arm TrustZone® technology.

These security features simplify the process of evaluating IoT devices against security standards. They also significantly reduce the cost and complexity of software development for OEM and third-party developers, by facilitating the reuse, improving the interoperability, and minimizing the API fragmentation.

This section explains the different security features available on the devices.

3.1 Key security features

3.2 Secure install

The secure firmware install (SFI) is an immutable secure service embedded by STMicroelectronics in the devices. The SFI allows secure and counted installation of OEM firmware in an untrusted production environment (such as the OEM contract manufacturer).

The confidentiality of the installed images written in the internal flash memory or encrypted in an external flash memory, is also protected, using the AES.

The SFI native service leverages the following hardware security features:

Further information can be found in AN4992 “Introduction to secure firmware install (SFI) for STM32 MCUs”.

3.3 Secure boot

Secure boot is an immutable code that is always executed after a system reset. As a root of trust, this code checks the device static protections and activates available device runtime protections, reducing the risk of invalid or malicious code running on the platform. As root of trust, the secure boot also checks the integrity and authenticity of the next level firmware before executing it.

The device offers two options (using BOOT_UBE) to execute the immutable code after a reset:

The actual functions of the secure boot depend on the availability of TrustZone features, and on the firmware stored in the device. The secure boot typically initializes the secure storage, and installs on-the-fly decryption keys in the OTFDEC, to be able to use encrypted firmware stored in an external flash memory.

TrustZone application, supported by the STM32 ecosystem, provides a root of trust solution, including secure boot functions.

In the devices, the secure boot benefits of hardware security features:

This section describes the features specifically designed for the secure boot.

3.3.1 Unique boot entry

Thanks to the unique boot entry (BOOT_UBE), it is possible to select the boot entry point between security services in the system flash (ST-iROT) and the proprietary boot entry (OEM-iROT). This selection is possible only for products embedding cryptographic acceleration (STM32H5Fxxx), when TrustZone is enabled (TZEN = 0xB4).

When TrustZone is enabled and the SECBOOT_LOCK secure option bit is cleared, the application selects a boot entry point located either in the system flash memory (see the next section), or in the secure user flash memory, at the address defined by the SECBOOTADD option bytes.

When TrustZone is enabled and the SECBOOT_LOCK secure option bit is set, the device unique boot entry is the unmodifiable secure address defined by the SECBOOTADD option bytes. The application cannot modify these option bytes when the SECBOOT_LOCK is set.

When the TrustZone is disabled (TZEN = 0xC3) and the NSBOOT_LOCK option bit is cleared, the application selects a boot entry point located in the nonsecure user flash memory, at the address defined by the NSBOOTADD option bytes.

When the TrustZone is disabled and the NSBOOT_LOCK option bit is set, the device unique boot entry is the unmodifiable nonsecure address defined by the NSBOOTADD option bytes. The application cannot modify these option bytes when NSBOOT_LOCK is set.

Note: SECBOOT_LOCK and NSBOOT_LOCK can be changed only when PRODUCT_STATE = Open, Provisioning, or Regression.

For more information on the boot mechanisms, refer to Section 4: Boot modes.

3.3.2 Immutable root of trust in system flash memory

The immutable root-of-trust code stored in the system flash memory is first used to perform SFI, allowing secure and counted installation of OEM firmware in untrusted production environments (such as the OEM contract manufacturer).

The immutable code also includes secure runtime services that can be called at runtime, when a secure application sets the SBS_RSSCMDR register to a non-null value, before triggering a system reset. This runtime feature is deactivated when the BOOT_LOCK secure option bit is set or when the PRODUCT_STATE is different from “Open”.

The STM32H5 products feature ST-DA (debug authentication), to manage the debug authentication control feature, allowing to control the debug reopening and regressions of the product for after sales (field return) of the product.

The products embedding cryptographic acceleration feature ST-iROT (immutable root of trust), to handle the secure provisioning, secure boot, secure updates of the first updatable level of the platform.

3.4 Secure update

The secure firmware update is a secure service that runs after a secure boot. Its actual functions depend on the availability of the TrustZone features, and on the firmware stored in the device.

Cortex-M based application processors are commonly used to run trusted boot and a trusted OS to create a Trusted Execution Environment (TEE). The trusted boot and TEE application, supported by the STM32 ecosystem, allow the update of the microcontroller built-in program with new firmware versions, adding new features and correcting potential issues. The update process is performed in a secure way, to prevent unauthorized updates and access to confidential on-device data.

A firmware update can be done either on a single firmware image including both secure and nonsecure parts, or on the secure (respectively nonsecure) part of the firmware image, independently.

In the devices, the secure update application leverages the same hardware security as the firmware install described in Section 3.2.

3.5 Resource isolation using hide protection levels

The hardware and software resources used to boot can be isolated. This is called temporal isolation, based on a monotonic counter, taking care of incrementing the levels. When the counter is incremented, the resources (code and data) of the previous levels are hidden.

3.6 Resource isolation using TrustZone

The hardware and software resources can be partitioned so that they exist in the secure or in the nonsecure world, as shown in Figure 3.

Figure 3. Secure/nonsecure partitioning using TrustZone technology

Diagram illustrating secure/nonsecure partitioning using TrustZone technology. The diagram shows two main worlds: Nonsecure world (white) and Secure world (blue hatched). An 'Init' arrow points to the Secure world. A double-headed arrow connects the two worlds. Below the Nonsecure world are 'Applications' and 'Privileged system services'. Below the Secure world are 'Application RoT' and 'Root of trust services'. Arrows from both 'Privileged system services' and 'Root of trust services' point to a shared 'Peripherals and I/Os' block. Below this are 'Memory (internal, external)' and 'CPU time' blocks, which are also partitioned between the two worlds. A legend indicates: □ Nonsecure world, ▒ Secure world. The reference 'MSv68892V1' is in the bottom right corner.
Diagram illustrating secure/nonsecure partitioning using TrustZone technology. The diagram shows two main worlds: Nonsecure world (white) and Secure world (blue hatched). An 'Init' arrow points to the Secure world. A double-headed arrow connects the two worlds. Below the Nonsecure world are 'Applications' and 'Privileged system services'. Below the Secure world are 'Application RoT' and 'Root of trust services'. Arrows from both 'Privileged system services' and 'Root of trust services' point to a shared 'Peripherals and I/Os' block. Below this are 'Memory (internal, external)' and 'CPU time' blocks, which are also partitioned between the two worlds. A legend indicates: □ Nonsecure world, ▒ Secure world. The reference 'MSv68892V1' is in the bottom right corner.

Note: The initial partitioning of the platform is under the responsibility of the secure firmware executed after device reset.

Thanks to this resource isolation technology, the secure world can be used to protect critical code against intentional or unintentional tampering from the more exposed code running in the nonsecure world.

Note: The secure code is typically small and rarely modified, while the nonsecure code is more exposed, and prone to firmware updates.

3.6.1 TrustZone security architecture

The Armv8-M TrustZone technology is a comprehensive hardware architecture that proposes to developers a comprehensive, holistic protection across the entire processor and system. The device TrustZone hardware features include:

Note: The TZEN option bit in the FLASH_OPTSR2_PRG register activates TrustZone security.

3.6.2 Armv8-M security extension of Cortex-M33

The Arm security extension of the Cortex-M33 is an evolution, not a revolution. It uses the programmer model from earlier Cortex-M subfamilies like Cortex-M4. Indeed, Armv8-M is architecturally similar to Armv7-M, using the same 32-bit architecture, the same memory mapped resources protected with an MPU. Armv8-M also uses the nested vectored interrupt controller (NVIC).

The implementation on STM32H5 devices is composed of the following features:

For more information, refer to the Cortex-M33 programming manual (PM0264).

3.6.3 Memory and peripheral allocation using IDAU/SAU

Security attributes

As illustrated in Figure 4, the Armv8-M nonsecure memory view is similar to Armv7-M (found in Cortex-M4), with the difference that the secure memory is hidden. The secure memory view shows the flash memory, SRAM, and peripherals that are accessible only while the Cortex processor executes in a secure state.

Note: Figure 4 shows the 32-bit address space after SAU configuration, as viewed by the secure code.

Figure 4. Sharing memory map between CPU in secure and nonsecure state

Diagram showing memory map sharing between Nonsecure and Secure views. It includes regions like System region, External peripherals, SRAM, and Flash, with some areas marked as 'hidden' or aliased addresses.
Nonsecure memory viewSecure memory view
0xFFFF FFFF
0xF000 0000
System regionMPU-NS*
System control and debugSCB-NS*
0xE000 0000SysTick-NS*
External peripheralsDEBUG
0xA000 0000SAU
External memoriesMPU-S
0x6000 0000SCB-S
Periph-NSNVIC
hidden Periph-SSysTick-S
SRAM-NSITM / DWT / FBP
hidden SRAM-S
0x2000 0000
Flash-NS
0x0000 0000
hidden Flash-S

(*) Aliased addresses MSv68893V1

Diagram showing memory map sharing between Nonsecure and Secure views. It includes regions like System region, External peripherals, SRAM, and Flash, with some areas marked as 'hidden' or aliased addresses.

The Cortex processor state (and the associated rights) depends upon the security attribute assigned to the memory region where it is executed:

To manage transitions to the secure world, developers must create nonsecure callable (NSC) regions containing valid entry points to the secure libraries. The first instruction in these entry points must be the new secure gate (SG) instruction, used by the nonsecure code to call a secure function (see Figure 5).

Figure 5. Secure world transition and memory partitioning

Diagram illustrating secure world transition and memory partitioning. It shows Nonsecure memory with a Nonsecure application, and Secure memory containing a Nonsecure callable region with a Secure entry point, and a Secure library. Arrows indicate 'call', 'return', and 'call / branch' transitions.

MSv68894V1

Diagram illustrating secure world transition and memory partitioning. It shows Nonsecure memory with a Nonsecure application, and Secure memory containing a Nonsecure callable region with a Secure entry point, and a Secure library. Arrows indicate 'call', 'return', and 'call / branch' transitions.

Programming security attributes

In Cortex®-M33, the static implementation defined attribution unit (IDAU) works with the programmable security attribution unit (SAU) to assign a specific security attribute (S, NS, or NSC) to a specific address, as shown in Table 4.

Table 4. Configuring security attributes with IDAU and SAU

IDAU security attributionSAU security attribution(1)Final security attribution
NonsecureSecureSecure
Secure-NSCSecure-NSC
NonsecureNonsecure
Secure-NSCSecureSecure
NonsecureSecure-NSC

1. Defined regions are aligned to 32-byte boundaries.

The Cortex®-M33 can configure the SAU only in the secure-privilege state. When the TrustZone is enabled, the SAU defaults all addresses as secure (S). A secure boot application can then program the SAU to create NSC or NS regions, as shown in Table 4.

Note: The SAU/IDAU settings are applicable only to the Cortex®-M33. The other masters, like DMA, are not affected by these policies.

3.6.4 Memory and peripheral allocation using GTZC

Global TrustZone framework architecture

On top of the Armv8-M TrustZone security extension in the Cortex®-M33, the devices embed complementary security features that reinforce, in a flexible way, the isolation between secure and nonsecure worlds. Unlike the SAU/IDAU, the GTZC can protect legacy memories and peripherals against nonsecure transactions coming from other masters than the Cortex®-M33.

Figure 6. Global TrustZone framework and TrustZone awareness

Architecture diagram of the Global TrustZone framework and TrustZone awareness. It outlines a Device boundary containing 'Other bus master' (with Config), 'CPU' (with SAU+IDAU, MPU), 'DMA', an interconnect grid, 'Flash memory', 'SRAM', 'OTFDEC' connecting to 'External flash memory' and 'External SRAM', and four 'Peripheral' blocks connecting to 'I/O'. Blue cross-hatching marks TrustZone-aware components (CPU, DMA, Flash memory, OTFDEC, and one Peripheral), while solid blue paths denote the Global TrustZone framework.

MSv68895V1

Architecture diagram of the Global TrustZone framework and TrustZone awareness. It outlines a Device boundary containing 'Other bus master' (with Config), 'CPU' (with SAU+IDAU, MPU), 'DMA', an interconnect grid, 'Flash memory', 'SRAM', 'OTFDEC' connecting to 'External flash memory' and 'External SRAM', and four 'Peripheral' blocks connecting to 'I/O'. Blue cross-hatching marks TrustZone-aware components (CPU, DMA, Flash memory, OTFDEC, and one Peripheral), while solid blue paths denote the Global TrustZone framework.

Securing peripherals with TZSC

When the TrustZone security is active, a peripheral is either securable through the GTZC, or is natively TrustZone-aware, as shown in the previous figure:

When a securable peripheral is made secure-only with the GTZC, if this peripheral is master on the interconnect, it automatically issues secure transactions. The SDMMC is an example of a securable master. TrustZone-aware AHB masters like Cortex®-M33 or DMAs, drive a secure signal in the AHB interconnect, according to their security mode, independently of the GTZC.

Note: Like with TrustZone, a peripheral can be made privileged-only with TZSC (see Section 3.7.2). In this case, if this peripheral is master on the interconnect, it automatically issues privileged transactions.

Securing memories with TZSC and MPCBB

The TZSC block in GTZC provides the capability to manage the security and privilege for all securable external memories, programming the MPCWM resources as defined in Table 5.

Table 5. MPCWMx resources

MemoryMPC resourceType of filteringNumber of regionsDefault securityOn-the-fly decryption(1)
OCTOSPI1MPCWM1Nonsecure privileged or unprivileged region (watermarks)2Secure privileged(2)Yes
OCTOSPI2MPCWM52
FMC_NOR bankMPCWM22No
FMC_NAND / FMC_SDRAM bankMPCWM31
Backup SRAM (BKPSRAM)/FMC_SDRAMMPCWM41
  1. 1. Using the OTFDEC.
  2. 2. Assuming TrustZone is activated on the device, nonsecure unprivileged otherwise.

The MPCBB resources in GTZC provide the capability to configure the security and privilege of embedded SRAM blocks, as defined in Table 6.

Table 6. MPCBBx resources

MemoryMPC resourceType of filteringMemory sizeBlock sizeNumber of super-blocksDefault security
SRAM1GTZC1_MPCBB1Block based, managing security and privilege256 KB512(1) bytes16Secure privileged(2)
SRAM2GTZC1_MPCBB2128 KB8
SRAM3GTZC1_MPCBB3384 KB24
SRAM4GTZC1_MPCBB4384 KB24
SRAM5GTZC1_MPCBB5384 KB24
  1. 1. Blocks are grouped in superblocks of 32 consecutive blocks, to manage the configuration locking.
  2. 2. Assuming TrustZone is activated on the device, nonsecure unprivileged otherwise.

Applying GTZC configurations

The TZSC and MPCBB blocks can be used in one of the following ways:

When the dynamic option is selected and the configuration is not locked:

Securing peripherals with TZSC

The TZSC block in GTZC provides the capability to manage the security and the privilege for all securable peripherals. The list of these peripherals can be found in Section 5: Global TrustZone® controller (GTZC).

Note: When the TrustZone is deactivated, the resource isolation hardware GTZC can still be used to isolate peripherals to privileged code only (see Section 3.7.2).

When the TrustZone is activated, peripherals are set as nonsecure and unprivileged after reset.

TrustZone-aware peripherals

The devices include the following TrustZone-aware peripherals:

The way illegal access to those peripherals are monitored through the TZIC registers is described in Section 5: Global TrustZone® controller (GTZC).

For more details, refer to Section 3.6.5.

TrustZone illegal access controller (TZIC)

The TZIC block in GTZC gathers all illegal access events originated from sources either protected by GTZC or TrustZone-aware, generating one global secure interrupt towards the NVIC.

TZIC is available only when the system is TrustZone enabled (TZEN = 0xB4). All access to TZIC registers must be secured.

For each illegal event source, a status flag and a clear bit exist. Each illegal event can be masked, not generating an interrupt toward the NVIC.

Note: By default, all events are masked.

3.6.5 Managing security in TrustZone-aware peripherals

This section gives more details on how the security is implemented in the TrustZone-aware peripherals listed in the previous section.

Embedded flash memory

When the TrustZone security is enabled through option bytes (TZEN = 0xB4), the whole memory is secure after reset. The following protections, shown in Figure 7, are available to the application:

Note: All areas are aligned on the page granularity of the flash memory, which can be configured as secure while it is tagged as nonsecure in Cortex®-M33 IDAU/SAU. In this case, nonsecure accesses by the CPU to the flash memory are denied.

Erase or program operations can be available to secure/nonsecure code only for secure/ nonsecure pages or memory. A flash memory is considered secure if at least one page is secure.

Figure 7. Flash memory TrustZone protections

Diagram of Flash memory TrustZone protections showing User Flash memory and Read-only system Flash memory partitions for TrustZone disabled and enabled states.

The diagram illustrates the flash memory layout and TrustZone protections. It is divided into two main sections: User Flash memory and Read-only system Flash memory. A vertical dashed line separates the 'TrustZone disabled' state (left) from the 'TrustZone enabled' state (right). Arrows labeled 'Boot' indicate the boot locations in each state.

User Flash memory:

Read-only system Flash memory:

(*): non-volatile security configuration

MSv68896V1

Diagram of Flash memory TrustZone protections showing User Flash memory and Read-only system Flash memory partitions for TrustZone disabled and enabled states.

As shown above, when TrustZone is enabled (TZEN = 0xB4), the application code can use the HDP area that is part of the flash memory watermark-based secure area. Indeed, when the application sets the HDPx_ACCDIS bit, data read, write, and instruction fetch on this HDP area is denied until the next system reset.

For example, the software code in the secure flash memory HDP area can be executed only once, with any further access to this area denied until the next system reset. Additionally, any flash memory page belonging to an active HDP area cannot be erased anymore.

When the TrustZone is disabled (TZEN = 0xC3), the volatile/non-volatile secure area features are deactivated and all secure registers are RAZ/WI.

See Section 7: Embedded flash memory (FLASH) for more details.

On-the-fly encryption/decryption (OTFDEC1, OTFDEC2)

When the TrustZone security is enabled (TZEN = 0xB4), the OTFDEC1 or OTFDEC2 can be initialized only by the secure applications. Each of the four encrypted regions, once the configuration is confirmed, can be write-locked until the next power-on-reset.

Note: Any application (secure or nonsecure) can verify the initialization context of each OTFDEC region (including the CRC of the keys), by reading the peripheral registers.
Key registers in each OTFDEC are write-only.

See Section 3.10.3 for more details on this cryptographic engine.

Direct memory access controllers (GPDMAx)

When a DMA channel x is defined as secure (SECx = 1 in GPDMA_SECCFGR), the source and destination transfers can be independently set as secure or nonsecure by a secure application using SSEC and DSEC bits in GPDMA_CxTR1. Table 7 summarizes these security options available in each DMA channel.

Table 7. DMA channel use (security)(1)
Destination typeSecure DMA channel x (SECx = 1)Nonsecure DMA channel y (SECy = 0)
Secure sourceNonsecure sourceSecure sourceNonsecure source
Secure destinationOKOK(2)Transfer blocked
Nonsecure destinationOK(3)OK(4)Transfer blockedOK
  1. 1. When a transfer is blocked, the transfer completes but the corresponding writes are ignored, and reads return 0s. An illegal access event to TZIC is automatically triggered by the memory/peripheral used as the source or destination.
  2. 2. If the source is a memory, the transfer is possible only if SSEC = 0, otherwise the transfer is blocked.
  3. 3. If the destination is a memory, the transfer is possible only if DSEC = 0, otherwise the transfer is blocked.
  4. 4. If the transfer is memory-to-memory, it is possible only if SSEC = 0 and DSEC = 0, otherwise it is blocked.

When a channel is configured as secure:

Note: DMA secure channels are not available when TrustZone is deactivated. When a channel is configured as nonsecure, in linked-list mode, the loading of the next linked-list data structure from memory is performed with nonsecure transfers.

See Section 16: General purpose direct memory access controller (GPDMA) for more details.

Power control (PWR)

When the TrustZone security is enabled (TZEN = 0xB4), the selected PWR registers can be secured through PWR_SECCFGR, protecting the following PWR features:

Other PWR configuration bits become secure:

See Section 10: Power control (PWR) for details.

Secure clock and reset (RCC)

When the TrustZone security is enabled (TZEN = 0xB4) and security is enabled in the RCC, the bits controlling the peripheral clocks and resets become TrustZone-aware:

Note: Refer to Section 3.6.4 for the list of securable and TrustZone-aware peripherals.

Additionally, the following configurations can be made secure-only using RCC_SECCFGR:

See Section 11: Reset and clock control (RCC) for details.

Real-time clock (RTC)

Like all TrustZone-aware peripherals, a nonsecure read/write access to a secured RTC register is RAZ/WI. It also generates an illegal access event that triggers a secure illegal access interrupt if the RTC illegal access event is enabled in the TZIC.

After a backup domain power-on reset, all RTC registers can be read or written in both secure and nonsecure modes. The secure boot code can then change the security setup, making registers Alarm A, Alarm B, wakeup timer, and timestamp secure or not, using RTC_SECCFGR.

When the SEC bit is set in secure-only RTC_SECCFGR:

When the SEC is cleared in secure-only RTC_SECCFGR, it is still possible to restrict access in secure mode to some RTC registers by setting dedicated control bits: INITSEC, CALSEC, TSSEC, WUTSEC, ALRASEC, and ALRBSEC.

Note: The RTC security configuration is not affected by a system reset.

See Section 57: Real-time clock (RTC) for more details.

Tamper and backup registers (TAMP)

Like all TrustZone-aware peripherals, a nonsecure read/write access to a secured TAMP register is RAZ/WI. It also generates an illegal access event that triggers a secure illegal access interrupt if the TAMP illegal access event is enabled in the TZIC.

After a backup domain power-on reset, all TAMP registers can be read or written in both secure and nonsecure modes. The secure boot code can change this security setup, making some registers secure or not as needed, using the TAMP_SECCFGR register.

When TAMPSEC is set in TAMP_SECCFGR:

The application can also:

Note: The TAMP security configuration is not affected by a system reset.

See Section 58: Tamper and backup registers (TAMP) for more details.

General-purpose I/Os (GPIO)

When the TrustZone security is enabled (TZEN = 0xB4), each I/O pin of the GPIO ports can be individually configured as secure through the GPIOx_SECCFGR registers. Only a secure application can write to GPIOx_SECCFGR registers. After boot, each I/O pin is set as secure.

When an I/O pin is configured as secure, its corresponding configuration bits for alternate function (AF), mode selection (MODE), and I/O data are RAZ/WI in case of nonsecure access.

When a digital alternate function is used (input/output mode) to protect data transiting from/to the I/O managed by a secure peripheral, the devices add a secure alternate function gate on the path between the peripheral and its allocated I/Os:

The TrustZone-aware logic around GPIO ports, used as alternate functions, is summarized in Table 8.

Table 8. Secure alternate function between peripherals and allocated I/Os

Security configurationAlternate function logicComment
PeripheralAllocated I/O pinInputOutput
SecureSecureI/O dataPeripheral data-
NonsecureOut of reset configuration
SecureNonsecure00-
NonsecureI/O dataPeripheral data

When an analog function with an analog switch is used, the connection to the peripherals listed in Table 9 is blocked by hardware when the peripheral is nonsecure and the I/O is secure.

Table 9. Nonsecure peripheral functions that cannot be connected to secure I/Os

PeripheralAnalog function(1)InputOutput
ADC12ADC12_INP/INNX-
ADC3ADC3_INPX-
COMP1/2COMP1/2_INP/INMX-
OPAMP1OPAMP1_VINM/VINPX-

1. Used to find the I/O corresponding to the signal/function on the package (refer to the product datasheet).

Finally, regarding GPIO and security, Table 10 summarizes the list of I/Os without any hardware protection linked to TrustZone. The listed signals (input and/or outputs) are not blocked when the I/O is set as secure, and the associated peripheral is nonsecure.

For example, when a secure application sets PA4 as secure to be used as LPTIM2_CH1, if the DAC is nonsecure, it can be programmed to output data to PA4, potentially causing malfunction to the secure application.

Similarly, when a secure application sets PA0 as secure to be used as UART4_TX, if TAMP is nonsecure, it can be programmed to capture the USART input traffic through the TAMP_IN signal.

It is important that, for each case described in Table 10, the secure application decides if a potential effect on data integrity or confidentiality is critical or not. For example, if the USART situation described above is not acceptable (data transiting on secure USART is confidential), then the secure application must configure the TAMP as secure even if not used by the secure application.

Table 10. Nonsecure peripheral functions that can be connected to secure I/Os

PeripheralSignal(1)InputOutputHow to set the peripheral or function as secure
DAC1DAC1_OUTx (x = 1, 2)-XSet DAC1SEC in GTZC1_TZSC_SECCFGR1.
UCPD1UCPD1_CCx (x = 1, 2)XXSet UCPD1SEC in GTZC1_TZSC_SECCFGR1.
UCPD1_DBx (x = 1, 2)X-
TAMPTAMP_INx (x = 1 to 8)X-Set TAMPSEC in TAMP_SECCFGR
TAMP_OUTx (x = 1 to 8)-X
RTCRTC_OUTx (x = 1, 2)-XSet SEC in RTC_SECCFGR.
RTC_TSX-Set TSSEC in RTC_SECCFGR.
PWRWKUPx (x = 1 to 8)X-Set WUPxSEC in PWR_SECCFGR.
RCCLSCO-XSet LSESEC in RCC_SECCFGR.
EXTIEXTIx (x= 0 to 66)X-Set SECx bit in EXTI_SECCFGR.

1. To find the I/O corresponding to the signal/function on the package, refer to the product datasheet.

Refer to Section 13: General-purpose I/Os (GPIO) for more details.

Extended interrupts and event controller (EXTI)

When the TrustZone security is enabled, the EXTI is able to protect event register bits from being modified by nonsecure accesses. The protection can individually be activated per input event via the register bits in EXTI_SECCFGRx. When an input event is configured as secure, only a secure application can change the configuration (including security), change the masking or clear the status of this input event.

The security configuration in EXTI_SECCFGR1 and EXTI_SECCFGR2 can be globally locked after reset in EXTI_LOCKR.

See Section 20: Extended interrupts and event controller (EXTI) for more details.

System configuration, boot, and security (SBS)

Like all TrustZone-aware peripherals, when the TrustZone security is enabled, a nonsecure read/write access to a secured SBS register is RAZ/WI. Such access also generates an illegal access event that triggers a secure illegal access interrupt if the SBS illegal access event is not masked in the TZIC.

See Section 14: System configuration, boot, and security (SBS) for more details.

Microcontroller debug unit (DBGMCU)

The MCU debug component (DBGMCU) helps the debugger, providing support for:

The DBGMCU is a TrustZone-aware peripheral, managing access to its control registers as described in Table 11.

Table 11. TrustZone-aware DBGMCU nonsecure accesses management

Debug profilePeripheral status(1)DBG_xx_STOP control bits
Write accessRead access
Nonsecure invasive (SPIDEN = 0)NSYes (S(2) or NS)Yes (S or NS)
SNone (S or NS)
Secure invasive (SPIDEN =1)NSYes (S or NS)
SYes (S only)

1. As reported by the GTZC, the TrustZone-aware peripheral or the DMA channel.

2. Secure access from the debugger is converted to nonsecure access in the device.

Refer to Section 71.12: Microcontroller debug unit (DBGMCU) for more details.

3.6.6 Activating TrustZone security

The TrustZone is deactivated by default in all devices. It can be activated by setting the TZEN option bit in FLASH_OPTSR2_PRG when PRODUCT_STATE is Open. Once TZEN has changed from disabled to enabled (0xC3 to 0xB4), the default security state, after reset, is always the following:

Note: Refer to Section 3.6.4 for the list of securable and TrustZone-aware peripherals.

3.6.7 Deactivating TrustZone security

Once TrustZone is activated, it can only be deactivated during a PRODUCT_STATE regression to open.

Note: Such PRODUCT_STATE regression triggers the erasing of embedded memories (SRAM2, flash), and the reset of all peripherals, including the OTFDEC and all crypto engines.

After the TrustZone deactivation, most of the features mentioned in Section 3.6 are no longer available:

Note: When the TrustZone is deactivated, the resource isolation using privilege remains available (see Section 3.7.2 for details).

3.7 Other resources isolation

These are hardware mechanisms offering an additional level of isolation on top of the TrustZone technology.

3.7.1 Temporal isolation using secure hide protection (HDP)

The embedded flash memory allows to define an HDP area per watermarked-secure area of each bank (8-Kbyte page granularity). The code executed in this HDP area, with its related data and keys, can be hidden after boot, until the next system reset. The hidden protection principle is shown in Figure 8.

Figure 8. Flash memory secure HDP area

Diagram showing flash memory secure HDP area with User applications, Secure flash memory applications, and Secure boot code and data (HDP) sections.
Diagram showing flash memory secure HDP area with User applications, Secure flash memory applications, and Secure boot code and data (HDP) sections.

Activation of HDP area in user flash memory is related to HDPL1: as soon as HDPL ≥ 2, data read, write, and instruction fetch (on the area defined by HDPx_PSTRT and HDPx_PEND in FLASH_HDPxR_PRG option bytes), are denied until the next device reset.

The END of the HDPx areas can be extended (dynamically by the application) thanks to the FLASH_HDPEXTR flash memory register.

Note: Bank erase aborts when it contains a write-protected area (WRP or HDP area).

3.7.2 Resource isolation using Cortex privileged mode

In parallel to the TrustZone isolation described in Section 3.6, the hardware and software resources can be partitioned so that they are restricted to software running in Cortex privileged mode.

Thanks to this hardware isolation technology, available even if TrustZone is disabled, critical code or data can be protected against intentional or unintentional tampering from the more exposed unprivileged code.

Memory and peripheral privileged allocation using MPU

The Cortex-M33 MPU divides the unified memory into eight regions in nonsecure and twelve in TrustZone, each aligned to a multiple of 32 bytes. Each memory region can be programmed to generate faults when accessed inappropriately by unprivileged software.

Memory and peripheral privileged allocation using GTZC

For the Cortex-M33 master, to complement the coarse isolation provided by the MPU, the GTZC reinforces, in a flexible way, the isolation between privileged and unprivileged tasks, for peripherals and selected memories.

For masters other than the Cortex-M33, the GTZC can assign them as unprivileged initiators, automatically protecting resources defined as privileged against this master.

Managing security in privileged-aware peripherals

TrustZone-aware peripherals also implement privileged-only access mode. The privileged protection is valid even if TrustZone is disabled (TZEN = 0xC3):

By default, all registers can be read or programmed in both privileged and unprivileged modes.

When the secure privileged bit SPRIV is set in FLASH_PRIVCFGR, reading and writing the secure registers is possible only in privileged mode. Write access to this bit is ignored if TrustZone is disabled (TZEN = 0xC3).

When the nonsecure privileged bit NSPRIV is set in FLASH_PRIVCFGR, reading and writing the flash memory nonsecure registers is possible only in privileged mode.

Regarding privileged protection, the devices offer the following features:

Note: Switching a page from privileged to unprivileged does not erase its content.

When applicable, an erase or program operation is always available to privileged code, and is available to unprivileged code only for unprivileged pages or unprivileged memory.

When the privileged bit PRIV is set in OTFDEC_PRIVCFGR, only a privileged application can initialize the OTFDEC.

Note: OTFDEC_PRIVCFGR can be read by both privileged and unprivileged code.

When a DMA channel x is defined as privileged (PRIVx = 1 in GPDMA_PRIVCFGR), special rules (see Table 12) apply when accessing the privileged/unprivileged source or destination.

Table 12. DMA channel use (privilege)

DestinationPrivileged DMA channel x (PRIVx = 1)Unprivileged DMA channel y (PRIVy = 0)
Privileged sourceUnprivileged sourcePrivileged sourceUnprivileged source
PrivilegedOKTransfer blocked(1)
UnprivilegedTransfer blockedOK

1. When a transfer is blocked, the transfer completes but the corresponding writes are ignored, and reads return 0s.

By default, after a power-on or a system reset, all PWR registers except PWR_PRIVCFGR, can be read or written in both privileged and unprivileged modes.

When secure privileged bit SPRIV is set in PWR_PRIVCFGR, reading and writing the PWR securable registers are possible only in privileged mode. Write access to this bit is ignored if TrustZone is disabled (TZEN = 0xC3).

When the nonsecure privileged bit NSPRIV is set in PWR_PRIVCFGR, reading and writing the PWR nonsecure registers are possible only in privileged mode.

See Section 10: Power control (PWR) for details.

By default, after a power-on or a system reset, all RCC registers except RCC_PRIVCFGR can be read or written in both privileged and unprivileged modes.

When the secure privileged bit SPRIV is set in RCC_PRIVCFGR, reading and writing the RCC securable bits are possible only in privileged mode. Write access to this bit is ignored if TrustZone is disabled (TZEN = 0xC3).

When the nonsecure privileged bit NSPRIV is set in RCC_PRIVCFGR, reading and writing the RCC nonsecure bits are possible only in privileged mode.

See Section 11: Reset and clock control (RCC) for details.

By default after any backup domain reset, all RTC registers except RTC_PRIVCFGR, can be read or written in both privileged and unprivileged modes.

When PRIV bit is set in privileged-only RTC_PRIVCFGR:

All the other RTC registers can be read only in privileged mode.

When the PRIV bit is cleared in the privileged-only RTC_PRIVCFGR register, it is still possible to restrict access to privileged mode to some RTC registers by setting dedicated control bits: INITPRIV, CALPRIV, TSPRIV, WUTPRIV, ALRAPRV, or ALRBPRIV.

See Section 57: Real-time clock (RTC) for details.

By default after any backup domain reset, all TAMP registers except TAMP_PRIVCFGR can be read or written in both privileged and unprivileged modes.

When PRIV bit is set in privileged-only TAMP_PRIVCFGR:

The application can also:

3.8 Secure execution

Through a mix of special software and hardware features, the devices ensure the correct operation of their functions against abnormal situations caused by programmer errors, software attacks through network access or local attempt for tampering code execution.

This section describes the hardware features specifically designed for secure execution.

3.8.1 Memory protection unit (MPU)

The Cortex-M33 includes a memory protection unit (MPU) that can restrict the read and write accesses to each memory region (including those mapped to peripherals), based on one or more of the following parameters

The memory map and the programming of the nonsecure and secure MPUs split memory into regions (up to eight for the nonsecure, and up to twelve for the TrustZone). Secure MPU is only available when TrustZone is activated.

3.8.2 Embedded flash memory write protection

The embedded flash memory write protection (WRP) prevents illegal or unwanted write/erase to special sections of the embedded flash memory user area (system area is permanently write protected).

Write protected area is defined through the option bytes, writing the start and end addresses: two write-protected areas can be defined in each bank, with the granularity of a 32-Kbyte page.

WRP areas can be modified through option byte changes unless the corresponding FLASH_WRPSGNxR has its UNLOCK option bit cleared (meaning ROM emulation). UNLOCK can be set only when regressing to PRODUCT_STATE = Open.

Note: Bank erase aborts when it contains a write-protected area (WRP or HDP area).

3.8.3 Tamper detection and response

Principle

The devices include active protection of critical security assets against temperature, voltage and frequency attacks, with the following features:

See Section 58: Tamper and backup registers (TAMP) for more details.

Tamper detection sources

The devices support eight active input/output pins, allowing four independent active-tamper meshes, or up to seven meshes if the same output pin is shared by several input pins (for a total of eight active-tamper I/Os). The active-tamper balls are mapped in the center of packages that can be used in the POS market (such as WLCSP105).

The active pins are clocked by the LSE, and are functional in different system operating modes (Run, Sleep, Stop, or Standby), and in VBAT mode. Refer to TAMP pins functionality over modes for the list of tamper pins and their availability across power modes.

Detection time is programmable, and a digital filtering is available (tamper triggered after two false comparisons in four consecutive comparison samples).

Note: Timestamps are automatically generated when a tamper event occurs.

The internal tamper sources are listed in Table 13.

Table 13. Internal tampers in TAMP

Tamper inputNOER bit number in TAMP_CR3Tamper source
itamp10Backup domain voltage continuous monitoring, functional in VBAT mode
itamp21Temperature monitoring, functional in VBAT mode
itamp32LSE monitoring(1), functional in VBAT mode
itamp43HSE monitoring
itamp54RTC calendar overflow (rtc_calovf)
itamp65JTAG/SWD access
itamp7, 12, 136, 11, 12Voltage monitoring (\(V_{CORE}\), \(V_{REF+}\)), through ADC analog watchdog
itamp87Monotonic counter overflow (generated internally)
itamp98Fault generation for cryptographic peripherals (SAES, PKA, AES, RNG)
itamp1110IWDG timeout and potential tamper (IWDG reset when at least one enabled tamper flag is set)
itamp1514System fault detection

1. LSE missing or over frequency detection (> 2 MHz), glitch filter (> 2 MHz).

Response to tampers

Each source of tamper in the device can be configured to trigger the following events:

Read/write access by software to all these secrets can be blocked, by setting the BKBLOCK bit in TAMP_CR2. The device secrets access is possible only when BKBLOCK is cleared, and no tamper flag is set for any enabled tamper source.

If \(V_{DD}\) is not present, the secrets that are erased when \(V_{DD}\) is present are erased only at the next \(V_{DD}\) power on.

Note: Device secret erase is also triggered by setting the BKERASE bit in TAMP_CR2, or by performing a PRODUCT_STATE regression as defined in Section 3.11.2.
Device secrets are not reset by a system reset or when the device wakes up from Standby mode.

Software filtering mechanism

Each tamper source can be configured not to launch an immediate erase, by setting the corresponding TAMPxNOER bit in TAMP_CR2 (for external tamper pin) or TAMP_CR3 (for internal tamper).

In such a situation, when the tamper flag is raised, access to below secrets is blocked until all tamper flags are cleared:

Once the application, notified by the tamper event, analyzes the situation, there are two possible cases:

Note: If the tamper software fails to react to such a tamper flag, an IWDG reset triggers an automatic erasing of secrets.

Tamper detection and low-power modes

The effects of low-power modes on a tamper detection are summarized in Table 14.

Table 14. Effect of low-power modes on TAMP

ModeDescription
SleepNo effect on tamper detection features.
TAMP interrupts cause the device to exit the Sleep mode.
StopNo effect on tamper detection features, except for level detection with filtering and active tamper modes that remain active only when the clock source is LSE or LSI.
Tamper events cause the device to exit the Stop mode.
StandbyNo effect on tamper detection features, except for level detection with filtering and active tamper modes which remain active only when the clock source is LSE or LSI.
Tamper events cause the device to exit the Standby mode.

3.9 Secure storage

A critical feature of security systems is how long-term keys are stored, protected, and provisioned. Such keys are typically used for loading a boot image, or handling of critical user data.

Figure 9 shows how the key management service application can use the AES engine, for example, to compute external image decryption keys. Nonvolatile keys are stored in the flash memory in a dedicated area including access control (see Section 3.7.1), while volatile

key storage consists in the battery-powered, tamper-protected SRAM or registers in TrustZone-aware TAMP.

Figure 9 also shows keys that are manipulated by software (like OTFDEC keys), or keys that are managed only by hardware (like DHUK). More information on those hardware keys can be found in Section 3.9.1.

Figure 9. Key management principle

Diagram illustrating the key management principle. It shows the flow of keys between various components: Embedded non-volatile storage (software secret), Hardware key derivation, Secure AES (containing Derived hardware unique key and AES with DPA), OTFDEC, AES without DPA, Embedded volatile storage (tamper resistant), and Embedded non-volatile storage. Arrows indicate hardware and software transfers of keys.

The diagram illustrates the key management principle. It shows the flow of keys between various components:

Legend

MSv68898V1

Diagram illustrating the key management principle. It shows the flow of keys between various components: Embedded non-volatile storage (software secret), Hardware key derivation, Secure AES (containing Derived hardware unique key and AES with DPA), OTFDEC, AES without DPA, Embedded volatile storage (tamper resistant), and Embedded non-volatile storage. Arrows indicate hardware and software transfers of keys.

Details on tamper protection can be found in Section 3.8.3, while TAMP TrustZone features are briefly described in Section 3.6.5.

3.9.1 Hardware secret key management

As shown in the previous figure, the devices propose a better protection for application keys, using hardware secret keys. These AES keys can be made usable to the application, without exposing them in clear-text (unencrypted). Such keys also become immediately unusable in case of tamper.

There are three different sources of hardware secret keys:

Those keys can be used in the following modes:

3.9.2 Unique ID

The devices store a 96-bit ID that is unique to each device (see Section 72.1: Unique device ID register (96 bits)).

Application services can use this unique identity key to identify the product in the cloud network, or make it difficult for counterfeit devices or clones to inject untrusted data into the network.

Alternatively, the 256-bit device unique key (DHUK) can be used (see Section 3.9.1).

3.10 Crypto engines

The devices implement state-of-the-art cryptographic algorithms featuring key sizes and computing protection as recommended by national security agencies such as NIST for the U.S.A, BSI for Germany or ANSSI for France. Those algorithms are used to support privacy, authentication, integrity, entropy, and identity attestation.

The embedded crypto engines reduce weaknesses on the implementation of critical cryptographic functions, preventing, for example, the use of weak cryptographic algorithms and key sizes. They also enable lower processing times and lower power consumption when performing cryptographic operations, offloading those computations from Cortex-M33. This is especially true for asymmetric cryptography.

For product certification purposes, ST can provide certified device information on how these security functions are implemented and validated.

For more information on the crypto engine processing times, refer to their respective sections in the reference manual.

3.10.1 Crypto engines features

Table 15 lists the accelerated cryptographic operations available in the devices. Two AES accelerators are available (both can be reserved to secure application only).

Note: Additional operations can be added using firmware. The PKA can accelerate asymmetric crypto operations (like key pair generation, ECC scalar multiplication, point on curve check). See Section 47: Public key accelerator (PKA) for more details.

Table 15. Accelerated cryptographic operations
OperationsAlgorithmSpecificationLength of keys (in bit)Modes
Get entropyRNGNIST SP800-90B(1)N/ASoftware and hardware(2) modes running in parallel
Encryption, decryptionAESFIPS PUB 197
NIST SP800-38A
128, 256ECB, CBC, CTR(3)
Authenticated encryption or decryptionNIST SP800-38C
NIST SP800-38D
128, 256GCM, CCM
Cipher-based message authentication codeNIST SP800-38D128, 256GMAC
ChecksumSHA-1FIPS PUB 180-4N/ADigest 160-bit
Cryptographic hashSHA-2-SHA-224, SHA-256
SHA2-384, SHA2-512
SHA-3SHA3-224, SHA3-256,
SHA3-384, SHA3-512
Keyed-hashing for message authenticationHMACFIPS PUB 198-1
IETF RFC 2104
Short, long (>64 bytes)-
Encryption/decryption key-pair generation(4)RSAIETF RFC 8017
NIST SP800-56B
Up to 4160RSAES-OAEP
Signature(4) with hashingRSAIETF RFC 8017
FIPS PUB 186-4
Up to 4160PKCS1-v1_5, PSS
Signature verificationECDSAANSI X9.62
IETF RFC 7027
FIPS PUB 186-4
Up to 640Refer to table 'Family of supported curves for ECC operations' in PKA section for details
Key agreementECDHANSI X9.42
  1. 1. Certifiable using STMicroelectronics reviewed documents.
  2. 2. Random numbers distribution to SAES and PKA using a dedicated hardware bus.
  3. 3. ECB and CBC chaining modes protected against side-channel and timing attacks in SAES (see Section 3.10.2).
  4. 4. Private key cryptography protected against side-channel and timing attacks.

Note: Binary curves, Edwards curves and Curve25519 are not supported by the PKA.

3.10.2 Secure AES coprocessor (SAES)

The devices provide an additional on-chip hardware AES encryption and decryption engine, implementing countermeasures and mitigations against power and electromagnetic side-channel attacks.

Clocked by the system clock the SAES results in very good performance for a dpa resistant hardware accelerator. The SAES engine supports 128-bit or 256-bit key in the electronic code book (ECB), cipher block chaining (CBC), (CTR), (GCM), (CCM), and (GMAC) modes.

As shown in Section 3.9, the SAES can be used for extra-secure on-chip storage for sensitive information. It can also be made secure-only.

For more information, refer to Section 3.10.2: Secure AES coprocessor (SAES).

3.10.3 On-the-fly decryption engine (OTFDEC1, OTFDEC2)

The OTFDEC TrustZone-aware peripheral proposes on-the-fly decryption of encrypted images stored on external flash memory, connected through the OCTOSPI. This decryption process introduces almost no additional cycle overhead when the standard NOR flash memory is used. The OTFDEC can also be used to encrypt flash memory images on the device (for example to encrypt with a device unique secret key).

When a tamper event is confirmed in TAMP, all OTFDEC keys are erased and encrypted regions are read as 0 until the OTFDEC is properly initialized again.

An OTFDEC typical use is detailed in Section 3.12.2. For more details on the peripheral programming, refer to Section 48: On-the-fly decryption engine (OTFDEC).

3.11 Product life cycle

A typical IoT device life cycle is summarized in Figure 10. For each step, the devices propose secure life cycle management mechanisms embedded in the hardware.

Figure 10. Device life-cycle security

A state transition diagram showing the device life cycle. It is divided into 'User states' and 'Vendor states' by a vertical dashed line. Vendor states include 'Virgin device', 'STM32 personalized device', and 'Platform'. User states include 'Development platform', 'Deployed product', and 'Debug authentication Control'. Transitions are labeled: 'Chip manufacturing' (Virgin to Personalized), 'Vendor manufacturing' (Personalized to Platform), 'User provisioning' (Platform to Development), 'Productization' (Platform to Deployed), 'Field return' (Deployed to RMA), 'Debug' (Debug auth to Deployed), and 'Full regression' (Debug auth to Development). A legend at the bottom shows 'State' in an oval and 'transition' as an arrow.
graph TD; subgraph Vendor_states [Vendor states]; VD([Virgin device]); SPD([STM32 personalized device]); P([Platform]); end; subgraph User_states [User states]; DP([Development platform]); DP2([Deployed product]); DAC([Debug authentication Control]); end; RMA([RMA product]); VD -- "Chip manufacturing" --> SPD; SPD -- "Vendor manufacturing" --> P; P -- "User provisioning" --> DP; P -- "Productization" --> DP2; DP2 -- "Field return" --> RMA; DAC -- "Debug" --> DP2; DAC -- "Full regression" --> DP; style VD fill:#fff,stroke:#000; style SPD fill:#fff,stroke:#000; style P fill:#fff,stroke:#000; style DP fill:#fff,stroke:#000; style DP2 fill:#fff,stroke:#000; style DAC fill:#fff,stroke:#000; style RMA fill:#fff,stroke:#000;

State → transition

MSv76046V1

A state transition diagram showing the device life cycle. It is divided into 'User states' and 'Vendor states' by a vertical dashed line. Vendor states include 'Virgin device', 'STM32 personalized device', and 'Platform'. User states include 'Development platform', 'Deployed product', and 'Debug authentication Control'. Transitions are labeled: 'Chip manufacturing' (Virgin to Personalized), 'Vendor manufacturing' (Personalized to Platform), 'User provisioning' (Platform to Development), 'Productization' (Platform to Deployed), 'Field return' (Deployed to RMA), 'Debug' (Debug auth to Deployed), and 'Full regression' (Debug auth to Development). A legend at the bottom shows 'State' in an oval and 'transition' as an arrow.

Additional details on the various phases and associated transitions, found either at the vendor or end-user premises, are summarized in Table 16.

Table 16. Main product life-cycle transitions

TransitionsDescription
Device manufacturingST creates new STM32 devices, always checking for manufacturing defects. During this process, the device is provisioned with ROM firmware, secure firmware install (SFI) unique key pair, and a public ID.
Vendor manufacturingOne (or more) vendor is responsible for the platform assembly, initialization, and provisioning before delivery to the end user. This end user can use the final product (“productization” transition) or he/she can use the platform for software development (“user provisioning” transition).
ProductizationThe end user gets a product ready for use. All security functions of the platform are enabled, the debugging/testing features are restricted/disabled, and unique boot entry to immutable code is enforced.
User provisioningPlatform vendor prepares an individual platform for development, not to be connected to a production cloud network.
Full regressionThe product is returned for analysis to field return centers. Analysis is possible by opening it partially, or by launching a partial or a full regression. Such accesses require provisioning, including certificates provided by the vendor.
Field returnThese are one-way transitions, with devices kept in user premises or returned to the manufacturer. In both cases, all data including user data is destroyed, therefore the devices lose the ability to operate securely (like connecting to a managed IoT network).
This Field return is valid including when PRODUCT_STATE is Locked.
STMicroelectronics does not perform analysis on defective parts in closed or locked states.

The features described hereafter contribute to secure the device life cycle.

3.11.1 Product configurations and security services

The product is provisioned with ST security services in system flash, but can be configured to let the full control of the boot chain to OEMs. This is done thanks to the unique boot entry (FLASH_OPTSR: BOOT_UBE) option byte, allowing to select between the security services (ST-iROT: ST immutable root of trust), or OEM boot implementation (OEM-iROT: OEM immutable root of trust) to be installed in the user part of the flash memory.

Security services are provisioned by ST in system flash (immutable). They provide the root of trust of the platform managing the verification and the update of the first updatable code (uROT).

3.11.2 Life cycle management

The product life cycle allows to control the access to different assets (code and data) of the product, including during development, manufacturing, and after sales.

It allows to provision the product with different distribution models taking care on the code and data provisioned.

Table 17. Typical product life-cycle phases

PRODUCT_STATE + DebugStateDebug (default configuration)Comments
OpenDevice openSecure(1) and nonsecureAllows to develop the product, as it provides the debug of the code.
Boot address must target a secure area when TrustZone is enabled.
Using the boot pin allows to launch the bootloader. Using boot pin and BOOT_UBE allows to launch user flash code through ST-iROT.
ProvisioningDebug partially opened (only nonsecure)HDPL3 + Nonsecure onlyAllows to manage the provisioning of the product (partial or full). It allows to launch secure firmware Install, or bootloader to provision the product.
Boot address must target a secure area when TrustZone is enabled. Boot on SRAM is not permitted.
iROT-ProvisionedDebug partially opened (only nonsecure)HDPL3 + Nonsecure onlyAssumes that immutable root of trust is installed, including its configuration (code, option bytes, secure storage).
Boot address must target a secure area when TrustZone is enabled. Boot on SRAM is not permitted.
TZ-ClosedDebug partially opened (only nonsecure)HDPL3 + Nonsecure onlyAssumes that the Secure OS is installed in TrustZone (this state exist only if TZEN = 0xB4).
Debug is opened for nonsecure applications
ClosedDebug closedNoDebug + debug authentication controlAssumes the product configuration as finalized. It allows to support debug authentication for in-the-field repair (read the dedicated application note).
LockedDebug lockedNoneAssumes the product configuration as finalized. The debug authentication is not permitted. The product is definitively in this state, nevertheless the field return procedure allow to launch RMA state.
NS-RegressionDebug closedNoDebugThis is a temporal (but nonvolatile) state to manage the partial regression to the TZ-Closed, removing all nonsecure code and data including in secure storage.
RegressionDebug closedNoDebugThis is a temporal state (but nonvolatile) to manage the full regression to Open state, removing all user flash code and data including in secure storage (HDPL1 to HDPL3).
Debug ConstrainedDebug opened following debug authentication permissionsDepends upon permissionsThis is a temporal state (until power-on-reset) to manage debug based on the permissions acquired by the debug authentication protocol.

1. Debug is not available when executing RSS code.

The supported transitions, summarized in Figure 11, can be requested (when available) through the debug interface or via the system bootloader.

Figure 11. PRODUCT_STATES (simplified TrustZone activated view)

Flowchart of PRODUCT_STATES transitions. The states are: Open (blue), Provisioning (yellow), iROT-Provisioned (yellow), TZ-Closed (light blue), Closed (grey), and Locked (grey). Transitions are: Open to Provisioning, Provisioning to iROT-Provisioned, iROT-Provisioned to TZ-Closed, and TZ-Closed to both Closed and Locked. A legend at the bottom explains the color coding: blue for initial state, yellow for initial provisioning, light blue for secure OS provisioned, and grey for product configuration finalised. The document ID MSv69900V3 is in the bottom right corner.
graph TD; Open[Open] --> Provisioning[Provisioning]; Provisioning --> iROT-Provisioned[iROT-Provisioned]; iROT-Provisioned --> TZ-Closed[TZ-Closed]; TZ-Closed --> Closed[Closed]; TZ-Closed --> Locked[Locked];

Initial state: fully open for development

Initial provisioning (ST-iROT or OEM-iROT)

Secure OS provisioned

Product configuration finalised

MSv69900V3

Flowchart of PRODUCT_STATES transitions. The states are: Open (blue), Provisioning (yellow), iROT-Provisioned (yellow), TZ-Closed (light blue), Closed (grey), and Locked (grey). Transitions are: Open to Provisioning, Provisioning to iROT-Provisioned, iROT-Provisioned to TZ-Closed, and TZ-Closed to both Closed and Locked. A legend at the bottom explains the color coding: blue for initial state, yellow for initial provisioning, light blue for secure OS provisioned, and grey for product configuration finalised. The document ID MSv69900V3 is in the bottom right corner.

Figure 12. PRODUCT_STATES (full TrustZone activated view)

A state machine diagram showing the product lifecycle from development to in-the-field return. It includes states like Open, Provisioning, iROT-Provisioned, TZ-Closed, Closed, and Locked, with transitions and a legend for color-coded states.

The diagram illustrates the product lifecycle across three main phases: Product development, Product manufacturing, and In-the-field return.

Legend:

MSv69901V2

A state machine diagram showing the product lifecycle from development to in-the-field return. It includes states like Open, Provisioning, iROT-Provisioned, TZ-Closed, Closed, and Locked, with transitions and a legend for color-coded states.

The full view of the life cycle includes the debug authentication part, to help product maintenance to manage field returns (in-the-field centers). The debug authentication control is ensured thanks to a protocol based on the Arm PSA ADAC specification. It allows controlling that the host has a trusted certificate with permissions. Permissions definition allows a lot of flexibilities, in our default model we consider: Full or partial regression, or to open the debug for nonsecure.

When TrustZone is disabled, the state TZ-Closed does not exist, and the debug authentication is based on a password authentication method. For details on the debug authentication feature, refer to the corresponding application note.

The protocol includes a “DISCOVER” command allowing to get basic information of the target: manufacturer, product name, device identifier, protocol version supported, and crypto scheme for authentication (this help selecting between certificates and password).

To ease the product maintenance (in-the-field), it is recommended to take advantage of the feature called debug authentication control. This enables the maintenance of the product activating the debug and makes it possible to manage regressions while considering the security of the sensible information.

This implies the following actions:

A dedicated application note is available to help configure the platform, the host tools and to generate certificates.

3.12 Software intellectual property protection and collaborative development

Thanks to the software intellectual property protection and collaborative model, the devices allow the design of solutions integrating innovative third-party libraries.

Collaborative development is summarized in Figure 13. Starting from a personalized device sold by STMicroelectronics, a vendor A can integrate a portion of hardware and software on a platform A, which can then be used by a vendor B, who does the same before deploying a final product to the end users.

Note: Each platform vendor can provision individual platforms for development not to be connected to a production cloud network (“Development Platform X”).

Figure 13. Collaborative development principle

Figure 13. Collaborative development principle flowchart illustrating the lifecycle divided into User states (left) and Vendor states (right). Under Vendor states: STM32 personalized device -> Vendor A manufacturing -> Platform A (with Platform part integrated) -> Vendor B manufacturing -> Platform B (with Platform part integrated). Platform A connects to Development platform B via User provisioning. Platform B connects to Development platform B via User provisioning. Under User states: Development platform B connects via Productization to Deployed product -> Decommissioning -> Decommissioned product.

MSv64455V1

Figure 13. Collaborative development principle flowchart illustrating the lifecycle divided into User states (left) and Vendor states (right). Under Vendor states: STM32 personalized device -> Vendor A manufacturing -> Platform A (with Platform part integrated) -> Vendor B manufacturing -> Platform B (with Platform part integrated). Platform A connects to Development platform B via User provisioning. Platform B connects to Development platform B via User provisioning. Under User states: Development platform B connects via Productization to Deployed product -> Decommissioning -> Decommissioned product.

The features described hereafter contribute to securing the software intellectual property within such a collaborative development.

3.12.1 Software intellectual property protection

As described in Section 3.11.2, the hardware PRODUCT_STATE mechanism automatically controls the access to secrets provisioned in the device. The protection of these secrets are defined in Table 18.

Table 18. Software intellectual property protection with PRODUCT_STATE

PRODUCT_STATE
protection level
Secrets protection
OpenDevice openNo special protections.
ProvisioningDebug partially opened (only nonsecure)All areas protected with HDPL1 cannot be dumped, debugged or traced. The iROT can setup a higher level of protection.
iROT-ProvisionedDebug partially opened (only nonsecure)All areas protected with HDPL1 cannot be dumped, debugged or traced. The iROT can setup a higher level of protection.
TZ-ClosedDebug partially opened (only nonsecure)All peripherals and memories mapped as secure during secure boot cannot be dumped, debugged or traced
ClosedNo debugNo debug possible except through debug authentication.
LockedNo debugAll data and code stored in the device or encrypted in external flash memory cannot be dumped clear-text, debugged or traced.

3.12.2 Software intellectual property protection with OTFDEC

As described in Section 3.10.3, the OTFDEC associated with the OCTOSPI is able to decrypt on the fly, the encrypted images stored in external SPI flash memories.

Thanks to this feature, the devices allow the installation of intellectual properties in one of the following ways:

Figure 14 illustrates this last case, with the provisioning, in a non-trusted environment, of software intellectual properties both in the embedded flash memory and in an external SPI flash memory (encrypted).

Note: Since the OTFDEC uses the AES in counter mode (CTR) to achieve the lowest possible latency, each time the content of one encrypted region is changed, the corresponding cryptographic context (key or initialization vector) must be changed. This constraint makes OTFDEC suitable to decrypt read-only data or the code stored in external NOR flash memory.

Figure 14. External flash memory protection using SFI

Diagram illustrating external flash memory protection using SFI, divided into Step 1: Provisioning and Step 2: Secure Boot.

The diagram illustrates the process of external flash memory protection using SFI, divided into two steps:

Step 1: Provisioning

This step shows the STM32 microcontroller interacting with a Host (1) via various communication interfaces: JTAG, I3C (labeled 'I3C added'), USART, SPI, I2C, FDCAN, and USB. The Host is connected to the STM32's internal components: SRAM2 (Secure bootloader part II) (3), ROM (Secure bootloader part I) (2), and SRAM 1. The ROM (2) is connected to the SRAM2 (3) and the OTF DEC (4). The OTF DEC (4) is connected to the internal Flash (5) and the external Octo SPI Flash (6). The internal Flash (5) is also connected to the OTF DEC (4). The external Octo SPI Flash (6) is connected to the OTF DEC (4).

Step 2: Secure Boot

This step shows the STM32 microcontroller interacting with an external Octo SPI Flash (2). The STM32's internal components include the Application (1) and the Secure boot (1) block, which is connected to the OTF DEC (1). The OTF DEC (1) is connected to the external Octo SPI Flash (2). A tamper signal is shown entering the STM32 and connecting to the OTF DEC (1).

MSv69903V1

Diagram illustrating external flash memory protection using SFI, divided into Step 1: Provisioning and Step 2: Secure Boot.

Provisioning

Assuming the device is virgin, the first step is to provision both flash memories, as detailed below:

  1. 1. The user creates a SFI image, composed of:
    • – Encrypted internal firmware and data (including external flash memory drivers)
    • – Encrypted external firmware and data AES key (up to 4)
    • – Encrypted external firmware and data image
  2. 2. The secure bootloader stored in the system memory, loads the second part of the secure bootloader in SRAM2, through the supported communication ports (USART, SPI, I2C, FDCAN, USB, I3C, and JTAG). This second part runs in the secure SRAM2 and is responsible for executing the SFI process, applying the SFI protocol thanks to the commands received through the above mentioned supported communication ports.
  3. 3. The internal flash memory is programmed with decrypted option bytes, internal firmware and data, and external firmware and data AES keys. Alternatively, device unique external firmware AES keys can be used instead of such global keys.
  4. 4. The OTFDEC is properly initialized with encrypted region information, including the corresponding external firmware and data AES key.
  5. 5. Running the SFI process, chunks of encrypted external firmware and data image are decrypted in the device, then re-encrypted in the OTFDEC.
  1. 6. After a chunk OTFDEC re-encryption, the user external flash memory programmer is responsible for programming the last encrypted chunks to the external SPI flash memories through the OCTOSPI.

Secure boot

After provisioning, each time the device initializes on a trusted firmware, the following actions are required:

  1. 1. Secure boot firmware executes, programming the external firmware and data AES keys to the OTFDEC write-only key registers, along with the other needed information.
  2. 2. The application reads or executes the encrypted external firmware and data through the OCTOSPI in memory-mapped mode, unless a tamper event is detected. In this case, all OTFDEC keys are erased and encrypted regions are read as 0 until the OTFDEC is properly initialized.

For more information on SFI solutions for the devices, refer to the AN4992 “STM32 MCUs secure firmware install (SFI) overview”.

3.12.3 Other software intellectual property protections

The device additional protections to software intellectual property are: