SLAU847D October 2022 – May 2024 MSPM0L1105 , MSPM0L1106 , MSPM0L1227 , MSPM0L1228 , MSPM0L1228-Q1 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346 , MSPM0L2227 , MSPM0L2228 , MSPM0L2228-Q1
A single 128-bit block of data can be encrypted or decrypted by first configuring the context registers and then initiating input data transfer. The following pseudo code describes the actions that are typically executed by CPU software for a basic encryption operation with 128-bit key.
wait AES_CTRL[31] == '1' // wait for CNTXT_RDY to become 1
wait AES_CTRL[1:0] == '10' // wait for INPUT_RDY to become 1
write AES_KEY1_0 // first 32 bits of key
write AES_KEY1_1 // next 32 bits of key
write AES_KEY1_2 // next 32 bits of key
write AES_KEY1_3 // final 32 bits of key
write AES_CTRL[29,24:2] = '0,00000000000000000001100' // Write AES-128 Encrypt Mode
write AES_DATA_IN // write 32-bit data 4 times to supply 128-bit block
wait AES_CTRL[0] == '1' // wait for OUTPUT_RDY becomes a 1
read AES_DATA_OUT // read 32-bit data 4 times to read out 128-bit encrypted data