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