Microchip® Advanced Software Framework

Advanced Encryption Standard - Example Cipher Operating Modes and DMA

Purpose

This example demonstrates how to use the AES driver to perform:

  • ECB encryption and decryption
  • CBC encryption and decryption
  • CFB encryption and decryption
  • OFB encryption and decryption
  • CTR encryption and decryption
  • ECB encryption and decryption using DMA/PDC

Requirements

All SAM devices with an AES module can be used. This example has been tested with the following evaluation kits:

  • SAM4E EK
  • SAM4C EK

Description

Upon startup, the program uses the USART driver to display a menu from which several encryption/decryption modes can be tested.

Main Files

Compilation Info

This software was written for the GNU GCC and IAR Systems compiler. Other compilers may or may not work.

Usage

  1. Build the program and download it into the evaluation board.
  2. On the computer, open and configure a terminal application (e.g., HyperTerminal on Microsoft® Windows®) with these settings:
    • 115200 baud
    • 8 bits of data
    • No parity
    • 1 stop bit
    • No flow control
  3. Start the application.
  4. In the terminal window, the following text should appear:
        -- AES Example --
        -- xxxxxx-xx
        -- Compiled: xxx xx xxxx xx:xx:xx --
    
        Menu :
          -- Select operation:
          h: Display menu
          1: ECB mode test.
          2: CBC mode test.
          3: CFB128 mode test.
          4: OFB mode test.
          5: CTR mode test.
          d: ECB mode test with DMA
          p: ECB mode test with PDC