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 STMicroelectronics secure service authenticated and decrypted by the immutable RSS code stored in the device. The SFI allows secure and counted installation of OEM firmware in an untrusted production environment (such as 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”.


a. Available only on STM32H543/553xx devices.

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 STM32H533/553/573xx offer 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. For more information, refer to the user manual UM3065 “Getting started with STM32CubeH5 for STM32H5 series”.

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

This section describes the features specifically designed for 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 system flash (STiRoT) and proprietary boot entry (OEMiRoT). This selection is possible only for products embedding cryptographic acceleration (STM32H533/553/573xx), when TrustZone is enabled (TZEN = 0xB4).

When TrustZone is enabled and 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 SECBOOTADD option bytes.

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

When TrustZone is disabled (TZEN = 0xC3) and 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 NSBOOTADD option bytes.

When TrustZone is disabled and NSBOOT_LOCK option bit is set, the device unique boot entry is the unmodifiable nonsecure address defined by 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 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 STiRoT (immutable root of trust), to handle the secure provisioning, secure boot, secure updates of the first updatable level of the platform.

For more information, refer to AN6007 “Getting started with STiRoT (ST immutable Root of Trust) for STM32H5 MCUs”.

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 is 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. For more information, refer to the user manual UM3065 “Getting started with STM32CubeH5 for STM32H5 series”.

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

Figure 5. Secure/nonsecure partitioning using TrustZone technology

Diagram showing secure/nonsecure partitioning using TrustZone technology. It illustrates two worlds: Nonsecure world and Secure world. The Nonsecure world contains Applications and Privileged system services. The Secure world contains Application RoT and Root of trust services. Both worlds have access to Peripherals and I/Os, Memory (internal, external), and CPU time. An 'Init' arrow points to the Secure world. A legend indicates that white boxes represent the Nonsecure world and hatched boxes represent the Secure world. The diagram is labeled MSv68892V1.

The diagram illustrates the partitioning of system resources into a Nonsecure world and a Secure world. At the top, an 'Init' arrow points to the Secure world. The Nonsecure world (white boxes) includes Applications and Privileged system services. The Secure world (hatched boxes) includes Application RoT and Root of trust services. A double-headed arrow indicates interaction between the two worlds. Both worlds have access to shared resources at the bottom: Peripherals and I/Os, Memory (internal, external), and CPU time. A legend at the bottom left shows a white square for 'Nonsecure world' and a hatched square for 'Secure world'. The diagram is labeled MSv68892V1.

Diagram showing secure/nonsecure partitioning using TrustZone technology. It illustrates two worlds: Nonsecure world and Secure world. The Nonsecure world contains Applications and Privileged system services. The Secure world contains Application RoT and Root of trust services. Both worlds have access to Peripherals and I/Os, Memory (internal, external), and CPU time. An 'Init' arrow points to the Secure world. A legend indicates that white boxes represent the Nonsecure world and hatched boxes represent the Secure world. The diagram is labeled MSv68892V1.

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 6, 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 Secure state.

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

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

Figure 6: Sharing memory map between CPU in secure and nonsecure state. The diagram shows two side-by-side memory maps: 'Nonsecure memory view' and 'Secure memory view'. The Nonsecure view shows regions from 0xFFFFFFFF down to 0x00000000, including System region, System control and debug, External peripherals, External memories, Periph-NS, SRAM-NS, SRAM-S, Flash-NS, and Flash-S. The Secure view shows a similar structure but with some regions marked as 'hidden' (MPU-NS*, SCB-NS*, SysTick-NS*, Periph-S, SRAM-S, Flash-S) and others as aliased (MPU-S, SCB-S, SysTick-S, ITM / DWT / FBP). A dotted line connects the 'System region' in the Nonsecure view to the 'hidden' MPU-NS* region in the Secure view.
Address RangeNonsecure memory viewSecure memory view
0xFFFFFFFF - 0xF0000000System regionhidden (MPU-NS*)
0xF0000000 - 0xE0000000System control and debughidden (SCB-NS*)
0xE0000000 - 0xA0000000External peripheralshidden (SysTick-NS*)
0xA0000000 - 0x60000000External memoriesDEBUG
0x60000000 - 0x40000000Periph-NShidden (SAU)
0x40000000 - 0x20000000SRAM-NSMPU-NS, MPU-S
0x20000000 - 0x00000000SRAM-S, Flash-NS, Flash-SSCB-NS, SCB-S, SysTick-S, ITM / DWT / FBP

(*) Aliased addresses MSv68893V1

Figure 6: Sharing memory map between CPU in secure and nonsecure state. The diagram shows two side-by-side memory maps: 'Nonsecure memory view' and 'Secure memory view'. The Nonsecure view shows regions from 0xFFFFFFFF down to 0x00000000, including System region, System control and debug, External peripherals, External memories, Periph-NS, SRAM-NS, SRAM-S, Flash-NS, and Flash-S. The Secure view shows a similar structure but with some regions marked as 'hidden' (MPU-NS*, SCB-NS*, SysTick-NS*, Periph-S, SRAM-S, Flash-S) and others as aliased (MPU-S, SCB-S, SysTick-S, ITM / DWT / FBP). A dotted line connects the 'System region' in the Nonsecure view to the 'hidden' MPU-NS* region in the Secure view.

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

Figure 7. Secure world transition and memory partitioning

Diagram illustrating secure world transition and memory partitioning between Nonsecure and Secure memory worlds.

The diagram shows two main memory regions: Nonsecure memory on the left and Secure memory on the right. Within Nonsecure memory is a 'Nonsecure application' block. Within Secure memory are a 'Secure entry point' block (shaded grey) and a 'Secure library' block. A 'Nonsecure callable' region is also shown within Secure memory, containing the 'Secure entry point'. Arrows indicate the flow of control: a 'call' arrow from the Nonsecure application to the Secure entry point; a 'return' arrow from the Secure entry point back to the Nonsecure application; a 'call / branch' arrow from the Secure entry point to the Secure library; and a 'return' arrow from the Secure library back to the Nonsecure application.

MSv68894V1

Diagram illustrating secure world transition and memory partitioning between Nonsecure and Secure memory worlds.

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

Table 8. 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 8.

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 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 8. Global TrustZone framework and TrustZone awareness

Diagram of the Global TrustZone framework and TrustZone awareness. The diagram shows a 'Device boundary' containing several components. At the top are 'Other bus master', 'CPU' (containing 'SAU+IDAU' and 'MPU'), and 'DMA'. Below them is a large pink-shaded area representing the AHB/APB interconnect. To the right of this area are 'Flash memory', 'SRAM', and 'OTFDEC'. Below the interconnect are four 'Peripheral' blocks, with the rightmost one being TrustZone-aware (cross-hatched). At the bottom are two 'I/O' blocks. A thick blue line, representing the 'Global TrustZone framework', forms a large L-shape, connecting the 'Other bus master' to the interconnect and then to the peripherals. A legend at the bottom left identifies the blue line as the 'Global TrustZone framework' and the cross-hatched pattern as 'TrustZone-aware peripherals'. External memory blocks ('External flash memory' and 'External SRAM') are connected to the OTFDEC and SRAM respectively.

Device boundary

Other bus master

Config

CPU

SAU+IDAU

MPU

DMA

Flash memory

SRAM

OTFDEC

External flash memory

External SRAM

Peripheral

Peripheral

Peripheral

Peripheral

I/O

I/O

Global TrustZone framework

TrustZone-aware peripherals

MSv68895V1

Diagram of the Global TrustZone framework and TrustZone awareness. The diagram shows a 'Device boundary' containing several components. At the top are 'Other bus master', 'CPU' (containing 'SAU+IDAU' and 'MPU'), and 'DMA'. Below them is a large pink-shaded area representing the AHB/APB interconnect. To the right of this area are 'Flash memory', 'SRAM', and 'OTFDEC'. Below the interconnect are four 'Peripheral' blocks, with the rightmost one being TrustZone-aware (cross-hatched). At the bottom are two 'I/O' blocks. A thick blue line, representing the 'Global TrustZone framework', forms a large L-shape, connecting the 'Other bus master' to the interconnect and then to the peripherals. A legend at the bottom left identifies the blue line as the 'Global TrustZone framework' and the cross-hatched pattern as 'TrustZone-aware peripherals'. External memory blocks ('External flash memory' and 'External SRAM') are connected to the OTFDEC and SRAM respectively.

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 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 to 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 9.

Table 9. MPCWMx resources

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

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

Table 10. MPCBBx resources (STM32H562/563/573xx devices)

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

Table 11. MPCBBx resources (STM32H523/533xx devices)

MemoryMPC resourceType of filteringMemory sizeBlock sizeNumber of super-blocksDefault security
SRAM1GTZC1_MPCBB1Block based, managing security and privilege128 KB512(1) bytes8Secure privileged(2)
SRAM2GTZC1_MPCBB280 KB5
SRAM3GTZC1_MPCBB364 KB4
  1. 1. Blocks are grouped in super-blocks of 32 consecutive blocks, to manage the configuration locking.
  2. 2. Assuming TrustZone is activated on the device, nonsecure unprivileged otherwise.
Table 12. MPCBBx resources (STM32H543/553xx devices)
MemoryMPC resourceType of filteringMemory sizeBlock sizeNumber of super-blocksDefault security
SRAM1GTZC1_MPCBB1Block based, managing security and privilege128 KB512 bytes(1)8Secure privileged(2)
SRAM2GTZC1_MPCBB280 KB5-
SRAM3GTZC1_MPCBB396 KB6-
  1. 1. Blocks are grouped in super-blocks 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 accesses 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 accesses 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 9, 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.


a. Available only on STM32H543/553xx devices.

Figure 9. Flash memory TrustZone protections Diagram of Flash memory TrustZone protections showing User Flash memory and Read-only system Flash memory partitions under TrustZone disabled and TrustZone enabled configurations.

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

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 under TrustZone disabled and TrustZone enabled configurations.

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/nonvolatile 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 (OTFDEC)

When the TrustZone security is enabled (TZEN = 0xB4), the OTFDEC can be initialized only by 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 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 13 summarizes these security options available in each DMA channel.

Table 13. 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 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 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 51: 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 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 52: 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 14.

Table 14. 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 15 is blocked by hardware when the peripheral is nonsecure and the I/O is secure.

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

PeripheralAnalog function(1)InputOutput
ADC12ADC12_INy (y = 1 to 17)X-
ADC3(2)ADC3_INPX-
COMP1/2(2)COMP1/2_INP/INMX-
  1. 1. Used to find the I/O corresponding to the signal/function on the package (refer to the product datasheet).
  2. 2. Available only on STM32H543/553xx devices.

Finally, regarding GPIO and security, Table 16 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 non secure.

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 16, 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 16. Nonsecure peripheral functions that can be connected to secure I/Os

PeripheralSignal(1)InputOutputHow to set the peripheral or function as secure
DACDAC1_OUTx (x = 1, 2)-XSet DAC1SEC in GTZC1_TZSC_SECCFGR1.
UCPDUCPD1_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. 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 18: 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 accesses to its control registers as described in Table 17.

Table 17. 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 debugger is converted to nonsecure access in the device.

Refer to Section 66.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)

