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.

CC2340R5 AES Encryption hard fault

Other Parts Discussed in Thread: CC2340R5

Dear Team,

I am working on AES encryption over CC2340R5 Launchpad, for testing the capabilities I have referred this example note:

(*Link: .../ti/simplelink_cc23xx_sdk_6_40_00_21_eng/docs/drivers/doxygen/html/_a_e_s_e_c_b_8h.html#ti_drivers_AESECB_Examples) 

The problem is when I am running Example code snippet (* ### Encryption of multiple plaintext blocks in blocking mode #), its ending up in faultISR.

I have taken basic_ble project as base & added a function (* testEnc() ) to check the encryption example. Facing same problem if I run the testEnc() from RTOS main.

The code enter into faultISR when it calls this function (* AESECBCC23XX_startOperation ).

I also want to understand where we will store the encryptions keys & what is the process of generating these keys from production point of view.

Please let me know if you need any further information.

Thanks & Regards,

Harinder Singh

  • Hi Harinder,

    Thanks for reaching out, I will be looking into this and get back to you tomorrow. In the meanwhile I just want to confirm this is the 6.40 SDK

    Kind Regards,

    Rogelio

  • Dear Sir,

    Yes, this is 6.40 SDK

    Regards,

    Harinder Singh

  • Dear Sir, 

    I have also tried the example for AES-CBC provided, but still no luck. 

    (Example: ..ti/simplelink_cc23xx_sdk_6_40_00_21_eng/docs/drivers/doxygen/html/_a_e_s_c_b_c_8h.html#ti_drivers_AESCBC_Synopsis)

    Adding AES Register Status, after faultISR for reference.

    Can you please provide some reference manual for using AES feature on CC2340R5 or direct example project which I can refer for beter understanding.

    Thanks & Regards,

    Harinder Singh

  • Hi Harinder,

    Looking through the code, I cant see the function AESECB_init() called. Can you call this function before calling other AESECB functions and see if you experience the same issue.

    Kind Regards,

    Rogelio

  • Dear Sir,

    Greeting of the day!

    I have added the AESECB_init(); before calling other functions, but still its the same problem. I have tried Both ECB & CBC examples.

    Also modified the syscfg files. 

    Note: For ECB I have added one more config as index 0 was already in use.

    For: AES-ECB

    For: AES-CBC

     

    Please refer the updated code that I am working on.

    /*ECB*/
    void testEncECB()
    {
    AESECB_Handle handle;
    CryptoKey cryptoKey;
    int_fast16_t encryptionResult;
    uint8_t plaintext[] = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
    0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
    0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
    0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51};
    uint8_t ciphertext[sizeof(plaintext)];
    uint8_t keyingMaterial[16] = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
    0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c};

    AESECB_init();
    handle = AESECB_open(1, NULL);
    if (handle == NULL) {
    // handle error
    }
    CryptoKeyPlaintext_initKey(&cryptoKey, keyingMaterial, sizeof(keyingMaterial));
    AESECB_Operation operation;
    AESECB_Operation_init(&operation);
    operation.key = &cryptoKey;
    operation.input = plaintext;
    operation.output = ciphertext;
    // Input length must be a non-zero multiple of block-size (16 bytes)
    // for one-step operations. The user or application should take care of
    // necessary padding.
    operation.inputLength = sizeof(plaintext);
    encryptionResult = AESECB_oneStepEncrypt(handle, &operation);
    if (encryptionResult != AESECB_STATUS_SUCCESS) {
    // handle error
    }

    AESECB_close(handle);
    }

    /*CBC*/

    void testEncCBC()
    {
    AESCBC_Handle handle;
    CryptoKey cryptoKey;
    int_fast16_t encryptionResult;
    // For example purposes only. Generate IVs in a non-static way in practice.
    // Test vector 0 from NIST CAPV set CBCMMT128
    uint8_t iv[16] = {0x2f, 0xe2, 0xb3, 0x33, 0xce, 0xda, 0x8f, 0x98,
    0xf4, 0xa9, 0x9b, 0x40, 0xd2, 0xcd, 0x34, 0xa8};
    uint8_t plaintext[16] = {0x45, 0xcf, 0x12, 0x96, 0x4f, 0xc8, 0x24, 0xab,
    0x76, 0x61, 0x6a, 0xe2, 0xf4, 0xbf, 0x08, 0x22};
    uint8_t ciphertext[sizeof(plaintext)];
    uint8_t keyingMaterial[16] = {0x1f, 0x8e, 0x49, 0x73, 0x95, 0x3f, 0x3f, 0xb0,
    0xbd, 0x6b, 0x16, 0x66, 0x2e, 0x9a, 0x3c, 0x17};
    // The ciphertext should be the following after the encryption operation:
    // 0x0f, 0x61, 0xc4, 0xd4, 0x4c, 0x51, 0x47, 0xc0
    // 0x3c, 0x19, 0x5a, 0xd7, 0xe2, 0xcc, 0x12, 0xb2
    AESCBC_init();

    handle = AESCBC_open(0, NULL);
    if (handle == NULL) {
    // handle error
    }
    CryptoKeyPlaintext_initKey(&cryptoKey, keyingMaterial, sizeof(keyingMaterial));
    AESCBC_OneStepOperation operation;
    AESCBC_OneStepOperation_init(&operation);
    operation.key = &cryptoKey;
    operation.input = plaintext;
    operation.output = ciphertext;
    operation.inputLength = sizeof(plaintext);
    operation.iv = iv;
    encryptionResult = AESCBC_oneStepEncrypt(handle, &operation);
    if (encryptionResult != AESCBC_STATUS_SUCCESS) {
    // handle error
    }
    AESCBC_close(handle);
    }

    Please let me know If I am doing something wrong with the configuration or their is some other issue.

    Thanks & Regards,

    Harinder Singh

  • Hi Harinder,

    Unfortunately we dont have an example for the cc2340. Give me some time to reproduce and find a workaround. Ill update you next week. 

    Kind Regards,

    Rogelio

  • Dear Sir,

    Any Update on this!

    Kindly share one working reference example code for AES-CCM so that we can start with further testing or Let us know if it will take more time to debug the problem.

    Please let me know if you need more information from my end.

    Thanks & Regards,

    Harinder Singh