Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AES - Advanced Encryption Standard

Driver for the AES (Advanced Encryption Standard) module.

Provides functions for configuring and initiating ciphering/deciphering with AES algorithms. Several modes (ECB, CBC, OFB, CFB or CTR) and key sizes (128-, 192- or 256-bit) are supported, in addition to manual or DMA-based data input to the AES module.

Modules

 

Data Structures

struct  aes_config_t
 AES Configuration structure. More...
 
struct  aes_isrconfig_t
 AES Interrupt configuration structure. More...
 

Macros

#define AES_CBC_MODE   1
 
#define AES_CFB_MODE   3
 
#define AES_CTR_MODE   4
 
#define AES_ECB_MODE   0
 AES Operation cipher mode. More...
 
#define AES_KEY_SIZE_128   0
 AES Cryptographic key size. More...
 
#define AES_KEY_SIZE_192   1
 
#define AES_KEY_SIZE_256   2
 
#define AES_OFB_MODE   2
 
#define AES_PMODE_CIPHER   1
 
#define AES_PMODE_DECIPHER   0
 AES Processing mode. More...
 
#define AES_START_MODE_AUTO   1
 
#define AES_START_MODE_DMA   2
 
#define AES_START_MODE_MANUAL   0
 AES Start mode. More...
 
#define AES_URAT_INPUTWRITE_DMA   0
 AES URAD Type. More...
 
#define AES_URAT_MRWRITE_PROCESS   2
 
#define AES_URAT_MRWRITE_SUBKEY   4
 
#define AES_URAT_OUTPUTREAD_PROCESS   1
 
#define AES_URAT_OUTPUTREAD_SUBKEY   3
 
#define AES_URAT_READ_WRITEONLY   5
 

Functions

void aes_configure (volatile avr32_aes_t *aes, const aes_config_t *pAesConfig)
 Configure the AES. More...
 
unsigned int aes_get_status (volatile avr32_aes_t *aes)
 Get the AES status. More...
 
void aes_isr_configure (volatile avr32_aes_t *aes, const aes_isrconfig_t *pAesIsrConfig)
 Configure the AES interrupts. More...
 
static __always_inline void aes_load_newseed (volatile avr32_aes_t *aes)
 Trigger the load of a new seed in the AES internal random number generator (used for security counter measures). More...
 
void aes_read_outputdata (volatile avr32_aes_t *aes, unsigned int *pOut)
 Read the 128/64/32/16/8bit input data. More...
 
void aes_set_initvector (volatile avr32_aes_t *aes, const unsigned int *pVector)
 Set the 128bit initialization vector (for the CBC, CFB, OFB & CTR cipher modes) More...
 
void aes_set_key (volatile avr32_aes_t *aes, const unsigned int *pKey)
 Set the 128/192/256bit cryptographic key. More...
 
static __always_inline void aes_start (volatile avr32_aes_t *aes)
 Start the cipher/decipher process [manual mode only]. More...
 
static __always_inline void aes_swreset (volatile avr32_aes_t *aes)
 Perform a software reset of the AES. More...
 
void aes_write_inputdata (volatile avr32_aes_t *aes, const unsigned int *pIn)
 Write the 128/64/32/16/8bit input data. More...
 

#define AES_CBC_MODE   1

Referenced by main().

#define AES_CFB_MODE   3
#define AES_CTR_MODE   4
#define AES_ECB_MODE   0

AES Operation cipher mode.

Referenced by main().

#define AES_KEY_SIZE_128   0

AES Cryptographic key size.

Referenced by main().

#define AES_KEY_SIZE_192   1
#define AES_KEY_SIZE_256   2

Referenced by main().

#define AES_OFB_MODE   2
#define AES_PMODE_CIPHER   1

Referenced by main().

#define AES_PMODE_DECIPHER   0

AES Processing mode.

Referenced by main().

#define AES_START_MODE_AUTO   1

Referenced by main().

