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.

cc3200 SHA/MD5 example

Other Parts Discussed in Thread: CC3200

Hi,

I wanted to test out using the hardware cryptography accelerator module, but ran into a few issues.

1) The SHA/MD5 example doesn't work how i expected it to. The screen shot in the demo application page shows the resulting hash as a 10-digit hexadecimal number (5 bytes). The selected algo was MD5, which to my understanding should return a 32-digit hexadecimal number (16 bytes). Is there something I'm missing here?

processors.wiki.ti.com/.../CC32xx_SHA-MD5_Demo_Application

2) I tried looking for documentation on the hardware cryptography accelerator, but section "1.3.15 Hardware Cryptography Accelerator" of the technical reference manual for the CC3200 says,

"Further details about the hardware cryptography accelerator will be addressed in the revision of this manual"

When will further details be provided? I'd like to be able to use the SHA/MD5 functionality - is there another place I can find Register level description of this module?

Thanks,

Danny

  • I'm also wondering how to use the MD5 library to check hashes on flash files (like system images) to determine validity. The example in the SDK only works for single lines in RAM, and we can't put the whole flash image in RAM.
  • Hi Daniel,

    Let me check and get back to you.

    Thanks and Regards,
    Praveen
  • Hi Daniel,


    There is a programming bug in printing the hex value on console. We had fixed this issue, and going to release in next version of SDK. For timing being please modify following code snippet (line#421 and 422) in main.c to get correct output on console.

    "Replace"

    UART_PRINT("\n\r The Hash Value in Hex is: 0x%02x",*puiResult); //line#421
    for(u8count=0;u8count<(uiHashLength/4);u8count++) //line#422

    "With"

    UART_PRINT("\n\r The Hash Value in Hex is: 0x"); //line#421
    for(u8count=0;u8count<uiHashLength;u8count++) //line#422


    Regards,
    Aashish
  • Ok, thanks Aashish. That easily fixed my first problem. I checked the example code against an online hash generator and the the resulting hash matched.

    When will further documentation detail be available for the crypto hardware?

    Also, how can a hash be computed iteratively? For example if we have a decently large file, say 100kB, then we don't want to load the whole thing into RAM and then compute the hash. We want to read chunks of the file and sequentially call the hashing function until we reach the end of file. Can this be done with the current API? How?

    Thanks,
    Danny
  • Hi Danny,

    Daniel Kern1 said:
    Also, how can a hash be computed iteratively? For example if we have a decently large file, say 100kB, then we don't want to load the whole thing into RAM and then compute the hash. We want to read chunks of the file and sequentially call the hashing function until we reach the end of file. Can this be done with the current API? How?

    Yes it is possible to compute hash iteratively. Please implement below pseudo code in place of calling MAP_SHAMD5DataProcess():

    While(MAP_SHAMD5IntStatus() & SHAMD5_INT_CONTEXT_READY);

    SHAMD5DataLengthSet();

    while(data)

    {

    SHAMD5DataWrite()

    }

    While(MAP_SHAMD5IntStatus() & SHAMD5_INT_OUTPUT_READY);

    MAP_SHAMD5ResultRead();

    Please note data should be 64 bytes align.

    Regards,

    Aashish

  • Over 2 years since my last post on this thread...still going strong on the CC3200.

    I have another question about using the SHAMD5 module. Is it possible to abort a hash computation in the middle? For example, let's say I'm hashing a large file, say 100kB, chunk by chunk (64 bytes). What if halfway through, I get a totally unrelated error, but would like to abort hashing and reset the module for the next time a hash computation is to be done. How can I safely abort? In my attempts, the module is stuck waiting for more input and I can't re-initialize it.

    Are there any registers I can manipulate to accomplish this?

    Thanks,

    Danny