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... | |
Functions | |
static void | configure_usart (void) |
[module_var] More... | |
static void | ecb_mode_test (void) |
ECB mode encryption and decryption test. More... | |
int | main (void) |
[setup] More... | |
Variables | |
struct aes_module | aes_instance |
struct aes_config | g_aes_cfg |
static uint32_t | output_data [AES_EXAMPLE_REFBUF_SIZE] |
[cipher_data] More... | |
volatile bool | state = false |
struct usart_module | usart_instance |
[module_inst] 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... | |
#define AES_EXAMPLE_REFBUF_SIZE 4 |
[cipher_data]
|
static |
[module_var]
[setup] Configure usart.
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 and decryption test.
[encryption_mode]
[encryption_mode]
[decryption_mode]
[decryption_mode]
References AES_AUTO_START, AES_CFB_SIZE_128, aes_clear_new_message(), AES_DECRYPTION, AES_ECB_MODE, AES_ENCRYPTION, AES_ENCRYPTION_COMPLETE, aes_get_status(), aes_instance, AES_KEY_SIZE_128, aes_read_output_data(), aes_set_config(), aes_set_new_message(), aes_write_input_data(), aes_write_key(), aes_config::cfb_size, aes_config::encrypt_mode, g_aes_cfg, key128, aes_config::key_size, aes_config::lod, aes_config::opmode, output_data, ref_cipher_text_ecb, ref_plain_text, aes_config::start_mode, and state.
Referenced by main().
int main | ( | void | ) |
[setup]
The main function.
[setup_init]
[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_usart(), ecb_mode_test(), g_aes_cfg, and system_init().
struct aes_module aes_instance |
struct aes_config g_aes_cfg |
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.
struct usart_module usart_instance |
[module_inst]