YAARX: Yet Another ARX Toolkit  0.1
 All Data Structures Files Functions Variables Macros Pages
adp-arx.hh File Reference

Header file for adp-arx.cc: More...

Go to the source code of this file.

Macros

#define ADP_ARX_MSIZE   8
 
#define ADP_ARX_NMATRIX   8
 
#define ADP_ARX_NINPUTS   2
 
#define ADP_ARX_COLSUM   4
 
#define ADP_ARX_NSPOS   2
 
#define ADP_ARX_NORM   1.0 /(double)ADP_ARX_COLSUM
 
#define ADP_ARX_NISTATES   4
 
#define ADP_ARX_NFSTATES   2
 

Functions

void adp_arx_alloc_matrices (gsl_matrix *A[2][2][2][2])
 
void adp_arx_free_matrices (gsl_matrix *A[2][2][2][2])
 
void adp_arx_normalize_matrices (gsl_matrix *A[2][2][2][2])
 
void adp_arx_print_matrices (gsl_matrix *A[2][2][2][2])
 
void adp_arx_sf (gsl_matrix *A[2][2][2][2])
 
double adp_arx (gsl_matrix *A[2][2][2][2], uint32_t rot_const, uint32_t da, uint32_t db, uint32_t dd, uint32_t de)
 
double adp_arx_exper (uint32_t r, uint32_t da, uint32_t db, uint32_t dd, uint32_t de)
 

Variables

uint32_t ADP_ARX_ISTATES [ADP_ARX_NISTATES]
 
uint32_t ADP_ARX_FSTATES [ADP_ARX_NISTATES][ADP_ARX_NFSTATES]
 

Detailed Description

Header file for adp-arx.cc:

Author
V.Velichkov, vesse.nosp@m.lin..nosp@m.velic.nosp@m.hkov.nosp@m.@uni..nosp@m.lu
Date
2012-2013

Macro Definition Documentation

#define ADP_ARX_COLSUM   4

Sum of non-zero elements in one column of the $\mathrm{adp}^{\mathrm{ARX}}$ matrices.

#define ADP_ARX_MSIZE   8

Number of state values in the $\mathrm{adp}^{\mathrm{ARX}}$ S-function.

#define ADP_ARX_NFSTATES   2

Number of final states for the $\mathrm{adp}^{\mathrm{ARX}}$ S-function; To every initial state out of all ADP_ARX_NISTATES, corresponds a set of ADP_ARX_FSTATES final states.

See Also
ADP_ARX_ISTATES, ADP_ARX_FSTATES.
#define ADP_ARX_NINPUTS   2

Number of inputs to the ARX operation.

#define ADP_ARX_NISTATES   4

Number of initial states for the $\mathrm{adp}^{\mathrm{ARX}}$ S-function; To every initial state out of all ADP_ARX_NISTATES, corresponds a set of ADP_ARX_FSTATES final states.

See Also
ADP_ARX_ISTATES, ADP_ARX_FSTATES.
#define ADP_ARX_NMATRIX   8

Number of $\mathrm{adp}^{\mathrm{ARX}}$ matrices.

#define ADP_ARX_NORM   1.0 /(double)ADP_ARX_COLSUM

Normalization factor for the $\mathrm{adp}^{\mathrm{ARX}}$ matrices.

#define ADP_ARX_NSPOS   2

Number of special bit positions for the $\mathrm{adp}^{\mathrm{ARX}}$ matrices - two: $j=0$ if $(i+r)=0$ and $j=1$ otherwise.

Function Documentation

double adp_arx ( gsl_matrix *  A[2][2][2][2],
uint32_t  rot_const,
uint32_t  da,
uint32_t  db,
uint32_t  dd,
uint32_t  de 
)

The additive differential probability of ARX $\mathrm{adp}^{\mathrm{ARX}}$. Complexity: $O(n)$.

