AVR XMEGA Advanced Encryption Standard (AES) example.
Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.
#include <string.h>
#include <asf.h>
Macros | |
#define | BLOCK_LENGTH 16 |
AES data, key block length. More... | |
#define | DMA_CHANNEL_N 0 |
DMA channel used. More... | |
Functions | |
static void | aes_dma_input (void) |
Access AES module with DMA support. More... | |
static void | aes_dma_output (void) |
Access AES module with DMA support. More... | |
int | main (void) |
Variables | |
uint8_t | cipher_text [BLOCK_LENGTH] |
Cipher result from FIPS-197 = 69c4e0d8 6a7b0430 d8cdb780 70b4c55a. More... | |
struct dma_channel_config | config |
DMA channel configuration. More... | |
uint8_t | init [BLOCK_LENGTH] |
Initialization vector used during Cipher Block Chaining (CBC). More... | |
uint8_t | key [BLOCK_LENGTH] |
Key from FIPS-197 = 00010203 04050607 08090A0B 0C0D0E0. More... | |
uint8_t | lastsubkey [BLOCK_LENGTH] |
Key used when the AES shall decrypt. More... | |
uint8_t | plain_text [BLOCK_LENGTH] |
Plaintext from FIPS-197 = 00112233 44556677 8899AABB CCDDEEFF. More... | |
uint8_t | single_ans [BLOCK_LENGTH] |
Variable used to store the result from a single AES encryption/decryption. More... | |
bool | success |
Variable used to check AES results. More... | |
#define BLOCK_LENGTH 16 |
AES data, key block length.
Referenced by aes_dma_input(), aes_dma_output(), and main().
#define DMA_CHANNEL_N 0 |
DMA channel used.
Referenced by aes_dma_input(), and aes_dma_output().
|
static |
Access AES module with DMA support.
References BLOCK_LENGTH, config, dma_channel_enable(), DMA_CHANNEL_N, dma_channel_set_burst_length(), dma_channel_set_dest_dir_mode(), dma_channel_set_dest_reload_mode(), dma_channel_set_destination_address(), dma_channel_set_source_address(), dma_channel_set_src_dir_mode(), dma_channel_set_src_reload_mode(), dma_channel_set_transfer_count(), dma_channel_trigger_block_transfer(), dma_channel_write_config(), dma_enable(), key, and plain_text.
Referenced by main().
|
static |
Access AES module with DMA support.
References BLOCK_LENGTH, config, dma_channel_enable(), DMA_CHANNEL_N, dma_channel_set_burst_length(), dma_channel_set_dest_dir_mode(), dma_channel_set_dest_reload_mode(), dma_channel_set_destination_address(), dma_channel_set_source_address(), dma_channel_set_src_dir_mode(), dma_channel_set_src_reload_mode(), dma_channel_set_transfer_count(), dma_channel_trigger_block_transfer(), dma_channel_write_config(), dma_disable(), dma_enable(), and single_ans.
Referenced by main().
int main | ( | void | ) |
References aes_configure(), aes_dma_input(), aes_dma_output(), AES_ENCRYPT, AES_INTLVL_OFF, aes_is_busy(), aes_is_error(), aes_isr_configure(), AES_MANUAL, aes_software_reset(), aes_start(), AES_XOR_OFF, BLOCK_LENGTH, board_init(), cipher_text, ioport_set_pin_low(), single_ans, sleepmgr_enter_sleep(), sleepmgr_init(), success, SYSCLK_AES, sysclk_disable_module(), sysclk_enable_module(), sysclk_init(), and SYSCLK_PORT_GEN.
uint8_t cipher_text[BLOCK_LENGTH] |
Cipher result from FIPS-197 = 69c4e0d8 6a7b0430 d8cdb780 70b4c55a.
struct dma_channel_config config |
DMA channel configuration.
Referenced by aes_dma_input(), and aes_dma_output().
uint8_t init[BLOCK_LENGTH] |
Initialization vector used during Cipher Block Chaining (CBC).
uint8_t key[BLOCK_LENGTH] |
Key from FIPS-197 = 00010203 04050607 08090A0B 0C0D0E0.
uint8_t lastsubkey[BLOCK_LENGTH] |
Key used when the AES shall decrypt.
This last subkey is a modified version of the key.
uint8_t plain_text[BLOCK_LENGTH] |
Plaintext from FIPS-197 = 00112233 44556677 8899AABB CCDDEEFF.
uint8_t single_ans[BLOCK_LENGTH] |
Variable used to store the result from a single AES encryption/decryption.
bool success |
Variable used to check AES results.