#define AES_START_MODE_DMA   2

Referenced by main().

#define AES_START_MODE_MANUAL   0

AES Start mode.

Referenced by main().

#define AES_URAT_INPUTWRITE_DMA   0

AES URAD Type.

#define AES_URAT_MRWRITE_PROCESS   2
#define AES_URAT_MRWRITE_SUBKEY   4
#define AES_URAT_OUTPUTREAD_PROCESS   1
#define AES_URAT_OUTPUTREAD_SUBKEY   3
#define AES_URAT_READ_WRITEONLY   5

Referenced by aes_int_handler().

void aes_configure ( volatile avr32_aes_t *  aes,
const aes_config_t pAesConfig 
)

Configure the AES.

Parameters
*aesBase address of the AES
*pAesConfigParameters for the AES configuration
Note
See the aes_config_t structure definition for the meaning of the parameters.

References AES_CKEY, aes_config_t::CFBSize, aes_config_t::CounterMeasureMask, aes_config_t::KeySize, aes_config_t::LodMode, aes_config_t::OpMode, aes_config_t::ProcessingDelay, aes_config_t::ProcessingMode, and aes_config_t::StartMode.

Referenced by main().

unsigned int aes_get_status ( volatile avr32_aes_t *  aes)

Get the AES status.

Parameters
*aesBase address of the AES
Returns
the content of the AES_ISR register

Referenced by aes_int_handler().

void aes_isr_configure ( volatile avr32_aes_t *  aes,
const aes_isrconfig_t pAesIsrConfig 
)

Configure the AES interrupts.

Parameters
*aesBase address of the AES
*pAesIsrConfigParameters for the AES interrupts configuration
Note
See the aes_isrconfig_t structure definition for the meaning of the parameters.

References aes_isrconfig_t::datrdy, Disable_global_interrupt, Enable_global_interrupt, Is_global_interrupt_enabled, and aes_isrconfig_t::urad.

Referenced by main().

static __always_inline void aes_load_newseed ( volatile avr32_aes_t *  aes)
static

Trigger the load of a new seed in the AES internal random number generator (used for security counter measures).

Parameters
*aesBase address of the AES
void aes_read_outputdata ( volatile avr32_aes_t *  aes,
unsigned int *  pOut 
)

Read the 128/64/32/16/8bit input data.

Parameters
*aesBase address of the AES
*pOutPointer on 4/2/1 pre-allocated contiguous 32bit words.

References AES_CFB_MODE.

Referenced by aes_int_handler().

void aes_set_initvector ( volatile avr32_aes_t *  aes,
const unsigned int *  pVector 
)

Set the 128bit initialization vector (for the CBC, CFB, OFB & CTR cipher modes)

Parameters
*aesBase address of the AES
*pVectorPointer on 4 contiguous 32bit words.

References i.

Referenced by main(), and test_ram_aes_ram().

void aes_set_key ( volatile avr32_aes_t *  aes,
const unsigned int *  pKey 
)

Set the 128/192/256bit cryptographic key.

Parameters
*aesBase address of the AES
*pKeyPointer on 4/6/8 contiguous 32bit words.
Note
The key size depends on the AES configuration (KeySize parameter of the aes_config_t).

Referenced by main(), and test_ram_aes_ram().

static __always_inline void aes_start ( volatile avr32_aes_t *  aes)
static

Start the cipher/decipher process [manual mode only].

Parameters
*aesBase address of the AES

Referenced by main().

static __always_inline void aes_swreset ( volatile avr32_aes_t *  aes)
static

Perform a software reset of the AES.

Parameters
*aesBase address of the AES

Referenced by aes_int_handler().

void aes_write_inputdata ( volatile avr32_aes_t *  aes,
const unsigned int *  pIn 
)

Write the 128/64/32/16/8bit input data.

Parameters
*aesBase address of the AES
*pInPointer on 4/2/1 contiguous 32bit words.

References AES_CFB_MODE.

Referenced by main().