Hello Richard Bean,
You could refer to cst tool provided in LSDK, we use CST tool to assist with secure boot process. CST tool can be used to generate RSA public and private keys, OPTMK and CSF header.
In LSDK, please execute the following command to get cst source code in the folder flexbuild/packages/apps/cst.
$flex-builder -c cst -a arm64
In cst tool we use the script "uni_sign" to create SRK(Public Key) Hash, it will call the function create_srk_calc_hash defined in the file tools/header_generation/create_hdr_common.c to create the SRK Table and calculate the hash.
In the function create_srk_calc_hash, crypto_extract_pub_key, crypto_hash_init, crypto_hash_update and crypto_hash_final are called, these APIs defined in file common/crypto_utils.c, invokes openssl API SHA256_Init, SHA256_Update, SHA256_Final.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------