Hi Team,
We are using the nRF52840 DK for one of our project, as part of that we are using the RNG functionality with CC310 Library.
When we call this "CRYS_RND_GenerateVector" function or any Crypto related functions at fixed time interval like for every 6 or 5 sec, over the period of time board is getting the WDT Reset.
Could any one help me out what is causing this issue, I have shared the code snippet as well for this.
1. Is there anything wrong while using the CC310 hw Lib for RNG and Crypto functionalities.
2.When we use the CC310 Functionality with SD is there any additional precautions we need to take care in terms of IRQ priority and other things.
How best we can use the CC310 For RNG and Crypto functionalities library for nRF52840 soc.
I have inserted the code for CC310 Init, close and Convert functions for reference.
Regards,
Srinivas.V
static bool CC310_AES_ECB_init(SaSiAesUserContext_t *ContextID,SaSiAesEncryptMode_t cryptoMode,SaSiAesOperationMode_t operationMode,uint8_t *key, uint8_t key_size)
{
SaSiAesUserKeyData_t keyData;
int ret = 0;
NVIC_EnableIRQ(CRYPTOCELL_IRQn);
NRF_CRYPTOCELL->ENABLE = 1;
/*Init SaSi library*/
if(SA_SILIB_RET_OK == SaSi_LibInit())
{
ret = SaSi_AesInit(ContextID,cryptoMode,operationMode,SASI_AES_PADDING_NONE);
if(ret == SA_SILIB_RET_OK)
{
keyData.pKey = key;
keyData.keySize = key_size;
ret = SaSi_AesSetKey(ContextID, SASI_AES_USER_KEY, &keyData, sizeof(keyData));
}
}
return ret;
}
static void CC310_AES_ECB_close(void)
{
/*Finish SaSi library*/
SaSi_LibFini();
NVIC_DisableIRQ(CRYPTOCELL_IRQn);
NRF_CRYPTOCELL->ENABLE = 0;
}
uint32_t hal_BLE_AES_Block_Convert(uint8_t *InputVector, uint8_t key_size)
{
uint32_t ret = NRF_SUCCESS;
uint8_t *dataOutBuff_ptr = InputVector;
if(key_size == AES_128_BIT)
ret = SaSi_AesBlock(&ContextID,
InputVector,
SASI_AES_BLOCK_SIZE_IN_BYTES,
dataOutBuff_ptr);
else if(key_size == AES_256_BIT)
ret = hal_ECI_AES_ECB_Block_Convert(InputVector);
return ret;
}