Hi,
I'm porting an older product that used a Microchip MRF24J40 SPI radio and a PIC processor to an nRF52840 and I'm struggling with how to replicate both the CRC calculations and the AES-128 encryption/decryption that the MRF24J40 radio did in hardware.
The code I'm porting has a 128-bit array of bytes to use for a key and it uses a received CRC value to fill in its 13-byte NONCE registers (which it seems are the equivalent of the iv Input Vector).
I upgraded to the latest NCS v2.0.0 last night as I understand from this thread that earlier versions have some block size limitations that the new code doesn't have:
RE: PSA encryption - AES CTR 128 - message input length
I've managed to get together some code that I thought should work based on the \v2.0.0\nrf\samples\crypto\aes_ctr example, and the ecdsa example for setting my own pre-existing key with psa_import_key().
I just gave it a try, but I'm getting a -135 error code from psa_cipher_set_iv. It's not happy with the 13 byte iv length (the function succeeds if I change it to 16).
I assume I need to use the same NONCE/IV value that the old product used to get a successful decryption - is that right? How can I make it work with the 13-byte initial value?
Thanks,
Glen