on
2024-05-21
08:00 AM
- edited on
2024-05-23
03:14 AM
by
Laurids_PETERSE
Protecting the firmware is a paramount concern in the design and deployment of embedded systems. STM32 microcontrollers, which are integral to countless applications, employ various mechanisms to safeguard against unauthorized access and tampering. In this article, we delve into the differences of the solution offered on the STM32H5 series and the STM32U5 series, highlighting the nuances of hide protection (HDP) and readout protection (RDP).
The RDP and HDP features are pivotal to the STM32Trust ecosystem, enhancing the security framework that encompasses the entire life cycle of STM32 devices. RDP plays a crucial role in ensuring the integrity and authenticity of firmware during secure boot and update processes, while also protecting software IP against unauthorized access. HDP contributes significantly to the isolation aspect, creating a barrier between trusted and nontrusted application segments and securing sensitive data storage an ensuring also the integrity and authenticity in the STM32H5 series. Together, these features underpin the robust security measures such as secure manufacturing and device and application life cycle management. This reinforces the STM32Trust's commitment to safeguarding applications against a wide array of security threats.
RDP is a long-standing security feature in STM32 microcontrollers, providing several levels of protection.
When activated, it forbids any external access to the flash content, so it impacts mainly the debuggability of the MCU.
In the STM32U5 series, the RDP feature is more evolved than the older series, introducing the possibility of keyed regression, which makes it more practical to use. With the introduction of TrustZone®, we get an additional transition level called RDP L0.5. Here we explain the access permission of each level and transition and possibilities for the STM32U5 series.
The STM32U5 defines product states based on RDP levels to ease the transition
RDP Level 0
RDP Level 1
RDP Level 2
With the introduction of a new level for the cases where TrustZone® is enabled we can limit access to the secure world. Further, give access to the non-secure world making it possible to develop a product with different manufacturing contributors ensuring a secure non-accessible root.
RDP Level 0.5
RDP Level 0.5 applies to STM32 microcontrollers with TrustZone® enabled, securing the trusted domain while keeping the non-trusted domain accessible. This intermediate security state is reversible through a mass erase.
RDP mechanism offers the possibility for keyed regression and reopening of the product throw the provisioned OEM1 and OEM2 keys, which offer a level of flexibility while developing as well as ensuring the security of the firmware and sensitive data.
The RDP mechanism is specific to the microcontroller's flash memory and does not extend to a system-on-chip (SoC) level. It offers a binary choice between unprotected (level 0) and protected states (level 1 and level 2), with the highest level being irreversible (unless keyed regression when the OEM2 key is provisioned.) Thus, hindering certain postemployment activities such as failure analysis.
The embedded flash memory provides a feature to define a hidden zone that can be established within each bank's watermarked-secure area, with a granularity of 8-Kbyte sectors. This HDP zone can contain code, associated data, and keys, which can be concealed from access after the system boots up and remains hidden until the system is reset. The concept of this hide protection mechanism is illustrated in the figure below from RM0456.
When the HDPxEN and HDPx_ACCDIS bits (x = 1, 2) are set, data read, write, and
instruction fetch on the area defined by SECWMx_PSTRT and HDPx_PEND option bytes, are denied until the next device reset.
Bank erase aborts when it contains a write-protected area (WRP or HDP area).
The HDP area can be resized by a secure application if the area is not hidden, and if RDP level ≠ 2
The STM32H5 series departs from the RDP mechanism in favor of a product life cycle approach to ensure the debuggability of the system according to the product state, which includes the following:
Product state transitions can be divided in two cases depending on the availability of the TrustZone® isolation feature on the microcontroller. In fact, we add another a dedicated state with TrustZone®. This is explained in detail below.
Password presentation: Allows the customer to present a password via JTAG/SWD to return to the open state.
This new mechanism provides a nuanced and secure method for managing the device's security throughout its life cycle. With the ability to lock and unlock states as needed, this is a key improvement over the legacy RDP feature across older families in which a miss manipulation of the option bytes can lead to a dead-locked chip.
In the STM32H5 series, HDP is extended with more defined levels ensuring different isolated BOOT stages. The hardware and software resources used to boot can be isolated. This is called temporal isolation.
HDP approach and implementation on the STM32H5 series is different from the HDP feature found in the 5 series here are the main features of HDP on the H5 series:
Unlike RDP's binary approach, HDP offers three levels, each corresponding to different stages of the secure boot process and user accessibility.
The STM32H5 series features five secure storage areas, alternatively known as option-byte Key (OBKeys) areas or secure key storage zones. These areas are versatile, suitable for housing not only keys but also any confidential data. Each area corresponds to a distinct level of temporal isolation, denoted as HDPL. Users have the option to encrypt the data stored within these areas, although this feature is exclusive to the STM32H533 and STM32H573 models. For the STM32H523 and STM32H56x models, encryption details are provided in a specific chapter on secure storage for non-crypto parts.
Below is an overview of the secure storage areas and their attributes:
It is important to note that a full regression process erases all secure storage areas except for HDPL0, which is exclusively reserved by STMicroelectronics and remains intact. A partial regression, or NS-Regression, only erases the non-secure storage at HDPL3NS. Furthermore, in the event of tamper detection, the Device Hardware Unique Keys (DHUKs) become inoperative until the next reset. If the secure storages' contents are encrypted, they will be inaccessible after a tamper event, although not erased. The appropriate response to a tamper event should be executed via the interrupt handler.
The temporal isolation provided by the HDP feature is the piler of the boot mechanism on the STM32H5 series. Each level of HDP can be associated with a stage of the boot stages, as depicted in the following figure below.
The STM32U5 and STM32H5 series showcase the evolution of security through the integration of RDP and HDP, tailored to support the product life cycle. The STM32U5 series combines RDP with HDP to offer a robust, dual-layer protection throughout the product's life cycle. Meanwhile, the STM32H5 series introduces a product state-driven HDP mechanism, enhancing flexibility and control over firmware security. These developments reflect a commitment to providing advanced security solutions that cater to the dynamic needs of product development and deployment.
Reference manual: STM32H503 line Arm®-based 32-bit MCUs
Reference manual: STM32H523/33xx, STM32H562/63xx, and STM32H573xx Arm®-based 32-bit MCUs
Reference manual: STM32U5 Series Arm®-based 32-bit MCUs
ST Wiki: Secure boot for STM32H5