Configure ECB mode encryption with DMA and run test.
state =
false
;
g_aes_cfg.encrypt_mode = AES_ENCRYPTION;
g_aes_cfg.key_size = AES_KEY_SIZE_128;
g_aes_cfg.start_mode = AES_AUTO_START;
g_aes_cfg.opmode = AES_ECB_MODE;
g_aes_cfg.cfb_size = AES_CFB_SIZE_128;
g_aes_cfg.lod =
false
;
aes_set_config(&aes_instance,AES, &g_aes_cfg);
aes_write_key(&aes_instance, key128);
dma_start_transfer_job(&example_resource_tx);
aes_set_new_message(&aes_instance);
aes_clear_new_message(&aes_instance);
while
(
false
== state) {
}
while
(!(aes_get_status(&aes_instance) & AES_ENCRYPTION_COMPLETE)) {
}
state =
false
;
dma_start_transfer_job(&example_resource_rx);
while
(
false
== state) {
}
if
((ref_cipher_text_ecb[0] != output_data[0]) ||
(ref_cipher_text_ecb[1] != output_data[1]) ||
(ref_cipher_text_ecb[2] != output_data[2]) ||
(ref_cipher_text_ecb[3] != output_data[3])) {
printf(
"\r\nKO!!!\r\n"
);
}
else
{
printf(
"\r\nOK!!!\r\n"
);
}