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.

CCS/CC1310: Memory issues when using both ECC and crypto drivers together

Part Number: CC1310

Tool/software: Code Composer Studio

I still have the same issue mentioned in the related question even when I tried to increase the work zone size of the ECC to 1300. 

you can find the code snippets below for the initialization and te encryption and decryption:

#define ROM_CRYPTO_BUFFER_ADDR              0x20004F00
#define ROM_CRYPTO_BUFFER_SIZE              0x100

#ifdef __TI_COMPILER_VERSION__
//    #pragma DATA_ALIGN (romCryptoOutputBuffer, 4);
    #pragma LOCATION(romCryptoOutputBuffer, ROM_CRYPTO_BUFFER_ADDR);
    uint8_t romCryptoOutputBuffer[ROM_CRYPTO_BUFFER_SIZE];
#endif
      
uint32_t eccWorkzone[1100];


// initialization

        GPIO_init();
        CryptoCC26XX_init();

        memset(romCryptoOutputBuffer, 0, ROM_CRYPTO_BUFFER_SIZE);

        cryptoHandle = CryptoCC26XX_open(Board_CRYPTO0, false, NULL);

        TRNG_init();
        ECC_initialize((uint32_t*)eccWorkzone);

        Crypto_Config.TRNGHandle= TRNG_open(Board_TRNG0, NULL);

// symmetric key generation and loading
        Generate_AES_Key(PrivKey, OtherPublicKeyX, OtherPublicKeyY,
                         SharedSecretKeyX, SharedSecretKeyY, (uint8_t*)SymKey);
        Crypto_Config.KeyLocation = CryptoCC26XX_allocateKey(cryptoHandle, CRYPTOCC26XX_KEY_ANY, (const uint32_t *)SymKey);
        CryptoCC26XX_loadKey(cryptoHandle, KeyLocation, (const uint32_t *)SymKey);

// Encryption and decryption

        Nonce[0]=0;
        Nonce[1]=1;
        Nonce[2]=2;

        CRYPTOAesCbc((uint32_t*)dataIn, (uint32_t*)dataOut, DataLength, (uint32_t*)Nonce,
                                         KeyLocation, 1, 0);
       for     (NonceIndex=0; NonceIndex<NonceLength; NonceIndex++)
       {       dataOut[DataLength+NonceIndex]=Nonce[NonceIndex];
       }

       while(CRYPTOAesCbcStatus());
       EncrypDone= 1;

       crypto_status= CRYPTOAesCbc((uint32_t*)dataIn, (uint32_t*)dataOut, DataLength,
                                (uint32_t*)&Nonce, KeyLocation, 0, 0);

       while(CRYPTOAesCbcStatus());
       DecrypDone= 1;


P.S. 
- Read the related question first to know exactly what my problem is 
- when I try key generation alone, it works fine
- when I try encryption and decryption alone, it works fine
- when I integrate both key generation and encryption together, it does not. the key is generated correctly at the two sides of the network but the encryption and decryption, I cannot see the encrypted and decrypted data although the status of both encryption and decryption is done

  • Any update or answer to my inquiry?

  • Hi Nada,

    First of all, I will close the old thread to avoid having the same issue duplicated.

    As for the topic above, you would need to provide more details on what is actually crashing. You say that for some configurations it "stops after a while". What makes up a "stop", is it an exception or is it an interrupt that you expect that never arrives? 

    Your example does not really show you using the ECC code at all expect for you running the init function, could you possibly provide more detail on how you use it? Just for reference in future debugging effort, the Crypto driver and ECC driver has nothing to do with each other.

    The ECC is a SW based implementation in ROM where as the Crypto driver is running on actual crypto HW. 

    If you could provide a full example for me to run and test we would likely do progress on this faster. If you do not want to share it in public you could send it to me in PM.