See Quick start guide for XMEGA AES driver.
This is a driver for the AVR XMEGA AES crypto module. It provides functions for configuring the AES modules, reseting and starting AES encryption and decryption operations.
See Quick start guide for XMEGA AES driver
AES Configuration Define | |
enum | aes_dec { AES_ENCRYPT, AES_DECRYPT = AES_DECRYPT_bm } |
AES encryption/decryption direction settings. More... | |
enum | aes_auto { AES_MANUAL, AES_AUTO = AES_AUTO_bm } |
AES Auto Start Trigger settings. More... | |
enum | aes_xor { AES_XOR_OFF, AES_XOR_ON = AES_XOR_bm } |
AES State XOR Load Enable settings. More... | |
enum | aes_intlvl { AES_INTLVL_OFF = AES_INTLVL_OFF_gc, AES_INTLVL_LO = AES_INTLVL_LO_gc, AES_INTLVL_MED = AES_INTLVL_MED_gc, AES_INTLVL_HI = AES_INTLVL_HI_gc } |
AES Interrupt Enable / Level settings. More... | |
typedef uint8_t | t_key [AES_KEY_SIZE] |
AES key block type. More... | |
typedef uint8_t | t_data [AES_DATA_SIZE] |
AES data block type. More... | |
typedef void(* | aes_callback_t )(void) |
AES interrupt callback function pointer. More... | |
#define | AES_KEY_SIZE 16 |
Length of one key block. More... | |
#define | AES_DATA_SIZE 16 |
Length of one data block. More... | |
AES Function Define | |
static void | aes_start (void) |
Start a decryption/encryption operation. More... | |
static void | aes_software_reset (void) |
Reset all registers in AES module. More... | |
static bool | aes_is_busy (void) |
Check if the AES module is busy. More... | |
static bool | aes_is_error (void) |
Check if the AES module has encountered an error. More... | |
static void | aes_clear_interrupt_flag (void) |
Clear the AES state ready interrupt flag. More... | |
static void | aes_clear_error_flag (void) |
Clear the AES error flag. More... | |
void | aes_configure (enum aes_dec decrypt, enum aes_auto auto_start, enum aes_xor xor_mode) |
AES control register settings. More... | |
void | aes_set_key (t_key k_in) |
Load key memory. More... | |
void | aes_get_key (t_key k_out) |
Get key memory. More... | |
void | aes_write_inputdata (t_data d_in) |
Load state memory. More... | |
void | aes_read_outputdata (t_data d_out) |
Get state memory. More... | |
void | aes_isr_configure (enum aes_intlvl intlvl) |
AES interrupt settings. More... | |
void | aes_set_callback (aes_callback_t callback) |
Set AES interrupt callback function. More... | |
#define AES_DATA_SIZE 16 |
Length of one data block.
Always 128-bits (16 bytes).
Referenced by aes_read_outputdata(), and aes_write_inputdata().
#define AES_KEY_SIZE 16 |
Length of one key block.
Always 128-bits (16 bytes).
Referenced by aes_get_key(), and aes_set_key().
typedef void(* aes_callback_t)(void) |
AES interrupt callback function pointer.
typedef uint8_t t_data[AES_DATA_SIZE] |
AES data block type.
typedef uint8_t t_key[AES_KEY_SIZE] |
AES key block type.
enum aes_auto |
enum aes_dec |
enum aes_intlvl |
enum aes_xor |
|
inlinestatic |
Clear the AES error flag.
|
inlinestatic |
Clear the AES state ready interrupt flag.
AES control register settings.
decrypt | encryption/decryption direction. |
auto_start | Auto Start Trigger. |
xor_mode | AES State XOR Load Enable. |
Referenced by main().
void aes_get_key | ( | t_key | key_out | ) |
Get key memory.
key_out | Pointer to AES key output. |
References AES_KEY_SIZE.
|
inlinestatic |
Check if the AES module is busy.
This functions determines whether the AES module is busy by checking if it is currently performing a encryption/decryption operation or an error has occurred. If neither of these cases are true, the module is determined to be busy.
If an error has occurred, the flag must be cleared with the function aes_clear_error_flag().
Referenced by main().
|
inlinestatic |
Check if the AES module has encountered an error.
Referenced by main().
void aes_isr_configure | ( | enum aes_intlvl | intlvl | ) |
AES interrupt settings.
intlvl | AES interrupt level. |
Referenced by main().
void aes_read_outputdata | ( | t_data | data_out | ) |
Get state memory.
data_out | Pointer to AES output date. |
References AES_DATA_SIZE.
void aes_set_callback | ( | aes_callback_t | callback | ) |
Set AES interrupt callback function.
callback | Pointer to the callback function to set. |
References aes_callback.
void aes_set_key | ( | t_key | key_in | ) |
Load key memory.
key_in | Pointer to AES key input. |
References AES_KEY_SIZE.
|
inlinestatic |
Reset all registers in AES module.
Referenced by main().
|
inlinestatic |
Start a decryption/encryption operation.
Referenced by main().
void aes_write_inputdata | ( | t_data | data_in | ) |
Load state memory.
data_in | Pointer to AES input date. |
References AES_DATA_SIZE.