YAARX: Yet Another ARX Toolkit  0.1
 All Data Structures Files Functions Variables Macros Pages
speckey-best-linear-search-tests.cc File Reference

Automatic search for the best XOR differential trail in block cipher Speckey – optimized version by Yann Le Corre.. More...

#include "common.hh"
#include "xlp-add.hh"

Data Structures

struct  Correlation
 

Macros

#define SPECKEY_LEFT_ROT_CONST   7
 
#define SPECKEY_RIGHT_ROT_CONST   2
 
#define STRINGIFY_(x)   #x
 
#define STRINGIFY(x)   STRINGIFY_(x)
 

Typedefs

typedef std::array
< Correlation,
g_best_B_ref.size()+1 > 
SideTrail
 
typedef std::array< SideTrail, 2 > FullTrail
 

Enumerations

enum  Side {
  LEFT = 0, RIGHT = 1, LEFT = 0, RIGHT = 1,
  LEFT = 0, RIGHT = 1, LEFT = 0, RIGHT = 1
}
 

Functions

void finalize (std::chrono::seconds startTime)
 
void speckey_print_linear_trail (FullTrail &T)
 
void speckey_round_masks_to_add_masks (const uint32_t ml_prev, const uint32_t mr_prev, const uint32_t ml, const uint32_t mr, const uint32_t rot_const, uint32_t *alpha, uint32_t *beta, uint32_t *gamma)
 
bool speckey_best_linear_search_i (const uint32_t iround, const int32_t ibit, const uint32_t alpha_in, const uint32_t beta_in, const uint32_t gamma_in, const uint32_t iGamma_R_in)
 
bool speckey_best_linear_search ()
 
void speckey_find_bound (void)
 
int main (int argc, char *argv[])
 

Variables

const uint32_t g_r1 = SPECKEY_LEFT_ROT_CONST % WORD_SIZE
 
const uint32_t g_r2 = SPECKEY_RIGHT_ROT_CONST % WORD_SIZE
 
const std::array< int, 15 > g_best_B_ref
 
std::array< int,
g_best_B_ref.size()> 
g_best_B
 
int g_Bn
 
FullTrail g_T
 
uint64_t nNodes
 
unsigned int g_nRounds
 

Detailed Description

Automatic search for the best XOR differential trail in block cipher Speckey – optimized version by Yann Le Corre..

Author
V.Velichkov, vesse.nosp@m.lin..nosp@m.velic.nosp@m.hkov.nosp@m.@uni..nosp@m.lu, Yann Le Corre, yann..nosp@m.leco.nosp@m.rre@u.nosp@m.ni.l.nosp@m.u
Date
2012-2016

Function Documentation

void finalize ( std::chrono::seconds  startTime)

Print number of visited nodes and computation speed

int main ( int  argc,
char *  argv[] 
)

Main function.

bool speckey_best_linear_search_i ( const uint32_t  iround,
const int32_t  ibit,
const uint32_t  alpha_in,
const uint32_t  beta_in,
const uint32_t  gamma_in,
const uint32_t  iGamma_R_in 
)

Search for the best linear trail of SPECK32/Speckey.

Parameters
iroundcurrent round: $ 0 \ge r < g_nRounds$
ibitcurrent bit position (from w-1 to -1)
alphafirst input mask to the 1st addition of round iround
betasecond input mask to the 1st addition of round iround
gammaoutput mask from the1st addition of round iround
iGamma_R_infirst right input mask to the iround-th round (the left part is iGamma_L_in and the output masks are oGamma_L and oGamma_R)
See Also
speckey_best_linear_search_i
void speckey_print_linear_trail ( FullTrail &  T)

Print trail T up to- and including round nrounds

See Also
speck_print_linear_trail
void speckey_round_masks_to_add_masks ( const uint32_t  ml_prev,
const uint32_t  mr_prev,
const uint32_t  ml,
const uint32_t  mr,
const uint32_t  rot_const,
uint32_t *  alpha,
uint32_t *  beta,
uint32_t *  gamma 
)

From the input and output masks of one round, extract the input and output masks of the addtion, using the following relations:

alpha_i = ml_{i-1} beta_i = mr_{i-1} ^ (mr_i >>> rot_const) gamma_i = ml_i ^ mr_i

Parameters
ml_prevleft input mask to one round
mr_prevright input mask to one round
mlleft output mask from one round
mrright output mask from one round
alphafirst input mask to the modular adition of one round
betasecond input mask to the modular adition of one round
gammaoutput mask from the modular adition of one round
See Also
speck_round_masks_to_add_masks

Variable Documentation

const std::array<int, 15> g_best_B_ref
Initial value:
=
{{
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
}}