Skip to content

Instantly share code, notes, and snippets.

@KunYi
Last active May 21, 2021 06:35
Show Gist options
  • Save KunYi/2716aada0f5f91474c2bc0a2271e5163 to your computer and use it in GitHub Desktop.
Save KunYi/2716aada0f5f91474c2bc0a2271e5163 to your computer and use it in GitHub Desktop.
initial NXP/Freescale HAB(High Assurance Boot) PKI base certificate and get fuse.txt for burn fuse
#!/bin/bash
set -euo pipefail # for strict mode
CST_TARFILE="cst-3.3.1.tgz"
DEF_SERIAL_NUMBER="41325426"
DEF_KEY_PASS="KeyKunYi4SecureBoot"
if [ ! -f $CST_TARFILE ]; then
echo "not found $CST_TARFILE, please download first"
echo "need create NXP devloper member account and login"
echo "download url:https://www.nxp.com/webapp/Download?colCode=IMX_CST_TOOL_NEW"
exit 1
fi
tar xzf $CST_TARFILE
odir=$PWD
pushd cst-3.3.1/keys
echo $DEF_SERIAL_NUMBER > serial # for OpenSSL use on cerficate serial number
echo $DEF_KEY_PASS > key_pass.txt
echo $DEF_KEY_PASS >> key_pass.txt
./hab4_pki_tree.sh -existing-ca n -use-ecc n -kl 4096 -duration 20 -num-srk 4 -srk-ca y
cd ../crts
../linux64/bin/srktool --hab 4 \
--table SRK_1_2_3_4_table.bin \
--efuses SRK_1_2_3_4_fuse.bin \
--digest sha256 \
--certs "./SRK1_sha256_4096_65537_v3_ca_crt.pem,\
./SRK2_sha256_4096_65537_v3_ca_crt.pem,\
./SRK3_sha256_4096_65537_v3_ca_crt.pem,\
./SRK4_sha256_4096_65537_v3_ca_crt.pem" \
--fuse_format 1 2>&1 | tee $odir/fuse.txt
popd
@KunYi
Copy link
Author

KunYi commented May 21, 2021

always override fuse.txt for latest content of fuse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment