Microchip® Advanced Software Framework

aes_sw_lib_demo.c File Reference
#include <asf.h>
#include "conf_example.h"
#include "crypt.h"

Functions

static void configure_usart (void)
 Function Prototypes. More...
 
void HardFault_Handler (void)
 Hard fault handler to handle if any hard fault occurs. More...
 
int main (void)
 Main application function.
-> Initialize clock
-> Initialize USART for print functions
-> Initialize AES to generate Key schedule for AES-128
-> Based on the AES mode enabled in conf_example.h file,
execute encryption and decryption of a message and
compare them against input data to check its functionality.
-> The decrypted message can be viewed on the COM port terminal
. More...
 

Variables

uint8_t cText [64]
 
uint8_t init_vector []
 
uint8_t key_vectors []
 
uint8_t pText [64] = {"Input_Text_blck1Input_Text_blck2Input_Text_blck3Input_Text_blck4"}
 
uint8_t pText1 [64]
 
struct usart_module usart_instance
 Support and FAQ: visit Microchip Support More...
 

static void configure_usart ( void  )
static

Function Prototypes.

Initialize USART to communicate with on board EDBG - SERCOM with the following settings.

Configure EDBG USART for stdio function.

  • 8-bit asynchronous USART
  • No parity
  • One stop bit
  • 115200 baud
void HardFault_Handler ( void  )

Hard fault handler to handle if any hard fault occurs.

int main ( void  )

Main application function.
-> Initialize clock
-> Initialize USART for print functions
-> Initialize AES to generate Key schedule for AES-128
-> Based on the AES mode enabled in conf_example.h file,
execute encryption and decryption of a message and
compare them against input data to check its functionality.
-> The decrypted message can be viewed on the COM port terminal
.

Warning
CBC mode is done at the last as it process input plain text during encryption and so the plain text value is not retained. For testing purpose, to preserve the input plan text for testing with other modes, this mode is added at the last.

References aes_init(), cbc_decrypt(), cbc_encrypt(), cfb_decrypt(), cfb_encrypt(), configure_usart(), ctr_blk_t::counter, cText, ctr_encrypt_decrypt(), ecb_decrypt(), ecb_encrypt(), i, ctr_blk_t::i_vector, init_vector, key_vectors, ctr_blk_t::nonce, ofb_encrypt(), printf, pText, pText1, and system_init().

uint8_t cText[64]

Referenced by main().

uint8_t init_vector[]
Initial value:
= {0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f}

Referenced by main().

uint8_t key_vectors[]
Initial value:
= {0x2b, 0x7e, 0x15, 0x16,
0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88,
0x09, 0xcf, 0x4f, 0x3c}

Referenced by main().

uint8_t pText[64] = {"Input_Text_blck1Input_Text_blck2Input_Text_blck3Input_Text_blck4"}

Referenced by main().

uint8_t pText1[64]

Referenced by main().