1. What is SFIx

OEM product can embed external Flash additionally to STM32 internal Flash.
The SFIx solution provides security when programming STM32 devices and external Flash in a non-trusted facility owned by a Contract Manufacturer (CM).
The SFIx solution is the same solution as the SFI solution, it also allows the external Flash programming.

Info white.png Information
For details on SFIx, please refer to AN4992 STM32 MCUs secure firmware install (SFI) overview

2. External Flash memory programming principle

The OEM external Flash content must be encrypted to ensure the OEM data confidentiality.

External Flash crypto is handled by the OTFDEC peripheral. This peripheral can encrypt and decrypt on-the-fly external firmware and data stored in external Flash memory connected to STM32 microcontrollers through the OCTOSPI interface. The OTFDEC can handle up to 4 regions of external Flash memory, each one with its own dedicated Key. The OTFDEC uses standard AES CTR 128-bit algorithm for encryption and decryption operations. Refer to the OTFDEC section of the STM32 microcontroller reference manual to get more insight.

The STM32 receives encrypted external firmware, decrypts them with the SFI OEM key, and re-encrypts them with an external Flash memory AES key common to all devices to be programmed or with a unique external Flash memory AES key per device.
The STM32 stores the encryption result within SRAM.
Then an external Flash memory loader takes the previous result and program it within the external Flash memory.

Warning white.png Warning
The external Flash memory programming is under the responsibility of OEM, meaning that OEM must use an external Flash memory loader that fits its external Flash memory specificities.

ST does not provide such external Flash memory loader, except for demonstration purpose on ST boards supporting external Flash memory.


SFIx overview.png


Info white.png Information
The SFIx cannot handle internal Flash memory in a first sequence and external in a separate independent one: when SFIx handles external firmware, it must first handle internal firmware that in turn enable the decryption at runtime of the external firmware.

Thus, the internal Flash firmware must enable the read/fetch of data/code within the external Flash memory, using the OTFDEC and the OCTOSPI peripherals.

3. External Flash memory encryption with global key

This section focuses on the external Flash memory AES key common to all devices. In this case, the external Flash memory AES key is provided by the OEM and is programmed in the STM32 via the SFIx.


SFIx global key overview.png

4. External Flash memory encryption with chip unique key

This section focuses on the external Flash memory AES key unique per chip. In this case, the OEM requests the STM32, via the SFIx procedure, to generate the external Flash memory AES key and to program it at a given address in the STM32.


SFIx chip specific key overview.png

5. References