This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] [参考译文] 【常见问题解答】如何在外部安全密钥服务器上对 u-boot 二进制文件进行签名

Guru**** 2694645 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1598771/faq-how-to-sign-u-boot-binary-on-an-external-secure-key-server

器件型号: AM625

BINMAN 工具当前用于在 Linux SDK 中对 u-boot 二进制文件进行签名、其中签名密钥可在 Linux SDK 文件夹下找到。 切换到生产密钥时、需要使用存储在外部安全密钥服务器中的签名密钥。 此常见问题解答 以 AM62x Linux SDK 为例、讨论了有关如何在外部安全密钥服务器上对 u-boot 二进制签名的选项。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    使用 BINMAN 工具进行 u-boot 构建和代码签名的摘要
    -构建 u-boot 二进制/工件
    -包装中间伪影
    -签署二进制工件(x.509 证书)
    -重新包装 x.509 证书和二进制/工件

    外部安全密钥服务器(即基于 HSM)上的代码签名选项
    选项 A — 单触发模式,用于 u-boot 构建和代码签名
    在 OneShot 中构建并登录整个 u-boot、其中需要移植“openssl.py"上“上的 BINMAN 工具、以调用 HSM 供应商提供的 PKCS#11 引擎或库/插件。
    -配置 openssl 以在 openssl.cnf 文件中加载引擎
    -调用 openssl(即 BINMAN openssl.py ),通过 PKCS11 引擎插件与 HSM 连接

    选项 B — 分解成多个步骤,如 u-boot 构建、代码签名、repack...
    - :生成新 x.509 证书的 shell 脚本,将 Bimman 预生成的工件作为输入。

    - tiboot3.bin.sign.log:使用如下所列的 cmd 重新签名 tiboot3.bin 的日志、 其中偏移量 (0x0) 来自 R5 u-boot build 文件夹下的“tiboot3-am62x-hs-evm.bin.map"</s>“

    ./binman_hsm_sign.sh tiboot3-am62x-hs-evm.bin custMpk.pem 1 \
    config.tiboot3-am62x-hs-evm.bin.ti-secure-rom 0 > tiboot3.bin.sign.log

    -“tispl.bin.sign.log":“:使用如下所列的 cmd 重新签名 tispl.img 的日志、其中偏移量来自附加的“ti-spl.map"[1]“[1]

    ./binman_hsm_sign.sh tispl.bin custMpk.pem 5 \
    config.ti-spl.fit.images.atf.ti-secure 0x158 \
    config.ti-spl.fit.images.tee.ti-secure 0xd670 \
    config.ti-spl.fit.images.dm.ti-secure 0x84b14 \
    config.ti-spl.fit.images.spl.ti-secure	0xb4a14 \
    config.ti-spl.fit.images.fdt-0.ti-secure 0x10b584 > tispl.bin.sign.log

    - u-boot.img.sign.log:使用如下所列的 cmd 重新签名 u-boot.img 的日志、其中所有偏移都来自附加的“u-boot.map"[1]“[1]

    ./binman_hsm_sign.sh u-boot.img custMpk.pem 2 \
    config.u-boot.fit.images.uboot.ti-secure 0x12c \
    config.u-boot.fit.images.fdt-0.ti-secure 0x1404f0 > u-boot.img.sign.

    新的 x.509 证书可能会在外部安全密钥服务器上生成、其中需要移植附加脚本中的 openssl cmd、以便通过外部安全密钥服务器(即基于 HSM)支持的 PKCS.11 引擎运行(对于选项 A)

    [1]我将附加来自 A53 u-boot 构建的两个示例*。map 文件 (ti-spl.map 和 u-boot.map) 以供参考。 调用时会使用两个映射文件的偏移量 重新签名/重新打包 tispl.bin 和 u-boot.img

    e2e.ti.com/.../2211.binman_5F00_hsm_5F00_sign.sh

    e2e.ti.com/.../tiboot3.bin.sign.log

    e2e.ti.com/.../tispl.bin.sign.log

    e2e.ti.com/.../u_2D00_boot.img.sign.log

    e2e.ti.com/.../ti_2D00_spl.map

    e2e.ti.com/.../u_2D00_boot.map