SLAU846B June 2023 – November 2024 MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G1519 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1 , MSPM0G3519
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