Dear NXP Engineers,
We are currently developing an automotive ECU based on the S32K328, with plans to utilize the HSE (Hardware Security Engine) to provide AES-CMAC services for SecOC (Secure Onboard Communication) protection.
During the current development phase, we have successfully installed the HSE firmware and verified CMAC functionality on our prototypes using a debugger. We are using the S32K358 HSE Firmware version 0.2.40.0 RTM in "FULL_MEM" mode.
Given the small number of prototypes, our software engineers have been performing the installation—loading the firmware, issuing commands, resetting the device, and verifying the results—manually. However, for mass production, these steps must be automated via production tooling. We would like to clarify NXP’s recommended production workflow to establish clear responsibilities among our customers, manufacturing facilities, and contract manufacturers (EMS).
Specifically, we have the following questions:
1. At which stage of the production process is the HSE firmware typically installed?
Is it usually performed during the initial software flashing or the security initialization phase? Are there any specific sequence constraints regarding the installation of the bootloader, the application software, the injection of production keys, the advancement of the device lifecycle, and the restriction of debug interfaces?
2. Which entity is typically responsible for this process?
According to NXP’s recommended mass-production workflow, is this task generally handled by the ECU manufacturer (Tier 1) or their EMS partner? Does NXP offer an option for pre-installed HSE firmware or authorized pre-flashing for the S32K328? If so, how can we verify the delivered firmware version, mode, and security configuration status?
3. Are there any official examples or user guides for mass-production HSE installation on the S32K328?
We aim to automate the entire process—identifying the current state, programming UTEST flags, downloading the firmware image, performing a reset, and verifying the HSE status and version—so that the production test system can automatically determine the outcome without requiring manual intervention (such as using an IDE or modifying watch variables).
4. How should the functional verification of cryptographic algorithms be structured for mass production?
We understand that some CMAC demonstration procedures may format the key directory. What is the recommended approach for verifying algorithm functionality during factory testing—after production keys have been injected—without compromising the existing key directory or the keys themselves? How should programming files (images) be created? Is there any documentation or a defined procedure available?
We would like to clarify the production stages and prerequisites for the following operations: HSE firmware installation, key directory and production key configuration, and the setup of device lifecycle states and debug permissions.
Could you please provide relevant reference materials, example projects, or specific sections of the documentation? Thank you.
Hi @adalovelace
HSE installation and provisioning can be integrated into the production process in several different ways, and customers usually have their own requirements regarding programming, key provisioning, security configuration, and manufacturing responsibilities.
For this reason, there is no single production procedure that would fit every project. The flow below is intended to provide a general idea of how the process is commonly structured and which dependencies should be considered, rather than to define an exact sequence that must be followed.
1. The HSE firmware is normally installed during the initial device-programming. The production tool can program the encrypted HSE firmware image together with the bootloader and application images. After reset, SBAF authenticates and installs the HSE firmware into the secure flash area.
Recently I wrote this detailed description how to modify a project in order to install the firmware via IVT method:
Then you can verify that HSE initialization completed successfully and read the HSE status.
Installation via IVT is usually the most convenient method. But there’s also default location method and installation via MU method. All methods are described in HSE-B firmware reference manual. There’s also application note “HSE FW install for S32K3xx [AN744810]” which can be found in Documentation-> Secure files: https://www.nxp.com/products/S32K3
A typical sequence is:
- Program the IVT, encrypted HSE firmware image, bootloader and application.
- Reset the device and wait for HSE initialization to complete.
- Verify the HSE installation, firmware version and relevant status registers
- Format the application key catalogs according to the final project configuration.
- Provision or generate the required production keys.
- Configure secure boot, debug authorization, and other security attributes.
- Perform the required functional and production tests.
- Advance the device lifecycle only after the security configuration has been successfully verified.
Most development and production preparation should be performed in CUST_DEL. The transition to OEM_PROD and subsequently IN_FIELD should be scheduled near the end of provisioning because these transitions restrict key-management and debug capabilities.
2. The process may be executed either by the Tier 1 or by an EMS partner. NXP does not prescribe which company must physically perform the operation. The Tier 1 normally defines and owns:
The EMS may execute these steps using an approved production script or programming package. However, secret production keys should not be supplied as ordinary plaintext programming data. If provisioning is performed in an untrusted manufacturing environment, an appropriate secure provisioning method must be used.
The HSE firmware is not installed in the device at semiconductor manufacturing. We do not offer factory programming service.
The installed version can be checked reading the HSE firmware version attribute.
3. Please follow the post already mentioned above.
All the steps can be automated.
4. The HSE DemoExamples (https://www.nxp.com/webapp/Download?colCode=S32K3_HSE_DemoExamples) provides examples for firmware installation, key-catalog formatting, key import, cryptographic services, secure boot, lifecycle management, and debug authorization. The HSE Firmware Reference Manual and HSE Service API Reference Manual describe the installation procedures, service descriptors, attributes, return codes, and status information required to implement an automated production tool.
For secure boot, we provide this application note:
https://www.nxp.com/webapp/Download?colCode=AN13465
It’s updated version of Secure Boot application note v0.1.1.0 (AN744511) released in 2021 which can be downloaded from:
https://www.nxp.com/products/S32K3
Application note can be found here:
Documentation -> Secure Files -> Secure Boot Application note v0.1.1.0 (AN744511)
Associated demo project can be downloaded here:
Design Resources -> Software -> Secure Files -> SecureBootAppNoteDemo (SW745310)
The software was not updated, so use mentioned SW745310 if you are interested.
Other examples for secure boot can be found in mentioned HSE Demo Examples. There are examples for all three modes – advanced secure boot, basic secure boot and SHE secure boot.
Regarding verification – it depends what you need to verify exactly. HSE firmware – you can read the version via read attribute service (hseAttrFwVersion_t) and you can read the status of HSE in FSR and GSR registers in MU_0 and in HSE GPR register at 0x4039C028 (all these registers are described in HSE-B firmware reference manual).
To verify keys: you can get key information (key flags, not the key value itself) using HSE_SRV_ID_GET_KEY_INFO service. Some keys can be exported (exposed) either in plain or encrypted. Another option to verify a key is a known-answer test. For example, it can be performed by submitting a defined message to the CMAC service and comparing the generated MAC against a precomputed expected value.
Regards,
Lukas