3. System security

The STM32H503xx is designed with a comprehensive set of security features.

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 STM32H503xx devices.

3.1 Key security features

3.2 Resource isolation

3.2.1 Temporal isolation using secure hide protection (HDP)

The embedded flash memory allows an HDP area per watermarked-secure area of each bank (8-Kbyte sector granularity) to be defined. 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 pictured on the figure below.

Figure 3. Flash memory secure HDP area

Diagram showing flash memory secure HDP area with two columns of memory blocks. The left column contains 'User applications', 'Secure flash memory applications', and 'Secure boot code and data (HDP)'. The right column contains 'User applications', 'Secure flash memory applications', and 'Hidden'. A vertical double-headed arrow on the left labels the bottom two blocks as 'Secure area'. An arrow from 'Secure boot code and data (HDP)' points to '1) Execute after reset'. An arrow from 'Secure flash memory applications' in the right column points to '2) Jump to secure code and hide area'. A red禁止 symbol is next to the 'Hidden' block.
Diagram showing flash memory secure HDP area with two columns of memory blocks. The left column contains 'User applications', 'Secure flash memory applications', and 'Secure boot code and data (HDP)'. The right column contains 'User applications', 'Secure flash memory applications', and 'Hidden'. A vertical double-headed arrow on the left labels the bottom two blocks as 'Secure area'. An arrow from 'Secure boot code and data (HDP)' points to '1) Execute after reset'. An arrow from 'Secure flash memory applications' in the right column points to '2) Jump to secure code and hide area'. A red禁止 symbol is next to the 'Hidden' block.

MSv68897V1

Activation of HDP area in user flash memory is related to HDPL1. It means that as soon as HDPL becomes equal or greater to 2, then 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. This extension prevents access to protected sectors under HDPL3.

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

In the STM32H503xx devices, the hardware and software resources used to boot can be isolated. This is called temporal isolation.

It is based on a monotonic counter taking care of only incrementing the levels. When the counter is incremented, the resources of the previous levels become hidden (code and data) For more information, see Section 7: Embedded flash memory (FLASH).

3.2.2 Resource isolation using Cortex privileged mode

The hardware and software resources of STM32H503xx devices can be partitioned so that they are restricted to software running in Cortex privileged mode.

Thanks to this hardware isolation technology, 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, each aligned to a multiple of 32 bytes. Each memory region can be programmed to generate faults when accessed inappropriately by unprivileged software.

3.2.3 Resource isolation using GTZC privilege control

In the STM32H503 devices, the hardware and software resources can be partitioned so that they exist either in the privileged world or in the unprivileged world. Refer to Section 6: Global privilege controller (GTZC).

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 privilege in privileged-aware peripherals

Privileged-aware peripherals also implement privileged-only access mode:

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

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

Regarding privileged protection of the embedded flash memory, the devices offer the following features:

Note: Switching a sector from privileged to unprivileged does not erase the content of the sector. When applicable, an erase or program operation is always available to privileged code, and is available to unprivileged code only for unprivileged sectors or unprivileged memory.

When a DMA channel x is defined as privileged (PRIVx = 1 in GPDMA_PRIVCFGR), special rules apply when accessing the privileged/unprivileged source or destination. Those rules are summarized on the table below.

Table 2. 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 zeros.

By default, after a power-on or a system reset, all PWR registers but PWR_PRIVCFGR, can be read or written in both privileged and unprivileged modes. When the privileged bit NSPRIV is set in PWR_PRIVCFGR, reading and writing the PWR registers are possible only in privileged mode.

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

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

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

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

By default after any backup domain reset, all RTC registers but 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 32: Real-time clock (RTC) chapter for details.

By default after any backup domain reset, all TAMP registers but 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.3 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.3.1 Memory protection unit (MPU)

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

The memory map and the programming of the MPU split memory into up to eight regions.

3.3.2 Embedded flash memory write protection

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

