Hello guys,
these days i started to work with the CryptoCell library on nrf52840 and i'm facing some issues running AES CCM* mode
little example with pseudo code for initialization
CRYS_AESCCMStar_SourceAddress_t eui64 =
{0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0 };
CRYS_AESCCM_Key_t key_n =
{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t AData[15] =
{ 0x69, 0x98, 0x03, 0x33, 0x63, 0xbb, 0xaa, 0x01, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x03};
uint8_t TextData[20] =
{ 0x14, 0xaa, 0xbb, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f };
uint8_t len_a = 15;
uint8_t len_m = 20;
CRYS_AESCCM_Mac_Res_t mac_res;
CRYS_AESCCMStar_Nonce_t nonce_n =
{ 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x05 };
CRYSError_t ret;
.. SaSi_LibInit ..
.. CRYS_AESCCMStar_NonceGenerate ..
ret = CRYS_AESCCMStar(
SASI_AES_ENCRYPT,
key,
CRYS_AES_Key128BitSize,
nonce_n,
13, //SizeOfN
AData,
len_a,
TextData, //in
*len_m,
TextData, //out, same buffer
0, //tag len
mac_res
);
if i'm using another length than 0 for SizeOfT parameter e.g. 4 the function return always error code 0x00F01511
which says CRYS_AESCCM_ILLEGAL_PARAMETER_ERROR.
I'm getting the same error as well when i'm using a "hardcoded" nonce array (within my tests, solution was to use CRYS_AESCCMStar_NonceGenerate always generating the same output)
Does someone have any thought how i can solve this issue?
Best regards
Chris