YAARX: Yet Another ARX Toolkit  0.1
 All Data Structures Files Functions Variables Macros Pages
xtea-f-add-pddt.cc File Reference

Computing an ADD partial difference distribution table (pDDT) for the F-function of block cipher XTEA. More...

#include "common.hh"
#include "adp-xor.hh"
#include "max-adp-xor.hh"
#include "max-adp-xor-fi.hh"
#include "adp-shift.hh"
#include "tea-f-add-pddt.hh"
#include "xtea.hh"
#include "adp-xtea-f-fk.hh"

Functions

void xtea_f_add_pddt_i (const uint32_t k, const uint32_t n, const uint32_t key, const uint32_t delta, const uint32_t lsh_const, const uint32_t rsh_const, gsl_matrix *A[2][2][2], gsl_matrix *AA[2][2][2], gsl_vector *C, uint32_t *da, uint32_t *db, uint32_t *dc, uint32_t *dd, double *p, const double p_thres, std::set< differential_t, struct_comp_diff_dx_dy > *diff_set_dx_dy)
 
void xtea_f_add_pddt (uint32_t n, double p_thres, uint32_t lsh_const, uint32_t rsh_const, gsl_matrix *A[2][2][2], gsl_matrix *AA[2][2][2], gsl_vector *C, uint32_t key, uint32_t delta, std::set< differential_t, struct_comp_diff_dx_dy > *diff_set_dx_dy)
 
void xtea_add_pddt_dxy_to_dp (std::multiset< differential_t, struct_comp_diff_p > *diff_mset_p, const std::set< differential_t, struct_comp_diff_dx_dy > diff_set_dx_dy)
 

Detailed Description

Computing an ADD partial difference distribution table (pDDT) for the F-function of block cipher XTEA.

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

Function Documentation

void xtea_add_pddt_dxy_to_dp ( std::multiset< differential_t, struct_comp_diff_p > *  diff_mset_p,
const std::set< differential_t, struct_comp_diff_dx_dy diff_set_dx_dy 
)

From a pDDT represented in the from of a set of differentials ordered by index, compute a pDDT as a set of differentials ordered by probability.

Parameters
diff_mset_poutput pDDT: set of differentials $(dx \rightarrow dy)$ ordered by probability; stored in an STL multiset structure, internally implemented as a Red-Black binary search tree.
diff_set_dx_dyinput pDDT: set of differentials $(dx \rightarrow dy)$ ordered by index $i = (dx~ 2^{n} + dy)$; stored in an STL set structure, internally implemented as a Red-Black binary search tree.
See Also
tea_f_add_pddt_dxy_to_dp
void xtea_f_add_pddt ( uint32_t  n,
double  p_thres,
uint32_t  lsh_const,
uint32_t  rsh_const,
gsl_matrix *  A[2][2][2],
gsl_matrix *  AA[2][2][2],
gsl_vector *  C,
uint32_t  key,
uint32_t  delta,
std::set< differential_t, struct_comp_diff_dx_dy > *  diff_set_dx_dy 
)

Compute a partial DDT (pDDT) for the XTEA F-function: wrapper function of xtea_f_add_pddt_i . By definition a pDDT contains only differentials that have probability above a fixed probability thershold.

