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.

CC1110 AES unit

Other Parts Discussed in Thread: CC2430, CC430F6137

Hi, has anyone used the AES unit on the CC1110?

I have used DN108 but it still does not respond. I use the CPU interface and not the DMA interface and do the following:

1. Load the key, wait for RDY

2. Load the IV/NONCE, wait for RDY

3. Load the data block to be encrypted

4. Read the encrypted data block out

5. Wait for RDY and this is where it gets stuck.

If I single step through the downloading of the encrypted data then the RDY bit goes high but not while running. There is one issue that bothers me with the DN108 implementation, why is the wait for RDY after you have already read the data out and not after uploading the data to be encrypted? Logic dictates that you should load the coprocessor then wait for it to encrypt the data, wait for RDY, then read out the encrypted data.

Cheers,

Charles 

  • Hi.

    There is also AES code to be found here:
    https://community.ti.com/forums/p/561/1336.aspx#1336

    It's for the 802.15.4 devices, but the source code for the CC2430 could be used for CC1110 when it comes to AES as the engine is the same in those two devices.

  • Hi,

     

    Thanks found the problem, there needs to be a delay between the uploading and downloading and then RDY flag then goes active.

     

    Cheers,

    Charles

  • Hi Charles,

    I have had a problem similar to yours. I have added a delay, but the result I get from the coprocessor after decryption is all FF's. Also if I do decryption the result is again all FF's.

    What is your experience?

    Cheers

  • Hi Rajo,

     

    Although the delay in swra209, link above, was only 1us I used a 40us delay as I had a function for another interface and I was not pressed for time.

    void InitEnc (void)
    {
    int i;

        // Download Key (Set ENCCS.CMD = 10b),
        // and start corresponding AES process (ENCCS.ST = 1)
        ENCCS = ENCCS_MODE_ECB | ENCCS_CMD_LOAD_KEY | ENCCS_ST;
        for (i = 0; i < SIZE_OF_AES_BLOCK; i++) {
            ENCDI = EncKey[i];
        }

        // Monitor AES (ENCCS.RDY) to wait until key downloaded
        while(!(ENCCS & ENCCS_RDY));

        // Generate IV/NONCE:
        // Not used as using ECB mode, so set IV/NONCE to 0

        // Dwonload IV/NONCE (Set ENCCS.CMD = 11b)
        // and start corresponding AES process (ENCCS.ST = 1)
        ENCCS = ENCCS_MODE_ECB | ENCCS_CMD_LOAD_IV | ENCCS_ST;
        for (i = 0; i < SIZE_OF_AES_BLOCK; i++) {
            ENCDI = 0;
        }

        // Monitor AES (ENCCS.RDY) to wait until IV/NONCE downloaded
        while(!(ENCCS & ENCCS_RDY));
    }

     

    void aes_encrypt(unsigned char *data)
    {
    int i;

        // Perform AES encryption/decryption on allocated AES buffer ("*data"):

        // Configure and start AES coprocessor for the desired AES mode:
        // Encryption => ENCCS.CMD = 00b, decryption mode => ENCCS.CMD = 01b.
        // Use so-called Cipher Block Chaining encryption mode => ENCCS.MODE = 000b.
        // Start AES processing (ENCCS.ST = 1) of source buffer (*data).
        // Only valid for encryption mode !
        ENCCS = ENCCS_MODE_ECB | ENCCS_CMD_ENC | ENCCS_ST;
        // Download data block (16 bytes) to AES coprocessor:
        for (i = 0; i < SIZE_OF_AES_BLOCK; i++) {
            ENCDI = data[i];
        }

        Wait_4_40us();  // Give the AES time to do it's thing

        // Upload data block (16 bytes) to allocated AES buffer:
        for (i = 0; i < SIZE_OF_AES_BLOCK; i++) {
            data[i] = ENCDO;
        }

        // Monitor AES (ENCCS.RDY) to wait until data block downloaded
        while(!(ENCCS & ENCCS_RDY));

    }

    Hope this helps.

    Cheers,

    Charles

  • I thought my experience would be useful for some future readers, so here it comes. Basically, my problem had to do with declaration of the AES input and output strings. Once I had them declared ordinarily, i.e.

    BYTE  aes_input[SIZE_OF_ENC_BUFFER]; // Source buffer
    BYTE  aes_output[SIZE_OF_ENC_BUFFER]; // Target buffer

    everything started to work fine.

    The declaration from the app note:

    __no_init BYTE __xdata aes_buffer_1[SIZE_OF_ENC_BUFFER];

    __no_init BYTE __xdata aes_buffer_2[SIZE_OF_ENC_BUFFER]; 

    did not work for me.

    I have used IAREW8051 7.20H

    Cheers

  • Hi there,

    The AES Design Note (DN108) has now been updated to incorporate delay between AES download (ENCDI write) and AES upload (ENCDO read), ref.:

    [DN108 - Using AES Encryption in CC111xFx]
    http://www.ti.com/litv/pdf/swra172b


    Cheers,
    RF4ALL

  • Hi RF4ALL,

     

    Your link above is invalid, can you correct it plesae. I have searched for the document and could not find it.

     

    Cheers,

    Charles

  • Hi Charles,

    We are looking into this.  It's actually not an issue with the link but how the document appears on the web.  Stay tuned!

    Regards,

    nancy!

  • Hi Nancy, the mentioned link is currently (still?) not accessible. Could you please check that. Thanks a lot! regards spachner
  • Hi Spachner -- I will have an answer for you by tomorrow.  Thanks for checking-in!

    Nancy

  • Ok, I lied, it's after tomorrow.  However, the team will have this document available in a week or so.  Please send me a private message so I can provide you with more details.

     

  • Hi Nancy;

     

    Currently I am working with CC430F6137.

    would you pls provide me the link for example of AES.

    It will be great help from TI

    .Thanks