Giter Site home page Giter Site logo

dpacalc's Introduction

DPA Calc

Table of Contents

Introduction

DPA Calc implements the Differential Power Analysis (DPA). DPA allows discovering the secret key stored into secure embedded systems by exploiting the correlation between the power consumed by a device and the data being processed. Currently, DPA Calc is specifically developed for analysing AES, as it is the standard block cipher. However, it can be easily extended to support any block cipher algorithm.

This repository has two branches:

  • Eigen-version - compute the analysis using the computation resources of the available CPUs
  • OpenCL-GPU-version - compute the analysis using the computation resources of the available GPUs

Version

1.0

Dependencies

The compilation of DPA Calc requires the installation of cmake 2.6 or higher. Furthermore, if using the OpenCL-GPU-version branch, OpenCL installation, with the C++ wrapper (cl.hpp), is also required.

The rest of the dependencies can be found in the folder dependencies, namely Eigen, PAPI and Tclap, and they are not required to be installed.

Compiling DPA Calc

After having all the dependencies compiled and installed just need to invoke the following command

make

If everything goes fine a binary executable file named dpacalc is created in folder out.

Executing DPA Calc

From the main folder, run the following command:

./out/dpacalc --filename <Input File> --mlock

where

  • Input File is the path of the input file

An example of an execution using the file t10s5004fk16.dat as input:

./out/dpacalc --filename t10s5004fk16.dat --mlock

Input File Structure

The input file is in binary format, where bytes are interpreted as follows:

  • a header with informations about:
    • the number of traces
    • the number of samples per trace
    • the format of each sample (b for int8, f for float, d for double)
    • the length of a plain/cipher text in byte
  • a list of traces with a plain/cipher text attached to each trace

An input example:

--- header ---
00000000 00000000 00000000 00000010 [uint32 - 2]
00000000 00000000 00000000 00000011 [uint32 - 3]
01100010 [char - b]
00000010 [uint8 - 2]
--- trace 1 ----
00000100 00000011 00000010 [samples]
XXXXXXXX XXXXXXXX [plain / cipher text]
--- trace 2 ----
00000001 00000011 00000110 [samples]
XXXXXXXX XXXXXXXX [plain / cipher text]

Interpreting Output

The output besides showing the most likely key also shows complementary information about execution of the DPA Calc. This information can be divided in three sections:

  1. Initialization
  2. Execution
  3. Results

Initialization

alt text

This section starts by displaying the compilation options and the name of the classes to compute each module. Then, it is shown the how many platforms are installed in the used system, describing the platforms with one or more GPUs. Subsequently, a detailed information about each found GPU is presented. Finally, the header of the input file is shown.

Execution

alt text

This section is useful in runtime, as it shows the current state of the execution. The states are:

  1. Read Known Data
  2. Create command queues
  • create one for each thread created
  1. Create program object
  • Compile and build all kernels for each device
  1. Generate all hypothetical values and map them to power values
  2. Calculate the PM pre computation
  3. Compute the statistical test
  • For each batch is shown
    • the number of the batch
    • the number of the first sample
    • how many samples are in the batch
    • the number of the device that computed the batch
    • the number of the thread that issued the computation of the batch

Results

alt text

The last section of the output presents the most likely key and the total execution time. In the example of the figure, the execution took 4 seconds, approximately, and the best hypothesis for the first byte of the key is 2b.

dpacalc's People

Contributors

jnpa avatar sil-van avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.