Skip to main content
skuma.21
Associate II
December 6, 2018
Solved

STM32_Crypto on STM32L431

  • December 6, 2018
  • 1 reply
  • 764 views

Hello,

I am trying to use "STM32CubeExpansion_Crypto_V3.1.0" library for generating HMAC_SHA1 on STM32L431 processor. We are using FreeRTOS.

Issue description: When we make a function call to the HMAC_SHA1 functions contained in the above library, it returns successfully with the HASH, but the code hangs immediately after that. Sometimes it gives "Hard Fault" and hangs and at other times it just hangs without giving any error message.

Interesting thing to note is that, when we call the same functions from outside of any Task (from timer interrupt for example) it works just fine. But when we call these set of functions from within a task (say application task) the code hangs after executing the HMAC_SHA1 functions.

Could anyone please point out what could be going wrong? Thanks.

A few points to note:

  1. I am using the __CRC_CLK that is needed for running the crypto library.
  2. Have tried using critical sections - enable critical section before the HASH function calls and disable after returning from them. But this doesn't help.

Thanks.

Best regards

satish

    This topic has been closed for replies.
    Best answer by After Forever

    Could be stack overflow. Try to increase the task's stack size.

    1 reply

    After Forever
    After ForeverBest answer
    Senior III
    December 6, 2018

    Could be stack overflow. Try to increase the task's stack size.

    skuma.21
    skuma.21Author
    Associate II
    December 6, 2018

    HI After Forever,

    Thanks this worked.

    In fact I suspected this and tried increasing the stack size but in reality the #define for stack size was not being used in my code to allocate stack for each task. Hence there was no impact of this change.

    after your response, I double checked and resolved that Issue.

    Thanks again!

    regards

    satish