我正在尝试激活我的 MIMXRT1060EVKB 板上的 HAB,但我无法生成签名的 flashloader.bin 文件以在板上加载签名的固件。
1. 我根据 CST 文档中提供的文档生成了一组证书和密钥(4 个公钥)(并与“RT1050 HAB 加密图像生成和分析”一文以及“i.MX RT:安全启动第 1 集”实验室信息)。我还根据这些文档生成了哈希表和签名文件,一切似乎都很好。
2. 按照 i.MX RT 1060 制造用户指南 (doc IMXMCUMFUUG) 第 4.3 节中给出的说明(与上述文档中给出的说明非常相似),我有:
- 生成了一个 .sd 文件
op
tions {
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"
)
{
}
- 将所有必需的文件复制到与包含 elftosb.exe 实用程序的文件夹相同的文件夹中
![](https://file.elecfans.com/web2/M00/97/EC/poYBAGQP88uAZI_VAABh_ibtO50072.png)
3. 我运行以下命令行来尝试生成签名的 flashloader .bin 文件。命令行仅返回以下行然后停止并生成一个 0kB evkbmimxrt1060_flashloader_signed.bin 文件
>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
>
你能帮我弄清楚我可能做错了什么吗?
另外,能否请您向我解释以下与 .sb 文件相关的内容,这些内容在文档中没有明确解释:
- 在 .bd 文件中,SEC_CSF_INSTALL_SRK、SEC_CSF_INSTALL_CSFK、SEC_CSF_INSTALL_KEY 始终处理证书中公钥的安装(SEC_CSF_INSTALL_SRK 的根、SEC_CSF_INSTALL_CSFK 的 CSF 或 SEC_CSF_INSTALL_KEY 中的 IMG(为什么?))。从来没有路径允许找到实际用于签署二进制文件的私钥对应物。那么,既然公钥不应该是秘密的并且可以与任何固件相关联,那么如何才能对输出文件进行实际验证呢?
- 在 .bd 文件中,我们通过提供与 SRK 表中包含的哈希值相关的 SEC_CSF_INSTALL_SRK.InstallSRK_SourceIndex 属性来指定将在 SRK 推力根中使用哪个 SRK。如果我是正确的,相关的 CSF 公钥(在 SEC_CSF_INSTALL_CSFK 中指定)将从其证书中进行验证。之后,我们还为 SEC_CSF_INSTALL_KEY 配置部分提供了一个“Verification Index”和一个“Target Index”。您能否阐明这两个属性的相关内容以及它们实际上有何不同?另外, SEC_CSF_AUTHENTICATE_DATA.Authenticate_DataVerifcationIndex 属性的实际用途是什么?