Parameters
nword size (default is WORD_SIZE).
p_thresprobability threshold (default is XTEA_ADD_P_THRES).
lsh_constLSH constant (TEA_LSH_CONST).
rsh_constRSH constant (TEA_RSH_CONST).
Atransition probability matrices for $\mathrm{adp}^{\oplus}$ (adp_xor_sf).
AAtransition probability matrices for XOR with fixed input $\mathrm{adp}^{\oplus}_{\mathrm{FI}}$ (adp_xor_fixed_input_sf).
Cunit column vector for computing $ \mathrm{adp}^{\oplus}$ (adp_xor).
keyround key.
deltaround constant.
diff_set_dx_dyset of differentials $(dx \rightarrow dy)$ in the pDDT ordered by index $i = (dx~ 2^{n} + dy)$; stored in an STL set structure, internally implemented as a Red-Black binary search tree.
See Also
tea_f_add_pddt_i.
void xtea_f_add_pddt_i ( const uint32_t  k,
const uint32_t  n,
const uint32_t  key,
const uint32_t  delta,
const uint32_t  lsh_const,
const uint32_t  rsh_const,
gsl_matrix *  A[2][2][2],
gsl_matrix *  AA[2][2][2],
gsl_vector *  C,
uint32_t *  da,
uint32_t *  db,
uint32_t *  dc,
uint32_t *  dd,
double *  p,
const double  p_thres,
std::set< differential_t, struct_comp_diff_dx_dy > *  diff_set_dx_dy 
)

Computes an ADD partial difference distribution table (pDDT) for the F-function of block cipher TEA.

Parameters
kcurrent bit position in the recursion.
nword size (default is WORD_SIZE).
keyround key.
deltaround constant.
lsh_constLSH constant (TEA_LSH_CONST).
rsh_constRSH constant (TEA_RSH_CONST).
Atransition probability matrices for XOR $\mathrm{adp}^{\oplus}$ (adp_xor_sf).
AAtransition probability matrices for XOR with fixed input $\mathrm{adp}^{\oplus}_{\mathrm{FI}}$ (adp_xor_fixed_input_sf).
Cunit column vector for computing $ \mathrm{adp}^{\oplus}$ (adp_xor).
dainput difference to the F-function of XTEA.
dboutput difference from the LSH operation in F.
dcoutput difference from the RSH operation in F.
ddoutput difference from the XOR operation in F.
pprobability of the partially constructed differential $(db[k:0], dc[k:0] \rightarrow dd[k:0])$ for the XOR operation in F.
p_thresprobability threshold (default is XTEA_ADD_P_THRES).
diff_set_dx_dyset of differentials $(dx \rightarrow dy)$ in the pDDT ordered by index $i = (dx~ 2^{n} + dy)$; stored in an STL set structure, internally implemented as a Red-Black binary search tree.

Algorithm Outline:

  1. Recursively construct all differentials for the XOR operation in the $f_{\mathrm{LXR}}$ component of the F-function of XTEA (see xtea_f_lxr): $ f_{\mathrm{LXR}}(a) = (((a \ll 4) \oplus (a \gg 5)) $. Note that when doing this, we treat the two inputs $(a \ll 4)$ and $(a \gg 5)$ as independent inputs, denoted respectively by $b$ and $c$. At every bit position in the recursion we require the corresponding partially constructed input differences $da,db,dc$ and the output difference $dd$ to satisfy conditions lsh_condition_is_sat and rsh_condition_is_sat. As a result, after the MSB is processed and $k = n$ the so constructed differences satisfy the following constions (see tea_f_add_pddt_i):
    1. $\mathrm{adp}^{3\oplus}(db, dc \rightarrow dd) > p_\mathrm{thres}$.
    2. $db = da \ll 4$.
    3. $dc \in {(da \ll R), (da \ll R) + 1, (da \ll R) - 2^{n-R}, (da \ll R) - 2^{n-R} + 1}$, so that $dc = (da \ll R)$ where $R =$TEA_RSH_CONST.
  2. Set $dz = da + dd$ according to the feed-forward operation in F (see xtea_f) and compute the maximum probability output difference $dy$ for the ADD operation with round key and $\delta$ (see xtea_f) with one fixed input: $\mathrm{max}~\mathrm{adp}^{\oplus}_{\mathrm{FI}}((\mathrm{key} + \delta),~dz \rightarrow dy)$.
  3. Experimentally adjust the probability of the differential $\mathrm{adp}^{F}(da \rightarrow dy)$ to the full function F using adp_xtea_f_approx . Set the adjusted probability to $\hat{p}$.
  4. Store $(da, dy, \hat{p})$ in the pDDT.
See Also
tea_f_add_pddt_i