When the TrustZone security is enabled, 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 hide protection principle is shown in Figure 10.

Figure 10. Flash memory secure HDP area

Diagram showing flash memory secure HDP area with two banks. Each bank has 'User applications' at the top. Below that is a 'Secure area' containing 'Secure flash memory applications' and 'Secure boot code and data (HDP)'. In the right bank, the 'Secure flash memory applications' section is marked with a red 'no entry' symbol and labeled 'Hidden'. An arrow labeled '2) Jump to secure code and hide area' points to this hidden section. At the bottom of the left bank, an arrow labeled '1) Execute after reset' points to the 'Secure boot code and data (HDP)' section. The diagram is labeled MSv68897V1 in the bottom right corner.
Diagram showing flash memory secure HDP area with two banks. Each bank has 'User applications' at the top. Below that is a 'Secure area' containing 'Secure flash memory applications' and 'Secure boot code and data (HDP)'. In the right bank, the 'Secure flash memory applications' section is marked with a red 'no entry' symbol and labeled 'Hidden'. An arrow labeled '2) Jump to secure code and hide area' points to this hidden section. At the bottom of the left bank, an arrow labeled '1) Execute after reset' points to the 'Secure boot code and data (HDP)' section. The diagram is labeled MSv68897V1 in the bottom right corner.

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 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 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 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 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 18) apply when accessing privileged/unprivileged source or destination.

Table 18. 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 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 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 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 PRIV bit is cleared in 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 51: 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 52: 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 WLCSP80).

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

Table 19. 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 accesses 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.

a. Available only on STM32H543/553xx devices.

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 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 effect of low-power modes on a tamper detection are summarized in Table 20.

Table 20. 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.


a. Available only on STM32H543/553xx devices.

Figure 11 shows how 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 11 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 11. Key management principle

A block diagram titled 'Figure 11. Key management principle' showing the flow of keys between various components. A 'Secure AES' block contains 'Hardware key derivation' (receiving 'Peripheral usage' and an input from 'Embedded non-volatile storage (software secret)') and 'Derived hardware unique key'. The 'Derived hardware unique key' leads to 'AES with DPA' (which also receives a 'Hardware key' from 'Embedded volatile storage (tamper resistant)'). 'AES with DPA' outputs a 'Key' to 'OTFDEC' and an 'Hw Key' to 'AES without DPA'. 'Embedded volatile storage (tamper resistant)' also provides a 'key' to 'AES without DPA'. 'Embedded non-volatile storage' provides a 'key' to 'AES without DPA'. A legend indicates solid arrows for 'Hardware transfer of key' and dashed arrows for 'Software transfer of key'. The diagram is labeled MSv68898V1.
A block diagram titled 'Figure 11. Key management principle' showing the flow of keys between various components. A 'Secure AES' block contains 'Hardware key derivation' (receiving 'Peripheral usage' and an input from 'Embedded non-volatile storage (software secret)') and 'Derived hardware unique key'. The 'Derived hardware unique key' leads to 'AES with DPA' (which also receives a 'Hardware key' from 'Embedded volatile storage (tamper resistant)'). 'AES with DPA' outputs a 'Key' to 'OTFDEC' and an 'Hw Key' to 'AES without DPA'. 'Embedded volatile storage (tamper resistant)' also provides a 'key' to 'AES without DPA'. 'Embedded non-volatile storage' provides a 'key' to 'AES without DPA'. A legend indicates solid arrows for 'Hardware transfer of key' and dashed arrows for 'Software transfer of key'. The diagram is labeled MSv68898V1.

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:

