同时使用身份验证和加密的 HSM 流程 - 2023.2 简体中文

Vitis 统一软件平台文档 嵌入式软件开发 (UG1400)

Document ID
UG1400
Release Date
2023-12-13
Version
2023.2 简体中文

阶段 0:使用虚拟密钥对纯比特流进行加密和身份验证。如果需要密钥滚动,请添加 keylife 参数。

您可以提供 .nky 文件,或者 Bootgen 可以生成包含加密密钥的 .nky 文件。Bootgen 不支持生成 AES 模糊密钥。密钥滚动功能需要 keylife 参数。

the_ROM_image:

{

[aeskeyfile] encrypt.nky

[sskfile] dummykey.pem

[encryption=aes, authentication=rsa,keylife =32] plain-system.bit

}

bootgen -arch fpga -image stage0.bif -w -o auth-encrypt-system.bit -log info
完成此步骤后,如果启用了加密,则会生成 .nky 文件。此文件包含所有密钥。

阶段 1:生成散列

请参阅以下代码示例。

the_ROM_image:

{

[authentication=rsa] auth-encrypt-system.bit

}

 

bootgen -arch fpga -image stage1.bif -generate_hashes -log info

阶段 2:对散列 HSM 进行签名

这里使用 OpenSSL 进行演示。

openssl rsautl -sign -inkey rsaPrivKeyInfo.pem -in auth-encrypt-system.sha384 > auth-encrypt-system.sha384.sig

您可以使用 HSM 服务器对散列进行签名。对于 SSI 技术器件,为每个超级逻辑区域 (SLR) 生成签名。以下示例显示了用于为具有四个 SLR 的器件生成签名的代码。

openssl rsautl -sign -inkey rsaPrivKeyInfo.pem -in auth-encrypt-system.0.sha384 > auth-encrypt-system.0.sha384.sig

openssl rsautl -sign -inkey rsaPrivKeyInfo.pem -in auth-encrypt-system.1.sha384 > auth-encrypt-system.1.sha384.sig

openssl rsautl -sign -inkey rsaPrivKeyInfo.pem -in auth-encrypt-system.2.sha384 > auth-encrypt-system.2.sha384.sig

openssl rsautl -sign -inkey rsaPrivKeyInfo.pem -in auth-encrypt-system.3.sha384 > auth-encrypt-system.3.sha384.sig

阶段 3:使用真实签名来更新 RSA 证书

请参阅以下代码示例。

the_ROM_image:

{

[spkfile] rsaPubKeyInfo.pem

[authentication=rsa, presign=auth-encrypt-system.sha384.sig] auth-encrypt-system.bit

}

Command:bootgen -arch fpga -image stage3.bif -w -o rsa_encrypt.bit -log info
注释: 对于 SSI 技术器件,使用 presign=<first presign filename>:<number of total presigns>。例如,具有四个 SLR 的器件应使用 <first presign filename:4>