Creating fuse blobs and signed/encrypted images using HSM

I was able to create the fuse blobs and signed/images using a regular openssl generated rsa key. I need to use a key generated by HSM for production. How do I go about creating these blobs?

  1. For the fuse blobs, we need only the hash of the public key and do not need access to the private key portion. I see that the odmfuse.sh script has an option -H (HASHFILE) to input a hash. This is not shown in the help options. I computed the SHA256 hash of the modulus of the public key and found that it doesn’t match with the computed hash. There seems to be something else added to the data over which the hash is computed. Could you please provide details so that I could compute the hash and provide that to the script?

  2. For the script to sign and encrypt images, there isn’t such an option. We need to use the HSM to do the signature. Hence we need something like having the scripts to generate the data to sign, then we need to separately sign using the HSM. Then once this is done, another script should combine all these signatures together and make the images.

Please let me know how I can go about creating fuse blobs and signed/encrypted images using the HSM (Hardware Security Module)

  • Rayees

hello rayees.shamsuddin,

since both fusing and signing takes .pem file as the input.
for fusing itself, only HASH is necessary. however, the real key (
.pem) is necessary for signing.

it’s better to prepare *.pem file for both of your fusing and signing process.
you should need to consider how to convert your HSM output file into *.pem file.
thanks

hello rayees.shamsuddin,

I would like to have more details regarding to your previous questions. please check below…

1. For the fuse blobs, we need only the hash of the public key and do not need access to the private key portion. I see that the odmfuse.sh script has an option -H (HASHFILE) to input a hash. This is not shown in the help options. I computed the SHA256 hash of the modulus of the public key and found that it doesn’t match with the computed hash. There seems to be something else added to the data over which the hash is computed. Could you please provide details so that I could compute the hash and provide that to the script?

odmfuse.sh does support -H option. with this option, no rsa key is needed.
To compute SHA256 hash of the modulus of the public key.
For TX1, public key hash can be calculated by running command “openssl dgst -sha256 -binary -out .sha .mod”, where .mod is rsa key modulus in form of binary (little endian).
For TX2 or Xavier, the size to compute is based on NV defined data structure. So, the buffer includes some zeros after modulus.
Taking TX2 as an example, buffer size is 896 bytes. The first 256 is modulus, the remaining 640 bytes are all zeros.

2. For the script to sign and encrypt images, there isn’t such an option. We need to use the HSM to do the signature. Hence we need something like having the scripts to generate the data to sign, then we need to separately sign using the HSM. Then once this is done, another script should combine all these signatures together and make the images.

“Sign and encrypt images” is supported in l4t-r32.1 release.
please running with “–no-flash” options to sign and encrypt images without flashing.
by taking TX2 board as an example, shown the complete command as below,

$ sudo ./flash.sh <b>--no-flash</b> -u <rsa_priv>.pem -v <sbk>.key jetson-tx2 mmcblk0p1

you should run above command in HSM.
these encrypted and signed images were generated under $OUT/Linux_for_Tegra/bootloader directory.
then, please tar the bootloader directory to generate the flashing blob.

to flash in non-HSM environment, you should un-tar the flashing blob, bring (the pkc and sbk fuses burned) device into forced-recovery mode, enter “bootloader” directory, and execute the commands follow by “sudo bash ./flashcmd.txt” to enable the process and flash a device.
thanks