ATmega644 Smart-Card
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Hiding Class Reference

Class that implements 2 hiding techniques: dummy-ops & shuffling. More...

#include <hiding.h>

Collaboration diagram for Hiding:
Collaboration graph

Public Member Functions

 Hiding ()=default
 Construct a new Hiding object.
 
void init ()
 Initialize AES hiding operations. More...
 
void shuffleSBoxAccess (uint8_t indices[])
 Shuffle the S-Box access. More...
 
void dummyOp ()
 Perform a dummy NOP operation a random number of times.
 

Private Member Functions

void shuffleArray (uint8_t array[], const uint8_t size)
 Shuffle an array using the Fisher-Yates shuffle. More...
 

Private Attributes

uint8_t mNumbersDummyOps [NUMBER_OPS] = {}
 Array of random numbers, which specify the number of dummy ops per round.
 
uint8_t mNoOpCounter = 0
 Counter for the number of dummy ops per round.
 
RNG mRNG
 Random number generator.

 

Static Private Attributes

static constexpr uint8_t MAX_NUMBER_NO_OPS = 100
 The maximum number of NOPs per AES execution. It is important that this number stays the same for every AES execution.
 
static constexpr uint8_t NUMBER_OPS = 40
 The number of operations before which the dummy ops are executed.
 
static uint8_t DEFAULT_INV_SBOX_INDICES [STATE_BYTES]
 Array that contains values from 0 to 15.
 

Detailed Description

Class that implements 2 hiding techniques: dummy-ops & shuffling.

As a counter-measure against DPA attacks, hiding can be used to randomize the timing behaviour of the AES en-/decryption. This can be done by adding random dummy-ops or by randomly shuffling the S-Box access.

Authors
Philipp Karg (phili.nosp@m.pp.k.nosp@m.arg@t.nosp@m.um.d.nosp@m.e)
Date
04.07.2022

Member Function Documentation

◆ init()

void Hiding::init ( )

Initialize AES hiding operations.

  1. Seed the RNG.
  2. Init the dummy ops by creating an array of random numbers, w which will be the number of dummy ops per round. It is important that the total number of dummy ops stays the same for every AES execution.

◆ shuffleArray()

void Hiding::shuffleArray ( uint8_t  array[],
const uint8_t  size 
)
private

Shuffle an array using the Fisher-Yates shuffle.

Parameters
[in,out]array(uint8_t []): Array to shuffle.
[in]size(const uint8_t): Size of the array.

◆ shuffleSBoxAccess()

void Hiding::shuffleSBoxAccess ( uint8_t  indices[])

Shuffle the S-Box access.

Randomize the S-Box access by shuffling the indices of the S-Box.

Parameters
[out]indices(uint8_t []): Array of indices of the S-Box.

The documentation for this class was generated from the following file: