Hi,
I use KL81's SHA256 to calculate Flash's Hash. It works fine with some data in RAM. But when I tried to calculate my whole firmware's SHA256, I got some problems.The firmware is running in flash, starts from 0x00000000.
When I use the LTC driver to do the calculation, I found one of the functions, LTC_DRV_hash_update(), has a check on input buffer:
if ((NULL == ctx) || (NULL == input))
{
return kStatus_LTC_InvalidInput;
}
So my calculation failed because the input address is 0. I tried to remove this check, the code stuck in function ltc_drv_wait().
If I changed the input address from 0 to 0x4, the code stuck in function ltc_drv_wait() as well.
If I copy my firmware from Flash to a big buffer in RAM and calculate the SHA256, the code hang in ltc_drv_wait() as well.
The code size is 0x8A30 bytes. It looks like if the code try to calculate the hash of itself, the LTC module cannot finish the calculation.
Did anyone has this problem before?
Regards,
Dawei
One thing I found this morning was if the data length is 0xfef, SHA256 works, not hang. If the data length is 0xff0, code hang in ltc_drv_wait().
Hi Dawei,
So far, the KSDK software version is V2.2, which with many difference about LTC module driver.
We would recommend to update the KSDK software to the latest V2.2 .
About the current version LTC driver, please try with below ways:
1> Remove "NULL == input" in <hash.c> file;
2> Modify “#undef SECLIB_LTC_DRV_INTERRUPT_MODE” in ltc_driver.c
Wish it helps.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Ma,
Thanks for the reply. I am using Kinetis SDK v1.3 for KL81. Can you please give me a link of Kinetis SDK v2.2 for KL81? Thanks.
Hi Dawei,
I am checking with our marketing team to provide the latest version KSDK for KL81 software to you.
Thank you for the patience.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Dawei,
Sorry for the later reply.
I am checking this issue with Kinetis product team and will let you know later.
Thank you for the patience.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------