PEmicro's Cyclone FX programmers have extended support for production programming of the Renesas RA family Device Lifecycle Management (DLM) and TrustZone boundary settings. With the release of Cyclone firmware version 11.77 and image creation utility version 10.11, Device Lifecycle Management and TrustZone boundary settings are now supported for Renesas Cortex-M85 devices. The newly supported Renesas security engines include RSIP-E51A (RA8D1, RA8M1, RA8T1) and RSIP-50D (RA8P1, RA8D2, RA8M2, RA8T2). These settings are used to secure access to the on-chip Flash and RAM from external debug/bootloader access and from untrusted code running internally to the device on devices with DLM Technology and TrustZone support. Configuration and programming of these settings are made simple with PEmicro's stand-alone programmers. This article is a continuation of a previous post which provided an introduction of Device Lifecycle for Renesas Cortex-M33 devices. In addition to the Renesas Secure Key Management tool, users will need to use the Renesas Key Wrap Service to generate the output keys. Review the relevant documentation from Renesas for registering and using the Renesas Key Wrap Service. Renesas e² studio is also recommended for generating the Renesas Partition Data file (.RPD) that contains the boundary settings. The keys are generated using the Renesas Secure Key Management tool and key wrap service. Open the Security Key Management Tool and select the MCU/MPU and security engine for the target device in the overview tab. The first step is to generate the User Factory Programming Key (UFPK) that will be used to prepare the keys for secure injection. Select the “Generate UFPK” tab and choose to specify or generate a random value. Name the output file and output directory and then select “Generate UFPK key file”. Next, the generated UFPK file needs to be wrapped with the Renesas Key Wrap service. Note: the PGP key exchange must already be established with the service to proceed. Using Kleopatra, select “Sign/Encrypt” and select the UFPK key file. Uncheck the “Encrypt for me” and check the “Encrypt for others” option. Select the icon next to the text box for the “Encrypt for others” option and select the keywrap. Specify the output location/filename and check the “Encrypt / Sign each file separately” option. Select “Sign / Encrypt” and ignore the warning about not encrypting for self. The output .gpg file that is required for the key wrap service will be generated. Log into the key wrap service, select the Renesas RA family, and choose the target RA device. Select “Encryption service for products” to get the following menu: Select “Browse…”, specify the generated .gpg file for the encrypted UFPK key, and click OK. If the encryption was done correctly, you will receive an email KeyWrap service with an attachment. The attached file is the encrypted wrapped key and should have the extension “.key_enc.key.pgp”. Download the attachment and use Kleopatra to decrypt the wrapped UFPK key file. For further details about the key wrap procedure, review section 4.4 of the inject keys manual. With the UFPK and wrapped UFPK keys, the last step is to generate the injectable key. In the security key management tool, go to the “Wrap Key” tab. In the first section, select the key type that will be generated. For the RA M85 devices, this includes the AL keys, the RMA key, the OEM root public key, or any of the various user keys (AES, RSA, ECC, etc.). After specifying the type, switch to “Key Data” to specify the key’s value. The value can be specified through a file, as raw data, or generated randomly to an output file. The value will be important for regressing protection levels in the future. In the next section, “Wrapping Key”, the UFPK and wrapped UFPK files are specified. Select the UFPK key that was originally generated for the “UFPK File”. Select the decrypted wrapped UFPK file with extension “.key_enc.key” for the “W-UFPK File”. Lastly, in the “Output” section, specify the output file/location and select “Generate file”. The generated file with extension “.rkey” will be used with our tools to inject the key to the Renesas RA target. A different .rkey file should be generated for each selected key type that will be injected to the target. With the keys generated, the next step is to configure the Cyclone stand alone programming (SAP) image. Open “CreateImage.exe” and select the target Renesas device being programmed. Configure the image script to program the application object file into the target normally. Below is a typical example of erasing and programming the user application into flash: After configuring the programming sequence, switch to the “Renesas Flash Options” tab to configure the security engine features. This tab includes several options for the security engine extending to the injection of keys, setting boundaries, and configuring the protection level/device lifecycle management state. See below for the screenshot of the Renesas Flash Options tab and correlating numbers for each option and description. After configuring the Renesas Flash Options, the SAP image can be generated and added to a target Cyclone FX. With the SAP image created and stored on a Cyclone FX, the next step is to run the image and test the programming operation. The operation will start with initialization (if enabled) and then proceed to run the programming sequence for the flash. If any error occurs during the programming sequence, the operation will stop without configuring any security options. After the programming sequence, the status bar will show “Setting DLM/Boundaries …” until the operation finishes. If any error occurs while setting the DLM/Boundary settings, the error code will be a value from $3301 to $33E5 depending on the failure. Tap the details next to the error for more information on the failure message/code. Once the SAP image succeeds with setting the security options, it reads back the information to validate the settings. The information from the security settings is then stored in the “Last DLM State Log” that can be accessed on the Cyclone FX. To access the log through the Cyclone touchscreen, select “MENU” -> “Status” -> “Show Logs” -> “Show Last DLM State Log”. The information includes the current DLM state, the boundary setting configuration, if initialization is active, and if the DLM Keys and user keys are valid. The DLM State Log for the Renesas RA M85 devices should appear like the following: If the message “No available log”, then the SAP image likely needs to be run again. The DLM State log will also fail to update if an error occurred. Please submit an SR ticket to request any additional features or support for the Renesas security engine. Requirements:
Generating Keys:


Configuring SAP Image:


Validating Security Engine Operations:


Additional Features/Support