Parameters
Atransition probability matrices for $\mathrm{adp}^{\mathrm{ARX}}$ computed with adp_arx_sf.
rot_constrotation constant.
dafirst input difference (input to ADD).
dbsecond input difference (input to ADD).
ddthird input difference (input to XOR).
deoutput difference (output from ARX).
Returns
$\mathrm{adp}^{\mathrm{ARX}}(da,db,dd \rightarrow de)$.
Note
If $a,b,d$ and $e$ are values that satisfy the differences $da,db,dd$ and $de$ respectively, then the ARX operation is defined as: $e = (((a + b) \ll< r) \oplus d)$.
void adp_arx_alloc_matrices ( gsl_matrix *  A[2][2][2][2])

Allocate memory for the transition probability matrices for $\mathrm{adp}^{\mathrm{ARX}}$.

Parameters
Atransition probability matrices for $\mathrm{adp}^{\mathrm{ARX}}$.
See Also
adp_arx_free_matrices
double adp_arx_exper ( uint32_t  r,
uint32_t  da,
uint32_t  db,
uint32_t  dd,
uint32_t  de 
)

The additive differential probability of ARX ( $\mathrm{adp}^{\mathrm{ARX}}$) computed experimentally over all inputs. Complexity: $O(2^{4n})$.

Parameters
rrotation constant.
dafirst input difference (input to ADD).
dbsecond input difference (input to ADD).
ddthird input difference (input to XOR).
deoutput difference (output from ARX).
Returns
$\mathrm{adp}^{\mathrm{ARX}}(da,db,dd \rightarrow de)$.
See Also
adp_arx
void adp_arx_free_matrices ( gsl_matrix *  A[2][2][2][2])

Free memory reserved by a previous call to adp_arx_alloc_matrices.

Parameters
Atransition probability matrices for $\mathrm{adp}^{\mathrm{ARX}}$.
void adp_arx_normalize_matrices ( gsl_matrix *  A[2][2][2][2])

Transform the elements of A into probabilities.

Parameters
Atransition probability matrices for $\mathrm{adp}^{\mathrm{ARX}}$.
void adp_arx_print_matrices ( gsl_matrix *  A[2][2][2][2])

Print the matrices for $\mathrm{adp}^{\mathrm{ARX}}$.

Parameters
Atransition probability matrices for $\mathrm{adp}^{\mathrm{ARX}}$.
void adp_arx_sf ( gsl_matrix *  A[2][2][2][2])

S-function for $\mathrm{adp}^{\mathrm{ARX}}$: $\mathrm{adp}^{\mathrm{ARX}}(da,db,dd \rightarrow de)$.

Parameters
Azero-initialized set of matrices.
Returns
Transition probability matrices A for $\mathrm{adp}^{\mathrm{ARX}}(da,db,dd \rightarrow de)$.

$A[2][2][2][2] = A[j][dc[i]][dd[i+r]][de[i+r]]$, where

  • $r$ : rotation constant.
  • $dc[i]$ : the $i$-th bit of the first input difference.
  • $dd[i+r]$ : the $(i+r)$-th bit of the second input difference.
  • $dd[i+r]$ : the $(i+r)$-th bit of the output difference.
  • $j$ : special bit postion:
    1. $ j = 0 \Rightarrow (i+r) = 0$.
    2. $ j = 1 \Rightarrow (i+r) \neq 0$.
Note
At bit position $i: (i+r) = 0$, a special set of matrices is generated for which the carries generated at position $(i+r)$ in the differences $dd,de$ are set to 0.

Variable Documentation

uint32_t ADP_ARX_FSTATES[ADP_ARX_NISTATES][ADP_ARX_NFSTATES]

Array of final states for the S-function of $\mathrm{adp}^{\mathrm{ARX}}$: adp_arx_sf. Every set of final states corresponds to a unique initial state (ADP_ARX_ISTATES).

uint32_t ADP_ARX_ISTATES[ADP_ARX_NISTATES]

Array of initial states for the S-function of $\mathrm{adp}^{\mathrm{ARX}}$: adp_arx_sf.