SLAA547C July 2013 – July 2021 MSP430FR5739
The following code example shows how an AES encryption can be performed.
#include "msp430xxxx.h"
#include "TI_aes.h"
//#include "TI_aes_encr_only.h" //Alternative method
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, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
aes_enc_dec(state, key, 0); // "0" indicates Encryption
//aes_encrypt(state, key); //Alternative Method of Encryption
return 0;
This short program defines two arrays of the type unsigned character. Each array is 16 bytes long. The first one contains the plaintext and the other one the key for the AES encryption.
After the function aes_enc_dec( ) returns, the encryption result is available in the array state.