We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

# Xcell Daily Blog

Showing results for
Do you mean

## Adam Taylor’s MicroZed Chronicles Part 96: SDSoC In-Depth Example Part 3

by ‎08-17-2015 10:23 AM - edited ‎01-06-2016 01:14 PM (19,455 Views)

Having explained the detailed steps needed for the AES encryption and decryption algorithms, we now need to know the order in which these steps are applied within a round and whether we apply all of these steps for each round or just some of them.

Each AES encryption round consists of the following ordered steps:

1. Substitute Bytes
2. Shift Rows
3. Mix Columns (for rounds 1 to N-1 Only)
4. Add Round Key – using the expanded key

Important note: the final round does not contain the Mix Columns stage.

Of course we need to be able to reverse the process and turn the unreadable ciphertext back into plain text so that the encrypted information will be useful. To do this we need order the steps as below:

1. Invert Shift Rows
2. Invert Substitute Bytes
3. Add Round Key – using the expanded key
4. Invert Mix Columns (for rounds 1 to N-1 Only)

Note:, prior to the first round being executed we need to perform an initial Add Round Key operation for both encryption and decryption.

The final part of the AES crypto explanation is to explain the algorithm we use for expanding the key, which provides sufficient key bits for the number of Add Round Key steps to be performed. Depending upon the key size in bytes (16, 24, or 32 bytes), the key expansion will require a number of rounds (44, 52, or 60). The first bytes of the expanded key are equal to the initial key. This means for our AES256 example the first 32 bytes of the expanded key are the key itself. Key expansion generates the 32 additional bits for the expanded key in each iteration.

The key expansion steps are:

1. Rotate Word: Similar to Shift Rows this re organises a 32 bit word such that the most significant byte becomes the least significant byte.
2. Substitute Word: This uses the same substitution box used in the encryption to make byte substitutions.
3. Rcon: This stage performs the exponentiation of 2 to a user defined value, as with the Mix Columns stage this is performed over the Galois field (28) as such it is common to use a pre-calculated look up table.
4. EK: This returns four bytes from the expanded key
5. K: Like EK this returns four bytes from the key

The algorithm used for key expansion is demonstrated below (Taken from NIST standard):

So how will we know that we have correctly implemented the encryption and key expansion algorithms? Rather helpfully the AES specification made available by the National Institute of Standards and Technology contain a number of worked examples that we can use for checking that we have implemented the algorithm for encryption and key expansion correctly. You can find the specification here.

In the next blog we will look at the implementation we have created using the Xilinx SDSoC development environment and how it performs using software running on the dual-core ARM Cortex-A9 MPCore processor in the Zynq SoC before we accelerate functions using the Zynq SoC’s on-chip programmable logic.

Please see the previous entries in this MicroZed Chronicles series by Adam Taylor:

Adam Taylor’s MicroZed(ish) Chronicles Part 83: Simple Communication Interfaces Part 3

Adam Taylor’s MicroZed Chronicles Microzed Chronicles Part 77 – Introducing the Zynq SoC’s Ethernet

Adam Taylor’s MicroZed Chronicles, Part 70: Constraints—Introduction to timing and defining a clock

Adam Taylor’s MicroZed Chronicles Part 61: PicoBlaze Part Six

Adam Taylor’s MicroZed Chronicles Part 59: The Zynq and the PicoBlaze Part 4

Adam Taylor’s MicroZed Chronicles Part 58: The Zynq and the PicoBlaze Part 3

Adam Taylor’s MicroZed Chronicles Part 56: The Zynq and the PicoBlaze

Adam Taylor’s MicroZed Chronicles Part 55: Linux on the Zynq SoC

Adam Taylor’s MicroZed Chronicles Part 52: One year and 151,000 views later. Big, Big Bonus PDF!

Adam Taylor’s MicroZed Chronicles Part 46: Using both of the Zynq SoC’s ARM Cortex-A9 Cores

Adam Taylor’s MicroZed Chronicles Part 44: MicroZed Operating Systems—FreeRTOS

Adam Taylor’s MicroZed Chronicles MicroZed Part 42: MicroZed Operating Systems Part 4

Adam Taylor’s MicroZed Chronicles MicroZed Part 41: MicroZed Operating Systems Part 3

Adam Taylor’s MicroZed Chronicles MicroZed Part 40: MicroZed Operating Systems Part Two

Adam Taylor’s MicroZed Chronicles MicroZed Part 39: MicroZed Operating Systems Part One

Adam Taylor’s MicroZed Chronicles MicroZed Part 38 – Answering a question on Interrupts

Adam Taylor’s MicroZed Chronicles Part 37: Driving Adafruit RGB NeoPixel LED arrays with MicroZed Part 8

Adam Taylor’s MicroZed Chronicles Part 36: Driving Adafruit RGB NeoPixel LED arrays with MicroZed Part 7

Adam Taylor’s MicroZed Chronicles Part 35: Driving Adafruit RGB NeoPixel LED arrays with MicroZed Part 6

Adam Taylor’s MicroZed Chronicles Part 34: Driving Adafruit RGB NeoPixel LED arrays with MicroZed Part 5

Adam Taylor’s MicroZed Chronicles Part 33: Driving Adafruit RGB NeoPixel LED arrays with the Zynq SoC

Adam Taylor’s MicroZed Chronicles Part 32: Driving Adafruit RGB NeoPixel LED arrays

Adam Taylor’s MicroZed Chronicles Part 31: Systems of Modules, Driving RGB NeoPixel LED arrays

Adam Taylor’s MicroZed Chronicles Part 30: The MicroZed I/O Carrier Card

Zynq DMA Part Two – Adam Taylor’s MicroZed Chronicles Part 29

The Zynq PS/PL, Part Seven: Adam Taylor’s MicroZed Chronicles Part 27

The Zynq PS/PL, Part Six: Adam Taylor’s MicroZed Chronicles Part 26

The Zynq PS/PL, Part Five: Adam Taylor’s MicroZed Chronicles Part 25

The Zynq PS/PL, Part Four: Adam Taylor’s MicroZed Chronicles Part 24

The Zynq PS/PL, Part Three: Adam Taylor’s MicroZed Chronicles Part 23

The Zynq PS/PL, Part Two: Adam Taylor’s MicroZed Chronicles Part 22

The Zynq PS/PL, Part One: Adam Taylor’s MicroZed Chronicles Part 21

Introduction to the Zynq Triple Timer Counter Part Four: Adam Taylor’s MicroZed Chronicles Part 20

Introduction to the Zynq Triple Timer Counter Part Three: Adam Taylor’s MicroZed Chronicles Part 19

Introduction to the Zynq Triple Timer Counter Part Two: Adam Taylor’s MicroZed Chronicles Part 18

Introduction to the Zynq Triple Timer Counter Part One: Adam Taylor’s MicroZed Chronicles Part 17

The Zynq SoC’s Private Watchdog: Adam Taylor’s MicroZed Chronicles Part 16

Implementing the Zynq SoC’s Private Timer: Adam Taylor’s MicroZed Chronicles Part 15

MicroZed Timers, Clocks and Watchdogs: Adam Taylor’s MicroZed Chronicles Part 14

MicroZed Interrupts: Adam Taylor’s MicroZed Chronicles Part 12

Using the MicroZed Button for Input: Adam Taylor’s MicroZed Chronicles Part 11

Driving the Zynq SoC's GPIO: Adam Taylor’s MicroZed Chronicles Part 10

Meet the Zynq MIO: Adam Taylor’s MicroZed Chronicles Part 9

Getting the XADC Running on the MicroZed: Adam Taylor’s MicroZed Chronicles Part 7

Figuring out the MicroZed Boot Loader – Adam Taylor’s MicroZed Chronicles, Part 5

Running your programs on the MicroZed – Adam Taylor’s MicroZed Chronicles, Part 4

Zynq and MicroZed say “Hello World”-- Adam Taylor’s MicroZed Chronicles, Part 3

Adam Taylor’s MicroZed Chronicles: Setting the SW Scene

Bringing up the Avnet MicroZed with Vivado

Latest Articles