This directory contains the design files corresponding to the TCHES'23 paper "RDS: FPGA Routing Delay Sensors for Effective Remote Power Analysis Attacks" by David Spielmann, Ognjen Glamočanin, and Mirjana Stojilović.
Overview:
│ │
│ └───README.md
│ │
│ └───LICENSE.md
│ │
│ └───description_hw.md: Description of all hardware modules used in the project.
│ │
│ └───description_sw.md: Description of all software functions used in the project.
│
└───alveo/
│ │
│ └───bitstreams/: Directory containing the bitstreams used for the experiments on the Alveo U200 Datacenter Card.
│ │
│ └───constraints/: Directory containing the constraints for RDS and TDC sensors.
│ │
│ └───rtl/: Directory containing the hardware files needed to create the project of the Alveo U200 Datacenter Card.
│ │
│ └───soft/: Directory containing all the software files need to collect the power traces on the Alveo U200 Datacenter Card.
│ │
│ └───tcl/: Directory containing the files that automatically create the project in Vivado by using the files from hw/.
│
└───basys3/
│ │
│ └───bitstream/: Directory containing the bitstream used for the temperature experiments on the Digilent Basys 3 board.
│ │
│ └───create_project_AES50MHz_SENSOR200MHz.tcl: TCL file that automatically creates the project in Vivado.
│ │
│ └───hw/: Directory containing all the hardware files needed to create the project of the Digilent Basys 3 board.
│ │
│ └───sw/: Directory containing the software files needed to collect the power traces on the Digilent Basys 3 board.
|
└───figures/: Directory containing the figures of this readme.
│
└───key_rank/: Directory containing the tools required for performing a CPA attack using a collected trace set.
|
└───sakura_x
│
└───bitstreams/: Directory containing all the bitstreams used on the Sakura-X board. The type of the sensor is specified by the name of the folder. The placement of the sensor and the AES is specified in the name of the bitstream.
│
└───hw/: Directory containing all the hardware files needed to create the project on the Sakura-X board.
│ │
│ └───tcl/: Directory containing the TCL scripts to automatically set up a project in Vivado with the desired on-chip sensor.
│
└───sw/: Directory containing the software files needed to collect the power traces on the Sakura-X board.
Fig. 1 shows the trace acquisition methodology used in our paper. For all three boards (Alveo U200, Sakura-X, and Basys3), we follow the same methodology. We first generate the bitstreams, program the FPGA, and collect the AES power traces and ciphertexts. Using the generated data, we run the CPA attack and calculate the key rank estimation metric.
<p style="text-align: center;">Figure 1</p>
The RDS sensor implementation file is located in: alveo/rtl/sensor/sensor_RDS.vhd
. For more details on both the software and hardware modules, please refer to the description_sw.md
and description_hw.md
files.
Fig. 2 shows the architecture of the system used to collect traces on the Alveo U200 board, with each component containing the HDL files that describe it.
<p style="text-align: center;">Figure 2</p>
Follow these steps to collect power traces on the Alveo U200 Datacenter Card. The Alveo U200 experiments were built and run on Ubuntu 20.04.
The RDS sensor implementation file is located in: sakura_x/hw/sources/RDS/sensor.vhd
.
Fig. 3 shows the architecture of the system used to collect traces on the Sakura-X board, with each component containing the HDL files that describe it. For more details on both the software and hardware modules, please refer to the description_sw.md
and description_hw.md
files.
<p style="text-align: center;">Figure 3</p>
Follow these steps to collect power traces on the Sakura-X board. The Sakura-X experiments were built and run on Ubuntu 20.04.
The RDS sensor implementation file is located in: basys3/hw/rtl/sensor/sensor.vhd
.
Fig. 4 shows the architecture of the system used to collect traces on the Basys3 board, with each component containing the HDL files that describe it. For more details on both the software and hardware modules, please refer to the description_sw.md
and description_hw.md
files.
<p style="text-align: center;">Figure 4</p>
Follow these steps to collect power traces on the Digilent Basys 3 board. The Basys 3 experiments were built and run on Ubuntu 20.04.
Content: key_rank/
|CPA_GPU.cu : Main CUDA source file, containing the CPA key rank estimation attack.
|data.cuh : Header file.
|utils.cu : Source file containing the utils such as argument parsing and printing functions.
|utils.cuh : Utils header file.
|Makefile : Makefile for the CUDA CPA attack.
|launch_attack.py : PYTHON script for launching the complete attack (it compiles the CUDA code and runs all the required scripts and programs for the attack).
|calculate_keyrank.py : PYTHON script for generating the Key Rank.
|convert_traces.py : PYTHON script for generating a .data file that contains the traces, from a .bin or a .csv file.
|convert_ciphertexts.py : PYTHON script for generating a .data file that contains the ciphertexts, from a .bin file.
Attack process:
launch_attack.py
script. Use the -h
option for help. It prints the following help:usage: launch_attack.py [-h] -k KEY -t TRACE_FILE -c CIPHERTEXTS_FILE -nt N_TRACES -ns N_SAMPLES -ss STEP_SIZE -o OUTPUT_PATH
==================================================
CPA Key Rank Estimation Attack
==================================================
Short summary:
- This program takes the power consumption traces, ciphertexts, and the last round key and computes the log2 key rank estimation metric using CPA.
- The ouput of this program are the upper and lower bounds of the log2(key rank) metric, in a .csv file.
optional arguments:
-h, --help show this help message and exit
-k KEY, --key KEY Last round key of 16 bytes, in hexadecimal value.
Example: -k e07f16bdb9e50346a2277cd382774270
-t TRACE_FILE, --trace_file TRACE_FILE
Path to trace file.
Example: -t /home/user/documents/data/traces.bin
-c CIPHERTEXTS_FILE, --ciphertexts_file CIPHERTEXTS_FILE
Path to ciphertext file.
Example: -c /home/user/documents/data/ciphertexts.bin
-nt N_TRACES, --n_traces N_TRACES
Number of traces (encryptions) in the trace file.
Example: -nt 10000
-ns N_SAMPLES, --n_samples N_SAMPLES
Number of sampler per trace (trace length).
Example: -ns 128
-ss STEP_SIZE, --step_size STEP_SIZE
Step size for the attacks.
Example: -ss 1000
-o OUTPUT_PATH, --output_path OUTPUT_PATH
Path to output directory.
Example: -o /home/user/documents/data/results/
python3 launch_attack.py -k e07f16bdb9e50346a2277cd382774270 -t ~/work/tmp/data/sensor_traces_hw_100k.bin -c ~/work/tmp/data/ciphertexts.bin -nt 100000 -ns 128 -ss 1000 -o ~/work/tmp/results/
N_SAMPLES
samples, stored as a binary array of uint8_t
values as such (in C syntax): uint8_t trace_array[N_SAMPLES];
fwrite(trace_array, sizeof(trace_array[0]), N_SAMPLES, trace_file_f);
uint8_t
values as such (in C syntax): uint8_t ciphertext[16];
fwrite(ciphertext, sizeof(ciphertext[0]), N_SAMPLES, ciphertext_file_f);
N_SAMPLES
and N_TRACES
parameters must match the number of traces and samples in the .bin
files