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

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

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

Data Structures

struct  Correlation
 

Macros

#define MARX_LEFT_ROT_CONST   3
 
#define MARX_RIGHT_ROT_CONST   6
 
#define MARX_LEFT_ROT_CONST_V2   6
 
#define MARX_RIGHT_ROT_CONST_V2   1
 
#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 marx_print_linear_trail (FullTrail &T)
 
void marx_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 marx_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 delta_in, const uint32_t lambda_in, const uint32_t eta_in, const uint32_t iGamma_R_in, const uint32_t iLambda_R_in)
 
bool marx_best_linear_search ()
 
void marx_find_bound (void)
 
int main (int argc, char *argv[])
 

Variables

const uint32_t g_r1 = MARX_LEFT_ROT_CONST % WORD_SIZE
 
const uint32_t g_r2 = MARX_RIGHT_ROT_CONST % WORD_SIZE
 
const uint32_t g_r3 = MARX_LEFT_ROT_CONST_V2 % WORD_SIZE
 
const uint32_t g_r4 = MARX_RIGHT_ROT_CONST_V2 % 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 MARX – 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 marx_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  delta_in,
const uint32_t  lambda_in,
const uint32_t  eta_in,
const uint32_t  iGamma_R_in,
const uint32_t  iLambda_R_in 
)

Search for the best linear trail of MARX (Threefish-256/MIX + ARX)

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
deltafirst input mask to the 2nd addition of round iround
lambdasecond input mask to the 2nd addition of round iround
etaoutput mask from the 2nd 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)
iLambda_R_insecond right input mask to the iround-th round (the left part is iLambda_L_in and the output masks are oLambda_L and oLambda_R)
See Also
speck_best_linear_search_i
void marx_print_linear_trail ( FullTrail &  T)

Print trail T up to- and including round nrounds

See Also
speck_print_linear_trail
void marx_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,
}}