This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EK-TM4C1294XL: HMAC-SHA256 stuck in process when using pre-processed key

Part Number: EK-TM4C1294XL

Hello,

I'm testing the speed of the HMAC calc module gererating hashes from a simple uint32 vector and a fixed 512bit key.

When I use directly the key I have (with SHAMD5HMACKeySet) everything works fine and the hash is generated as it should be.

The problem is when I try to use the SHAMD5HMACPPKeyGenerate to pre-process the key. It does process the key into another variable fine but when I use the SHAMD5HMACProcess function it gets stuck. The peripheral never gives back the result.

So far I've been using the code like this:

SysCtlPeripheralEnable(SYSCTL_PERIPH_CCM0);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0));

bzero(g_ui32PPHMACKey, 64); SHAMD5Reset(SHAMD5_BASE); SHAMD5ConfigSet(SHAMD5_BASE, SHAMD5_ALGO_HMAC_SHA256); SHAMD5HMACPPKeyGenerate(SHAMD5_BASE, g_ui32HMACKey, g_ui32PPHMACKey); SHAMD5HMACPPKeySet(SHAMD5_BASE, g_ui32PPHMACKey); SHAMD5HMACProcess(SHAMD5_BASE, password, 16, hashResult);

The key is a uint32 vector with 16 positions (512 bits) initialized and the pre processed key is a similar vector but initialized with zero on all positions. This one does get values after the KeyGenerate function but the execution gets stuck on the Process function.

What should I do to use the function? My objective is to make the device work faster

  • Hello Leonardo

    Please check the sha1_hmac example in DK-TM4C129x example on how to preprocess the key and hash the data
  • I checked the example and made my project work simply using a "ROM_SHAMD5Reset" before each calc.
    What I found very weird was the fact that the uDMA version was so much slower than the normal one. Using the pre-processed key I was able to get a 256 in about 400 cycles. Doing the same with uDMA I got the result in 2319 cycles.

    I believe that happens because with uDMA I always need to call a few functions like ROM_uDMAChannelTransferSet and ROM_uDMAChannelEnable for both the input and the output.
  • Hello Leonardo

    Yes, that is true. UDMA requires house keeping functions. However the true cycle count would be provided from the time the DMA request is asserted to the time the DONE interrupt is asserted.