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.

CC3220: CC3220: Crypto execution in place (avoiding double memory)

Part Number: CC3220


Hi,

I would like to use the functions CryptoCC32XX_encrypt and CryptoCC32XX_decrypt to encrypt/decrypt items with AES CBC which are up to 1K in length.

This will work just fine, as long as I have separate memory for input and output parts. However, that requires me to sacrifice 1K of precious memory.

In theory, encrypting/decrypting CBC stuff in place (same memory in/out) should be possible, by using at most another blocksize of extra memory. This is because the algorithm basically just iterates over the entire input.

However, since I'd like to use the hardware acceleration of the CC3220, I am not sure if this is even possible/supported by the API.

Worst case, I'd have to make my own CBC wrapper around it, e.g. executing up to 256B blocks at a time, and using the last cypertext as IV. But that's also a bit stupid of course.

What would be the recommended approach for encrypting large messages without using twice the amount of memory?

Thanks for your reponse!

  • Note: It .. just works though. I -am- using the same pointers input/output, and as far as I can see, this always works.

    But given that there is nowhere actually specified that this is OK, and even the example code uses two seperate buffers, I could sure use some reassuring that this in fact OK:)
  • Hi Arnout,

    You can take a look at how these buffers are used by the driver and by the AES engine in source/ti/drivers/crypto/CryptoCC32XX.c and source/ti/devices/cc32xx/driverlib/aes.c. You can also refer to section 17 (17.2.3) of the CC3220 Technical Reference Manual.

    This should be safe because each block of data is copied into the AES core registers when operated on and copied back out to the output buffer afterward. Reused data is kept in temporary registers/buffers that are separate from the input buffer.

    Best Regards,
    Ben M