the OBK-HDPLx (temporal isolation counter), the EPOCH (regression counter allowing antireplay protection) and key use state (KMOD).

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 67.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 crypto engine processing times, refer to their respective sections in the reference manual.

3.10.1 Crypto engines features

Table 21 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 41: Public key accelerator (PKA) for more details.

Table 21. 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-3(4)SHA3-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(5)RSAIETF RFC 8017
NIST SP800-56B
Up to 4160RSAES-OAEP
Signature(5) 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. Available only on STM32H543/553xx devices.
  5. 5. 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 co-processor (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 electronic code book (ECB), cipher block chaining (CBC), (CTR), (GCM), (CCM), (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 38: Secure AES coprocessor (SAES).

3.10.3 On-the-fly decryption engine (OTFDEC)

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 42: On-the-fly decryption engine (OTFDEC).

3.11 Product life cycle

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

Figure 12. Device life cycle security

Figure 12: Device life cycle security diagram. The diagram shows the lifecycle of a device from 'Virgin device' to 'Decommissioned product'. A vertical dashed line separates the 'Vendor' side (left) from the 'End-user' side (right). States are represented by ovals: Virgin device, STM32 personalized device, Platform, Development platform, Deployed product, Debug authentication Control, RMA product, and Decommissioned product. Transitions are labeled: 'Chip manufacturing' (Virgin to STM32), 'Vendor manufacturing' (STM32 to Platform), 'User provisioning' (Platform to Development platform), 'Productization' (Platform to Deployed product), 'Field return' (Deployed product to RMA product), 'Debug' (Deployed product to Debug authentication Control), and 'Full regression' (Debug authentication Control back to Deployed product). A legend at the bottom shows 'State' in an oval and 'transition' as an arrow.
graph TD
    Virgin([Virgin device]) -- "Chip manufacturing" --> STM32([STM32 personalized device])
    STM32 -- "Vendor manufacturing" --> Platform([Platform])
    Platform -- "User provisioning" --> DevPlatform([Development platform])
    Platform -- "Productization" --> Deployed([Deployed product])
    Deployed -- "Field return" --> RMA([RMA product])
    RMA -- "Decommissioning" --> Decom([Decommissioned product])
    Deployed -- "Debug" --> DebugAuth([Debug authentication Control])
    DebugAuth -- "Full regression" --> Deployed
  

MSv68899V1

Figure 12: Device life cycle security diagram. The diagram shows the lifecycle of a device from 'Virgin device' to 'Decommissioned product'. A vertical dashed line separates the 'Vendor' side (left) from the 'End-user' side (right). States are represented by ovals: Virgin device, STM32 personalized device, Platform, Development platform, Deployed product, Debug authentication Control, RMA product, and Decommissioned product. Transitions are labeled: 'Chip manufacturing' (Virgin to STM32), 'Vendor manufacturing' (STM32 to Platform), 'User provisioning' (Platform to Development platform), 'Productization' (Platform to Deployed product), 'Field return' (Deployed product to RMA product), 'Debug' (Deployed product to Debug authentication Control), and 'Full regression' (Debug authentication Control back to Deployed product). 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 22.

Table 22. 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.
Table 22. Main product life cycle transitions (continued)
TransitionsDescription
Full progressionThe 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.

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 (STiRoT: ST immutable root of trust), or OEM boot implementation (OEMiRoT: 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 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 of the code and data provisioned.

Table 23. 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 STiRoT.
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.

Table 23. Typical product life cycle (continued)phases (continued)

PRODUCT_STATE + DebugStateDebug (default configuration)Comments
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 supporting debug authentication for in-the-field repair (read the dedicated application note).
LockedDebug lockedNoneAssumes the product configuration as finalized. Debug authentication is not permitted. The product is definitively in this state. Nevertheless, the field return procedure allows launching 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.

STMicroelectronics does not perform analysis on defective parts in closed or locked states.

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

Figure 13. PRODUCT_STATEs (simplified TrustZone activated view)

Flowchart of PRODUCT_STATEs (simplified TrustZone activated view) showing transitions between Open, Provisioning, iROT-Provisioned, TZ-Closed, Closed, and Locked states.
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]
  

Legend:

MSv69900V1

Flowchart of PRODUCT_STATEs (simplified TrustZone activated view) showing transitions between Open, Provisioning, iROT-Provisioned, TZ-Closed, Closed, and Locked states.

Figure 14. PRODUCT_STATES (full TrustZone activated view)

Flowchart of PRODUCT_STATES showing the lifecycle from Product development to In-the-field return. It includes states like Open, Provisioning, iROT-Provisioned, TZ-Closed, Closed, Locked, NS-Regression, Debug authentication, Regression, and DebugConstrained. A legend on the right explains the color coding and specific state purposes.

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

Transitions: Open leads to Provisioning. Provisioning leads to iROT-Provisioned. iROT-Provisioned leads to TZ-Closed. TZ-Closed leads to Closed and Locked. Closed leads to Debug authentication. Debug authentication leads to NS-Regression, Regression, or DebugConstrained. DebugConstrained leads back to Debug authentication. NS-Regression and Regression lead back to Open. DebugConstrained leads back to TZ-Closed.

MSv69901V2

Flowchart of PRODUCT_STATES showing the lifecycle from Product development to In-the-field return. It includes states like Open, Provisioning, iROT-Provisioned, TZ-Closed, Closed, Locked, NS-Regression, Debug authentication, Regression, and DebugConstrained. A legend on the right explains the color coding and specific state purposes.

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 Arm PSA ADAC specification. It allows controlling that the host has a trusted certificate with permissions. Permissions definition allows a lot of flexibility, 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 informations 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), we recommend to take benefit of the feature called debug authentication control. This enables the maintenance of product activating the debug and makes 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 configuring the platform, the host tools and to generate certificates.

3.12 Software intellectual property protection and collaborative development

Thanks to 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 15. 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 15. Collaborative development principle

A flowchart titled 'Figure 15. Collaborative development principle' showing the lifecycle of a system. A vertical dashed line separates 'User states' (left) and 'Vendor states' (right). In 'Vendor states', the flow starts with 'STM32 personalized device', followed by 'Vendor A manufacturing' leading to 'Platform A', then 'Vendor B manufacturing' leading to 'Platform B'. 'Platform A' is linked to a 'Platform part' via an 'Integrated' arrow. 'Platform B' is also linked to a 'Platform part' via an 'Integrated' arrow. In 'User states', 'Platform A' leads to 'Development platform B' via 'User provisioning'. 'Platform B' leads to 'Development platform B' via 'User provisioning'. 'Development platform B' leads to 'Deployed product' via 'Productization'. 'Deployed product' leads to 'Decommissioned product' via 'Decommissioning'. The code 'MSv64455V1' is in the bottom right corner.
graph TD; subgraph Vendor_states [Vendor states]; V1[STM32 personalized device] -- "Vendor A manufacturing" --> P1[Platform A]; P1 -- "Vendor B manufacturing" --> P2[Platform B]; P1 -- "Integrated" --> PP1[Platform part]; P2 -- "Integrated" --> PP2[Platform part]; end; subgraph User_states [User states]; DP1[Development platform B]; DP2[Development platform B]; DP3[Deployed product]; DP4[Decommissioned product]; end; P1 -- "User provisioning" --> DP1; P2 -- "User provisioning" --> DP2; DP1 -- "Productization" --> DP3; DP3 -- "Decommissioning" --> DP4;
A flowchart titled 'Figure 15. Collaborative development principle' showing the lifecycle of a system. A vertical dashed line separates 'User states' (left) and 'Vendor states' (right). In 'Vendor states', the flow starts with 'STM32 personalized device', followed by 'Vendor A manufacturing' leading to 'Platform A', then 'Vendor B manufacturing' leading to 'Platform B'. 'Platform A' is linked to a 'Platform part' via an 'Integrated' arrow. 'Platform B' is also linked to a 'Platform part' via an 'Integrated' arrow. In 'User states', 'Platform A' leads to 'Development platform B' via 'User provisioning'. 'Platform B' leads to 'Development platform B' via 'User provisioning'. 'Development platform B' leads to 'Deployed product' via 'Productization'. 'Deployed product' leads to 'Decommissioned product' via 'Decommissioning'. The code 'MSv64455V1' is in the bottom right corner.

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 accesses to secrets provisioned in the device. The protection of these secrets are defined in Table 24.

Table 24. 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 16 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 code, stored in external NOR flash memory.

Figure 16. 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) and various communication interfaces (JTAG, I3C, USART, SPI, I2C, FDCAN, USB). The I3C interface is highlighted with a blue arrow and the text "I3C added". The STM32 contains SRAM2 (Secure bootloader part II), ROM (Secure bootloader part I), SRAM 1, Option bytes, and OTF DEC. The Host (1) is connected to the communication interfaces. The ROM (2) is connected to SRAM2 (3) and SRAM 1. The Option bytes are connected to the OTF DEC (4). The OTF DEC (4) is connected to an external Flash memory (6) via an Octo SPI interface. The ROM (2) also has a connection to the external Flash memory (6) via an Octo SPI interface.

Step 2: Secure Boot

This step shows the STM32 microcontroller with an internal Flash memory containing an Application and a Secure boot section. The Secure boot section is connected to the OTF DEC (1). The OTF DEC (1) is connected to an external Flash memory (2) via an Octo SPI interface. A tamper signal is shown as a dashed line connecting the Secure boot section 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: