tree: cef784619d2d8aef02552fc3c3ab617f7e16e88c [path history] [tgz]
  1. .gitignore
  2. aes.c
  3. aes.h
  4. aes_example.c
  5. aes_example.h
  6. aes_model.core
  7. aes_model_sim_opts.hjson
  8. aes_modes.c
  9. aes_modes.core
  10. aes_modes.h
  11. crypto.c
  12. crypto.h
  13. Makefile
  14. README.md
hw/ip/aes/model/README.md

AES Model & OpenSSL/BoringSSL Interface

This directory contains a basic C model of the AES unit's cipher core including OpenSSL/BoringSSL library interface functions. This infrastructure targets functional verification of the AES unit during the design phase as well as actual design verification.

In addition, this directory also contains two example applications.

  1. aes_example:
  • Allows printing of intermediate results for debugging the AES cipher core.
  • Shows how to interface the C model and how to use the OpenSSL/BoringSSL interface.
  • Checks the output of the model versus the expected results.
  • Checks the output of the model versus the output of the BoringSSL/OpenSSL library.
  • Supports ECB mode only.
  1. aes_modes:
  • Shows how to interface the OpenSSL/BoringSSL interface functions.
  • Checks the output of BoringSSL/OpenSSL versus expected results.
  • Supports ECB, CBC, CTR modes.

How to build and run the examples

Open the makefile and update the variable BORING_SSL_PATH pointing to the BoringSSL directory on your machine. If make cannot find the crypto library in that directory, the example is automatically linked to OpenSSL instead of BoringSSL.

Simply execute

make

to build both example applications and

./aes_example KEY_LEN_BYTES

to run aes_example. The optional argument KEY_LEN_BYTES determines the key length in bytes and is either 16, 24, or 32 for AES-128, 192 or 256, respectively. By default, a key length of 16 Bytes is used (AES-128).

To run the second example, simply type

./aes_modes

Details of the model

  • aes.c/h: Contains the C model of the AES unit's cipher core.
  • crypto.c/h: Contains BoringSSL/OpenSSL library interface functions.
  • aes_example.c/h: Contains the first example application including test input and expected output for ECB mode.
  • aes_modes.c/h: Contains the second example application including test input and expected output for ECB, CBC, CTR modes.