AES example for SAM.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <string.h>
Macros | |
#define | AES_EXAMPLE_REFBUF_SIZE 4 |
[cipher_data] More... | |
sample data from NIST-800-38A appendix F | |
uint32_t | ref_plain_text [AES_EXAMPLE_REFBUF_SIZE] |
Reference plain data. More... | |
uint32_t | ref_cipher_text_ecb [AES_EXAMPLE_REFBUF_SIZE] |
Reference ECB cipher data. More... | |
const uint32_t | key128 [4] |
Cipher 128 bits key array. More... | |
static uint32_t | output_data [AES_EXAMPLE_REFBUF_SIZE] |
[cipher_data] More... | |
volatile bool | state = false |
struct aes_config | g_aes_cfg |
AES configuration. More... | |
struct aes_module | aes_instance |
struct usart_module | usart_instance |
struct dma_resource | example_resource_tx |
[module_var] More... | |
struct dma_resource | example_resource_rx |
DmacDescriptor example_descriptor_tx | SECTION_DMAC_DESCRIPTOR |
static void | configure_usart (void) |
[module_var_dma] More... | |
static void | ecb_mode_test_dma (void) |
ECB mode encryption test with DMA. More... | |
static void | transfer_tx_rx_done (struct dma_resource *const resource) |
static void | configure_dma_aes_wr (void) |
static void | configure_dma_aes_rd (void) |
int | main (void) |
[setup] More... | |
#define AES_EXAMPLE_REFBUF_SIZE 4 |
[cipher_data]
Referenced by configure_dma_aes_rd(), and configure_dma_aes_wr().
|
static |
References AES_EXAMPLE_REFBUF_SIZE, dma_descriptor_config::beat_size, dma_descriptor_config::block_transfer_count, dma_descriptor_config::destination_address, dma_add_descriptor(), dma_allocate(), DMA_BEAT_SIZE_WORD, dma_descriptor_create(), dma_descriptor_get_config_defaults(), dma_get_config_defaults(), DMA_TRIGGER_ACTION_BLOCK, example_resource_rx, output_data, dma_resource_config::peripheral_trigger, dma_descriptor_config::source_address, dma_descriptor_config::src_increment_enable, and dma_resource_config::trigger_action.
Referenced by main().
|
static |
References AES_EXAMPLE_REFBUF_SIZE, dma_descriptor_config::beat_size, dma_descriptor_config::block_transfer_count, dma_descriptor_config::destination_address, dma_add_descriptor(), dma_allocate(), DMA_BEAT_SIZE_WORD, dma_descriptor_create(), dma_descriptor_get_config_defaults(), dma_get_config_defaults(), DMA_TRIGGER_ACTION_BLOCK, dma_descriptor_config::dst_increment_enable, example_resource_tx, dma_resource_config::peripheral_trigger, ref_plain_text, dma_descriptor_config::source_address, and dma_resource_config::trigger_action.
Referenced by main().
|
static |
[module_var_dma]
[setup]
References usart_config::baudrate, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, usart_enable(), usart_get_config_defaults(), and usart_instance.
|
static |
ECB mode encryption test with DMA.
[encryption_mode]
[encryption_mode]
References AES_AUTO_START, AES_CFB_SIZE_128, aes_clear_new_message(), AES_ECB_MODE, AES_ENCRYPTION, AES_ENCRYPTION_COMPLETE, aes_get_status(), aes_instance, AES_KEY_SIZE_128, aes_set_config(), aes_set_new_message(), aes_write_key(), aes_config::cfb_size, dma_start_transfer_job(), aes_config::encrypt_mode, example_resource_rx, example_resource_tx, g_aes_cfg, key128, aes_config::key_size, aes_config::lod, aes_config::opmode, output_data, ref_cipher_text_ecb, aes_config::start_mode, and state.
Referenced by main().
int main | ( | void | ) |
[setup]
The main function.
[setup_init]
[setup_dma]
[setup_dma]
[setup_config]
[setup_config] [setup_config_defaults]
[setup_config_defaults]
[module_enable]
[module_enable]
[setup_init]
[encryption_decryption]
[encryption_decryption]
References aes_enable(), aes_get_config_defaults(), aes_init(), aes_instance, configure_dma_aes_rd(), configure_dma_aes_wr(), configure_usart(), DMA_CALLBACK_TRANSFER_DONE, dma_enable_callback(), dma_register_callback(), ecb_mode_test_dma(), example_resource_rx, example_resource_tx, g_aes_cfg, system_init(), and transfer_tx_rx_done().
|
static |
struct aes_module aes_instance |
struct dma_resource example_resource_rx |
Referenced by configure_dma_aes_rd(), ecb_mode_test_dma(), main(), and run_ecb_mode_test_dma().
struct dma_resource example_resource_tx |
[module_var]
[module_var_dma]
Referenced by configure_dma_aes_wr(), ecb_mode_test_dma(), main(), and run_ecb_mode_test_dma().
struct aes_config g_aes_cfg |
AES configuration.
const uint32_t key128[4] |
Cipher 128 bits key array.
|
static |
uint32_t ref_cipher_text_ecb[AES_EXAMPLE_REFBUF_SIZE] |
Reference ECB cipher data.
uint32_t ref_plain_text[AES_EXAMPLE_REFBUF_SIZE] |
Reference plain data.
DmacDescriptor example_descriptor_rx SECTION_DMAC_DESCRIPTOR |
struct usart_module usart_instance |