cancel
Showing results for 
Search instead for 
Did you mean: 

SBSFU | 1 Image Download and Decryption

Jakub Standarski
Associate III

Hello all.
Another question regarding SBSFU, this time 1 image version.
When we download new image via YMODEM, when does decryption process happen?

1. Is new image first downloaded into active image slot and then decrypted?

2. Is new image downloaded and decrypted at the same time, which is basically decryption on the fly, but that requires special hardware accelerator?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Jocelyn RICARD
ST Employee

Hello @Jakub Standarski ,

In 1 image setup, if the update is done by the SBSFU loader, you can follow what is done in file

1_Image\1_Image_SBSFU\SBSFU\App\sfu_loader.c

in function 

SFU_ErrorStatus SFU_COM_YMODEM_DataPktRxCpltCallback(uint8_t *pData, uint32_t uSize)
 
This function is called when Ymodem protocol receives a new packet.
The first packet containing .sfb file will contain the header.
This signature of the header is immediately checked, reason why you can see a little delay after first pack transmission.
Then if signature is OK, the rest is decrypted "on the fly" but with software crypto, and written into flash.
Once all transfer is done, SBSFU computes the hash of the whole firmware and compares is with the one provided in the authenticated header.
If the check fails, firmware is erased and SBSFU waits for a new download.
I hope it answers your question.
Best regards
Jocelyn

View solution in original post

2 REPLIES 2
Jocelyn RICARD
ST Employee

Hello @Jakub Standarski ,

In 1 image setup, if the update is done by the SBSFU loader, you can follow what is done in file

1_Image\1_Image_SBSFU\SBSFU\App\sfu_loader.c

in function 

SFU_ErrorStatus SFU_COM_YMODEM_DataPktRxCpltCallback(uint8_t *pData, uint32_t uSize)
 
This function is called when Ymodem protocol receives a new packet.
The first packet containing .sfb file will contain the header.
This signature of the header is immediately checked, reason why you can see a little delay after first pack transmission.
Then if signature is OK, the rest is decrypted "on the fly" but with software crypto, and written into flash.
Once all transfer is done, SBSFU computes the hash of the whole firmware and compares is with the one provided in the authenticated header.
If the check fails, firmware is erased and SBSFU waits for a new download.
I hope it answers your question.
Best regards
Jocelyn

Awesome! That's what I needed, thanks!