how i can use hardware AES encryption in CC13xx. Is there any application program??
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.
how i can use hardware AES encryption in CC13xx. Is there any application program??
I used the documentation that you referred and my code block is as below
keyIndex
// Declared globally outside the task function typedef struct { uint8_t ui8AESKey[16]; CryptoCC26XX_KeyLocation ui8AESKeyLocation; // Location in Key RAM uint8_t ui8AESClearText[16]; // Input message - clear text uint8_t ui8AESMsgOut[16]; // Output message uint8_t ui8IntEnable; // Set to true/false to enable/ // disable interrupts } AESEncryptStore; AESEncryptStore mykeyStore ={ { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }, CRYPTOCC26XX_KEY_0, { 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96, 0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A }, { 0x3A, 0xD7, 0x7B, 0xB4, 0x0D, 0x7A, 0x36, 0x60, 0xA8, 0x9E, 0xCA, 0xF3, 0x24, 0x66, 0xEF, 0x97 }, true, }; CryptoCC26XX_Handle handle; CryptoCC26XX_Params params; bool exclusiveAccess = false; int keyIndex; CryptoCC26XX_AESECB_Transaction trans; Inside a task if (!handle) { System_printf("CryptoCC26XX did not open"); System_flush(); } else { System_printf("Entering else block"); System_flush(); keyIndex = CryptoCC26XX_allocateKey(handle, mykeyStore.ui8AESKeyLocation,(const uint32_t *) mykeyStore.ui8AESKey); if (keyIndex != CRYPTOCC26XX_STATUS_ERROR) { // Setup transaction trans.keyIndex = keyIndex; trans.msgIn = (uint32_t *) mykeyStore.ui8AESClearText; trans.msgOut = (uint32_t *) mykeyStore.ui8AESMsgOut; // Do AES-ECB operation CryptoCC26XX_transact(handle, (CryptoCC26XX_Transaction *) &trans); CryptoCC26XX_releaseKey(handle,&keyIndex); System_printf("Before encryption %s",(uint32_t *) mykeyStore.ui8AESClearText); System_printf(" After %s",(uint32_t *) mykeyStore.ui8AESMsgOut);
System_flush(); } else { System_printf("Key Location was not allocated."); } }
The code reaches the CryptoCC26XX_transact line and crashes after that, debugger when stepped into shows few registers and values, but it never returns from that function.
I just took the code verbatim from #include <ti/drivers/crypto/CryptoCC26XX.h> as advised. I made the data type of KeyIndex as int,since compiler was warning the comparison is futile since u_int8 was being compared against a negative number.
Can you advise what is incorrect in the above code?