Global Sources
EE Times-India
Stay in touch with EE Times India
EE Times-India > Embedded

Boost efficiency of embedded encryption apps

Posted: 12 Jul 2013     Print Version  Bookmark and Share

Keywords:Advanced Encryption Standard  microcontroller  AES-128  CPU  FIFO 

To ensure the safe and secure transfer of data from source to destination, encryption has turned into a mandatory technology for secure applications. The most commonly used encryption techniques utilise a deterministic algorithm with an unvarying transformation operating on fixed-length blocks of data. Examples of such techniques include Advanced Encryption Standard (AES), Data Encryption Standard (DES), International Data Encryption Algorithm (IDEA) and Rivest Cipher (RC5).

Such a "block cipher" approach, however, puts a constraint on the throughput, data processing, and buffering capacities of the hardware since encryption has to be performed before the next chunk of data arrives. A good number of industrial encryption systems support data rates higher than 200Mbit/s, but the hardware to achieve this, generally an ASIC, is very expensive as compared to a simple microcontroller (MCU).

Though it is possible to implement encryption on a simple 8bit MCU with external memory, such as an 8051, the time taken to perform encryption is on an order of magnitude of the time required by an ASIC. This article explains how an SoC with programmable logic can make use of the MCU core along with additional hardware features like Universal Digital Blocks (UDBs) and Direct Memory Access (DMA) to efficiently implement encryption and improve the overall timing of the system.

AES is one of the most commonly used block cipher techniques to implement symmetric key cryptography. We will use AES-128 as an example, which operates on a chunk of 16B (128 bits) of data processed with a 128bit cipher key, to demonstrate the requirements of an encryption application and potential implementation options. With AES-128, the input bytes are arranged in the form of a block before the processing begins, as illustrated in figure 1. In the figure, in0 is the first byte and in15 is the 16th and last byte of the input block.

Figure 1: Input bytes.

Byte substitution
Byte substitution is the first operation. At this stage, each byte of the input block is replaced with a byte selected from the already known substitution table. The selected value is present at the location at the table pointed to by the two nibbles of the input byte as shown in figure 2. The substitution of any byte in row and column can be expressed as:

The substitution table is generally hard-coded in the device (Flash, SRAM, etc). When the CPU is assigned the task of byte substitution, it will fetch the input byte from the program memory and pass it on as an address to the SRAM. The SRAM will then return the byte present at that location. This procedure will take a lot of time before substitution for the whole block is complete.

Figure 2: Byte substitution.

In order to offload the CPU from doing all these operations, substitution can take place concurrently with the help of DMAs to free the CPU for other tasks. Only the source and the destination address of the memory has to be assigned to the DMA, and it will take care of the data transfers. Moreover, instead of passing on these values to some specific memory locations, DMA can directly transfer the data to the UDBs for further processing without any CPU intervention.

Row shifting
The next stage in AES is Row Shifting. At this stage, each row of the byte substituted input block is shifted left by one byte. The byte shifted out then takes place of the right-most byte. For the first row, no shifting takes place. For the second row, byte shifting takes place once, twice for the third row and three times for the fourth row. This procedure is illustrated in figure 3.

Figure 3: Row shifting.

1 • 2 • 3 Next Page Last Page

Comment on "Boost efficiency of embedded encrypt..."
*  You can enter [0] more charecters.
*Verify code:


Visit Asia Webinars to learn about the latest in technology and get practical design tips.


Go to top             Connect on Facebook      Follow us on Twitter      Follow us on Orkut

Back to Top