Hello,
I am trying to activate the HAB on my MIMXRT1060EVKB board but I am failing to generate a signed flashloader.bin file in order to load a signed firmware on the board.
1. I have generated the set of certificates and keys (4 public keys) according to the documentation provided in the CST documentation (and have cross checked it with information given in the "RT1050 HAB Encrypted Image Generation and Analysis" article and also in the "i.MX RT: Secure Boot Episode 1" lab information). I also generated the hash table and signature files according the those documents and everything seems to be fine.
2. Following instructions given in section 4.3 of the i.MX RT 1060 Manufacturing User's Guide (doc IMXMCUMFUUG) (which are pretty similar to the instruction given in the above mentioned documents) I have:
- Generated an .sd file
options {
flags = 0x08;
startAddress = 0x60000000;
ivtOffset = 0x1000;
initialLoadSize = 0x2000;
//DCDFilePath = "dcd.bin";
# Note: This is required if the cst and elftsb are not in the same folder
// cstFolderPath = "/Users/nxf38031/Desktop/CSTFolder";
# Note: This is required if the default entrypoint is not the Reset_Handler
# Please set the entryPointAddress to base address of Vector table
# entryPointAddress = 0x60002000;
}
sources {
elfFile = extern(0);
}
constants {
SEC_CSF_HEADER = 20;
SEC_CSF_INSTALL_SRK = 21;
SEC_CSF_INSTALL_CSFK = 22;
SEC_CSF_INSTALL_NOCAK = 23;
SEC_CSF_AUTHENTICATE_CSF = 24;
SEC_CSF_INSTALL_KEY = 25;
SEC_CSF_AUTHENTICATE_DATA = 26;
SEC_CSF_INSTALL_SECRET_KEY = 27;
SEC_CSF_DECRYPT_DATA = 28;
SEC_NOP = 29;
SEC_SET_MID = 30;
SEC_SET_ENGINE = 31;
SEC_INIT = 32;
SEC_UNLOCK = 33;
}
section (SEC_CSF_HEADER;
Header_Version="4.3",
Header_HashAlgorithm="sha256",
Header_Engine="DCP",
Header_EngineConfiguration=0,
Header_CertificateFormat="x509",
Header_SignatureFormat="CMS"
)
{
}
section (SEC_CSF_INSTALL_SRK;
InstallSRK_Table="crts/NCS_IMX_SRK_1_2_3_4_table.bin", // "valid file path"
InstallSRK_SourceIndex=0
)
{
}
section (SEC_CSF_INSTALL_CSFK;
InstallCSFK_File="crts/NCS_IMX_CSF1_1_sha256_4096_65537_v3_usr_crt.pem", // "valid file path"
InstallCSFK_CertificateFormat="x509" // "x509"
)
{
}
section (SEC_CSF_AUTHENTICATE_CSF)
{
}
section (SEC_CSF_INSTALL_KEY;
InstallKey_File="crts/NCS_IMX_IMG1_1_sha256_4096_65537_v3_usr_crt.pem",
InstallKey_VerificationIndex=0, // Accepts integer or string
InstallKey_TargetIndex=2) // Accepts integer or string
{
}
section (SEC_CSF_AUTHENTICATE_DATA;
AuthenticateData_VerificationIndex=0,
AuthenticateData_Engine="DCP",
AuthenticateData_EngineConfiguration=0)
{
}
section (SEC_SET_ENGINE;
SetEngine_HashAlgorithm = "sha256", // "sha1", "Sha256", "sha512"
SetEngine_Engine = "DCP", // "ANY", "SAHARA", "RTIC", "DCP", "CAAM" and "SW"
SetEngine_EngineConfiguration = "0") // "valid engine configuration values"
{
}
section (SEC_UNLOCK;
Unlock_Engine = "SNVS, OCOTP", // "SRTC", "CAAM", SNVS and OCOTP
Unlock_features = "ZMK WRITE, SRK REVOKE" // "Refer to Table-24"
)
{
}
- Copied all required files to the same folder as the one containing the elftosb.exe utility

3. I run the following command line to try to generate the signed flashloader .bin file. The command line only returns the following line then stops and generates a 0kB evkbmimxrt1060_flashloader_signed.bin file
>elftosb.exe -f imx -V -c imx-flexspinor-normal-signed.bd -o evkbmimxrt1060_flashloader_signed.bin flashloader_1060.srec
Section: 0x14
Section: 0x15
Section: 0x16
Section: 0x18
Section: 0x19
Section: 0x1a
Section: 0x1f
Section: 0x21
>
Could you help me figure out what I might be doing wrong ?
Also, could you please explain to me the following things related to the .sb file which are not clearly explained in the documentations:
- in the .bd file the SEC_CSF_INSTALL_SRK, SEC_CSF_INSTALL_CSFK, SEC_CSF_INSTALL_KEY always deal with the installation of public keys from the certificates (either for the root for the SEC_CSF_INSTALL_SRK, the CSF for SEC_CSF_INSTALL_CSFK or the IMG (why ?) in the SEC_CSF_INSTALL_KEY). There is never a path allowing to locate a private key counterpart that would actually be used to sign the binary file. So how can the output file be actually authenticated since the public key should not be secret and could be associated to any firmware ?
- in the .bd file, we specify which SRK is going to be used in the SRK root of thrust by provinding the SEC_CSF_INSTALL_SRK.InstallSRK_SourceIndex property related to the hash values included in the SRK Table. If I am correct, the related CSF public key (specified in SEC_CSF_INSTALL_CSFK) is going to be validated from its certificate. After that, we also provide a "Verification Index" and a "Target Index" for the SEC_CSF_INSTALL_KEY configuration section. Can you clarify what those two properties relate to and how they actually differ ? Also, what is the actual purpose of the SEC_CSF_AUTHENTICATE_DATA.Authenticate_DataVerifcationIndex property ?
Thanks in advance