1. Article purpose[edit | edit source]
The main purpose of this article is to present how to use the Hardware Unique Key (HUK) on the STM32MPU platforms.
2. HUK overview[edit | edit source]
The Hardware Unique Key is a symmetric encryption key stored in the OTP of the platform.
The HUK prevents any hacker attempts access the data or clone them to use it on another chip. The HUK is mandatory to manage a secure storage.
In most cases, it is recommended to use different keys for several use cases to prevent hackers to access all encrypted data if one key is found.
Hence, HUK must not be used directly. Instead, it is best practice to use keys derived from the HUK (DHUK). The HUK is also called Root HUK because it is used as a root key for subkey derivation.
2.1. HUK: Hardware protected[edit | edit source]
On STM32MP13xC/F lines
, STM32MP21xC/F lines
, STM32MP23xC/F lines
and STM32MP25xC/F lines
, STMicroelectronics provisions a root HUK in the OTP fuses. These OTP fuses are protected and cannot be read through the BSEC IP.
The OTP fuses storing the RHUK are directly wired to SAES.
SAES derives internally a key from the RHUK : DHUK.
Thanks to that mechanism, different DHUK that depends on the privilege level, key selection, key selected mode, the chaining mode, and on the requester CPU execution domain (secure/non secure) can be generated.
2.2. HUK: Software implementation[edit | edit source]
On STM32MP15x lines
, STMicroelectronics does not pre-provision a RHUK. It is a customer choice to define and provision one in the OTP.
The provisioning can be done with the fuse command in U-Boot, with STM32CubeProgrammer or during secure manufacturing.
It is possible to use software algorithms to derive a key from the RHUK provided by the customer.
3. Software APIs[edit | edit source]
3.1. OP-TEE API[edit | edit source]
Check the dedicated Hardware unique key management in OP-TEE page.
3.2. TF-M API[edit | edit source]
Check How to manage keys and secrets in TF-M page, and especially the HUK usage chapter.
4. References[edit | edit source]