SLAA547C July 2013 – July 2021 MSP430FR5739
Decryption can be done in a similar way to encryption. First, two arrays are defined. When a decryption needs to be performed, one array contains the key and the other one the cipher text.
After the function aes_enc_dec( ) returns, the decryption result is available in the array state.
#include "msp430xxxx.h"
#include "TI_aes.h"
int main( void )
{
unsigned char state[] = {0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a};
unsigned char key[] = {0x00, 0x01, 0x02, 0x03, 0x04, 05, 0x06, 0x07,
0x08, 0x0, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
aes_enc_dec(state, key, 1); // "1" indicates Decryption
return 0;
}