Write-protected sectors can be modified through option byte changes only when PRODUCT_STATE = open.

Note: Bank erase aborts when it contains a write-protected area (WRP or HDP area) For more information, see Section 7.5.6: Write protection.

3.3.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 33: Tamper and backup registers (TAMP) for more details.

Tamper detection sources

The devices support two active input/output pins, which allow one independent active-tamper mesh.

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 the table below.

Table 3. 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}\)), through ADC analog watchdog
itamp87Monotonic counter overflow (generated internally)

Table 3. Internal tampers in TAMP (continued)

Tamper inputNOER bit number in TAMP_CR3Tamper source
itamp98Fault generation for RNG peripheral
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 only erased 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.5.1.

Device secrets are not reset by 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 automatically the erase of secrets.

Tamper detection and low-power modes.

The effect of low-power modes on a tamper detection are summarized on the table below.

Table 4. 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. They remain active only when the clock source is LSE or LSI.
Tamper events cause the device to exit the Standby mode.

3.4 Unique ID

The devices store a 96-bit ID that is unique to each device (see Section 42.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.

3.5 Product life-cycle

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

Figure 4. Device life-cycle security

A state transition diagram for device life-cycle security. It shows states in ovals: Virgin device, STM32 personalized device, Platform, Development platform, Deployed product, Debug authentication Control, RMA product, and Decommissioned product. Transitions are labeled: Chip manufacturing, Vendor manufacturing, User provisioning, Productization, Debug, Full regression, Field return, and Decommissioning. A dashed vertical line separates manufacturing from deployment. A legend shows State as an oval and transition as an arrow. Reference: MSv68899V1.
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 -- "Debug" --> DebugAuth([Debug authentication Control]); DebugAuth -- "Full regression" --> Deployed; Deployed -- "Field return" --> RMA([RMA product]); RMA -- "Decommissioning" --> Decommissioned([Decommissioned product]);
A state transition diagram for device life-cycle security. It shows states in ovals: Virgin device, STM32 personalized device, Platform, Development platform, Deployed product, Debug authentication Control, RMA product, and Decommissioned product. Transitions are labeled: Chip manufacturing, Vendor manufacturing, User provisioning, Productization, Debug, Full regression, Field return, and Decommissioning. A dashed vertical line separates manufacturing from deployment. A legend shows State as an oval and transition as an arrow. Reference: MSv68899V1.

More details on the various phases and associated transitions, found either at the vendor or end-user premises, are summarized in the table below.

Table 5. Main product life-cycle transitions

TransitionsDescription
Device manufacturingSTMicroelectronics creates new STM32 devices, always checking for manufacturing defects. During this process, STM32 is provisioned with ROM firmware.
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 (“production” 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.
Table 5. Main product life-cycle transitions (continued)
TransitionsDescription
User provisioningPlatform vendor prepares an individual platform for development, not to be connected to a production cloud network.
Field returnThe product is returned for analysis to field return centers. Analysis is possible by launching a full regression. Such access requires provisioning the hash of the password provided by the vendor.

3.5.1 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 the provisioning of the product with different distribution models taking care on the code and data provisioned.

Table 6. Typical product life-cycle phases
PRODUCT_STATE
+ DebugState
Debug
(default
configuration)
Comments
OpenDevice openFull availableThis state allows the development of the product, as it provides the debug of the code.
Using the boot pin enables the launch of the bootloader.
ProvisioningDebug partially openedHDPL3This state allows the management of the provisioning of the product (partial or full). It permits the launch, or bootloader to provision the product.
iROT-
Provisioned
Debug partially openedHDPL3This state considers that an immutable root of trust is installed, including its configuration (code, option bytes).
ClosedDebug closedNoDebug + debug authentication controlThis state considers the product configuration finalized. It allows the support of a debug authentication for in-the-field repair (read the dedicated application note).
LockedDebug lockedNoneThis state considers the product configuration finalized. The debug authentication is not permitted. The product is definitively in this state.
RegressionDebug closedNoDebugThis state is a temporal state (but nonvolatile) to manage the full regression to an open state. It removes all user flash-memory code and data including the hide protected areas (HDP).

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

Figure 5. Product life-cycle

Flowchart of the product life-cycle showing states: Open, Provisioning, iRoT-Provisioned, Closed, Locked, and In-the-field return. It includes annotations for development, manufacturing, and field return phases.

The diagram illustrates the product life-cycle across three main phases: Product Development, Product manufacturing, and In-the-field return.

Additional notes and a legend are provided on the right:

Reference: MSv71927V2

Flowchart of the product life-cycle showing states: Open, Provisioning, iRoT-Provisioned, Closed, Locked, and In-the-field return. It includes annotations for development, manufacturing, and field return phases.

To ease the product maintenance (in-the-field), it is recommended 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:

Caution: The user must ensure to provision the HASH of the authentication password before changing the product state from OPEN to any other one (Provisioning, iRoT-Provisioned or Closed).

The user must take care that changing product state to Locked is irreversible so once changed debugging the device is definitively lost.

3.6 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 on the figure below. Starting from a personalized device sold by STMicroelectronics, a vendor A can integrate a portion of hardware and software on a platform A. Platform A can 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 6. Collaborative development principle

A flowchart illustrating the collaborative development principle. It shows the progression from an STM32 personalized device through Vendor A and Vendor B manufacturing to Platform A and Platform B, which are then integrated with platform parts. The process continues through user provisioning, productization, and deployment to a final product, which eventually undergoes decommissioning. A vertical dashed line separates 'User states' and 'Vendor states'.
graph TD
    subgraph Vendor_States [Vendor states]
        Device([STM32 personalized device])
        PA([Platform A])
        PB([Platform B])
        PP1([Platform part])
        PP2([Platform part])
    end

    subgraph User_States [User states]
        DPB1([Development platform B])
        DPB2([Development platform B])
        DP([Deployed product])
        DPDec([Decommissioned product])
    end

    Device -- "Vendor A manufacturing" --> PA
    PA -- "Integrated" --> PP1
    PA -- "Vendor B manufacturing" --> PB
    PB -- "Integrated" --> PP2
    PA -- "User provisioning" --> DPB1
    PB -- "User provisioning" --> DPB2
    PB -- "Productization" --> DP
    DP -- "Decommissioning" --> DPDec

    V_Dashed[ ] --- U_Dashed[ ]
    style V_Dashed fill:none,stroke:none
    style U_Dashed fill:none,stroke:none
  

MSv64455V1

A flowchart illustrating the collaborative development principle. It shows the progression from an STM32 personalized device through Vendor A and Vendor B manufacturing to Platform A and Platform B, which are then integrated with platform parts. The process continues through user provisioning, productization, and deployment to a final product, which eventually undergoes decommissioning. A vertical dashed line separates 'User states' and 'Vendor states'.

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

3.6.1 Software intellectual property protection

As described in Section 3.5.1, the hardware PRODUCT_STATE mechanism automatically controls the accesses to secrets provisioned in the device. The protection of these secrets is defined in the table below.

Table 7. Software intellectual property protection with PRODUCT_STATE

PRODUCT_STATE
protection level
Secrets protection
OpenDevice openNo special protections.
ProvisioningDebug partially openedAll areas protected with HDPL1 and HDPL2 cannot be dumped, debugged, or traced. The iROT can set up a higher level of protection.
iROT-ProvisionedDebug partially openedAll areas protected with HDPL1 and HDPL2 cannot be dumped, debugged, or traced. The iROT can set up a higher level of protection.
ClosedNo debugNo debug possible except through debug authentication after a full regression.
LockedNo debugAll data and code stored in the device or encrypted in external flash memory cannot be dumped clear-text, debugged or traced.

3.6.2 Other software intellectual property protections

The device additional protections to software intellectual property are: