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.

CC3220SF-LAUNCHXL: Working examples for AES Crypto Module

Part Number: CC3220SF-LAUNCHXL

I am trying to test the AES crypto module. Are there any examples available.

I am trying with the below code. It is returning with -1 error code.

CryptoCC32XX_Handle cryptoHandle;
CryptoCC32XX_EncryptParams AESparams;
uint8_t Plane_text[] = {0x4c,0x61,0x64,0x69,0x65,0x73,0x20,0x61,0x6e,0x64,0x20,0x47,0x65,0x6e,0x74,0x20};
uint32_t Plane_text_Len = 16;
uint8_t Encrypted_text[16];
uint32_t Encrypted_text_Len = 16;

uint8_t AESKey[] = {0x4c,0x61,0x64,0x69,0x65,0x73,0x20,0x61,0x6e,0x64,0x20,0x47,0x65,0x6e,0x74,0x20,0x4c,0x61,0x64,0x69,0x65,0x73,0x20,0x61,0x6e,0x64,0x20,0x47,0x65,0x6e,0x74,0x20};

// Initialize Crypto module
CryptoCC32XX_init();

cryptoHandle = CryptoCC32XX_open(Board_CRYPTO0, CryptoCC32XX_AES);
if (cryptoHandle == NULL)
{
return;
}

AESparams.aes.pKey = (uint8_t *)AESKey;
AESparams.aes.keySize = CryptoCC32XX_AES_KEY_SIZE_256BIT;
int32_t error = CryptoCC32XX_encrypt(cryptoHandle, CryptoCC32XX_AES_ECB, Plane_text, Plane_text_Len, Encrypted_text, &Encrypted_text_Len, &AESparams);
if(CryptoCC32XX_STATUS_SUCCESS != error)
{
consoleString("\n\rAES FAILED");
}
else
{
consoleString("\n\r Encrypted Data: 0x");
for(count=0;count<Encrypted_text_Len;count++)
{
consolePrintf("%02x ",*(Encrypted_text+count));
}
}

  • Hi Jitendra,

    Can you confirm what is returning with -1? Is it the CryptoCC32XX_encrypt() call?
    Can you try setting a breakpoint in CryptoCC32XX_aesIntHandler() and see if it is firing?

    Best Regards,
    Ben M
  • Hi Jitendra,

    I haven't heard back from you in a while so I assume you were able to resolve your issue. I'm going to close this thread. If you have not, you can reopen the thread by posting a reply below. If the thread locks before you can get back to it, you can open a new thread that references this one by clicking the "Ask a related question" button.

    Best,
    Ben M