Skip to content

Framework for side-channel attacks through power consumption using the Correlation Power Analysis (CPA) attack method. This implementation includes attacks on AES-128 and ASCON-128. As a baseline were used scripts developed by Léo Weissbart and Łukasz Chmielewski, provided by the CESCA Lab (https://cescalab.cs.ru.nl/).

Notifications You must be signed in to change notification settings

Qas1modo/CPA-Framework

Repository files navigation

CPA Framework

Framework for side-channel attacks through power consumption using the Correlation Power Analysis (CPA) attack method. This implementation includes attacks on AES-128 and ASCON-128. As a baseline were used scripts developed by Leo Weissbart and Łukasz Michał Chmielewski, provided by the CESCA Lab.

How to set up:

Install Python 3.13.2

Download and unzip

cd /tmp
wget https://www.python.org/ftp/python/3.13.5/Python-3.13.5.tgz
tar -xvf Python-3.13.5.tgz
cd Python-3.13.5

Install required libraries and compile Python

sudo apt install -y build-essential libssl-dev libffi-dev libbz2-dev liblzma-dev libsqlite3-dev libreadline-dev libncurses5-dev zlib1g-dev tk-dev libgdbm-dev libdb5.3-dev libexpat1-dev
./configure --enable-optimizations
make -j$(nproc)
sudo make altinstall

Check if it is correctly installed

python3.13 --version

Setup venv and clone repo

cd ~
git clone https://github.com/Qas1modo/CPA-Framework
cd CPA-Framework
mkdir venv
python3.13 -m venv ./venv

Activate venv (temporary)

source ./venv/bin/activate

Install packages

python -m pip install --upgrade pip setuptools wheel
python -m pip install numpy
python -m pip install numba
python -m pip install trsfile
python -m pip install tqdm
python -m pip install pandas
python -m pip install scipy
python -m pip install matplotlib

Set up PYTHONPATH to project root

Temporary

export PYTHONPATH="~/CPA-Framework:$PYTHONPATH"

Permanent

echo 'export PYTHONPATH="~/CPA-Framework:$PYTHONPATH"' >> ~/.bashrc

Sometimes this does not work with '~', specify full path when it happens.

Install libraries for measurement script (Optional)

python -m pip install smartleia
git clone https://github.com/cw-leia/smartleia-target
cd smartleia-target
python3 -m pip install .
cd ..
rm -rf ./smartleia-target
python3 -m pip install picosdk
python3 -m pip install pycryptodome

How to use:

Configuration

All user configuration is located in the Configuration folder. Modify relevant files and their values to match your preferences.

What you can run

Use the framework

If you want to use the framework for a new SCA attack, you can use Generics by inheritance.

  • Generic Attacker ⇒ Has the necessary functionality to perform SCA attack (automatic alignment, ...).
  • Generic Extractor ⇒ Helps you with running the attack on multiple targets and prints results.
  • Generic Logger ⇒ Helps you with logging the attack performance.
  • Generic Parallel Writer ⇒ Has the functionality to parallelly write/read TRS, NPY and NPZ files.
  • Generic Trace Loader ⇒ Implement reading of TRS, NPY and NPZ files with their metadata.
  • Generic Trace Writer ⇒ Implement reading/writing of TRS, NPY and NPZ files with their metadata.
  • Generic Trace Creator ⇒ Used to create traces in TRS, NPY and NPZ file formats without input files.

About

Framework for side-channel attacks through power consumption using the Correlation Power Analysis (CPA) attack method. This implementation includes attacks on AES-128 and ASCON-128. As a baseline were used scripts developed by Léo Weissbart and Łukasz Chmielewski, provided by the CESCA Lab (https://cescalab.cs.ru.nl/).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages