Other Parts Discussed in Thread: UNIFLASH
We are using CC3220SF for one of our product developments, I have some questions on boot procedure, secure boot and encryption. questions are marked in green color .please answer them as early as possible.
First, I will start with flashing. My intention is to generate the signature and file encryption using the Uniflash tool.
What does the Uniflash tool load on to the serial flash? Does it also store the binary file signature on to the serial flash?
When the binary image along with the 20 bytes Hash is programmed on to the serial flash why one more hash is required, why does the bootloader compute it and store it in the "/sys/mcuflashimghash.bin"?
What is the use of the 20 bytes hash which is already programmed along with the binary file in serial flash when integrity is checked with the new HASH SHA-1?.
I am referring to the document below
http://www.ti.com/lit/ug/swru465/swru465.pdf
“Bootloader computes and store the SHA-1 hash of the on serial flash in a file "/sys/mcuflashimghash.bin"”
The below statement from the same document is confusing it directly says first 20-bytes hash serves as identifier for detecting a new image on serial flash.
The first 20-byte hash part of the serial flash file /sys/mcuflashimg.bin is neither copied nor takes part in SHA-1 generation by the bootloader. It serves as an identifier for detecting a new image on serial flash. A mismatch with the previously stored hash triggers an update cycle, and the transfer process is repeated.
Now coming to the secure boot
According to my understand verification of the signature and decryption of binary while booting is called secure boot.
When does the signature verified while programming or on every boot? the below statement says “Secured files are authenticated only when they are written to the file system” if the signature is not verified at every boot how can you say the system supports secure boot ?
“A valid code signing certificate is mandatory when using the Secure SimpleLink™ Wi-Fi® devices (CC3X20S/SF). Secured files are authenticated only when they are written to the file system. The sl_FsClose call (when writing a secured and signed file) should include the path to the certificate and the file signature as a binary ‘C’ array. After processing the sl_FsClose, the signature is verified. If the verification fails, the file is not flashed.”
How about encryption when it is decrypted? while transferring to the on-chip flash?. How does the boot loader know the key to decrypt it when I am using the vendor key?
According to my understanding from below statement on every boot the device will verify the HASH by calculating the HASH of the on-chip binary and compare it with the HASH stored in the serial flash. Is mu understanding correct or it will calculate the serial flash HASH on every boot and compare it with hash stored in the "/sys/mcuflashimghash.bin" file?
“The CC3220SF bootloader, on every exit from power-on or hibernate, checks the integrity of the exiting (and marked-valid) user application image binary on on-chip flash against the auto-generated SHA-1 of the image on serial flash, saved during the program and update phase of the on-chip flash. In case of a mismatch, the on-chip flash is mass erased to protect the user application binary.”
thanks,
Harish