YAARX: Yet Another ARX Toolkit
0.1
|
Computing an XOR partial difference distribution table (pDDT) for the F-function of block cipher XTEA. More...
Macros | |
#define | RESTRICT_CROADS 1 |
Functions | |
void | xtea_f_xor_pddt_i (const uint32_t k, const uint32_t n, const uint32_t lsh_const, const uint32_t rsh_const, gsl_matrix *A[2][2][2], gsl_vector *C, uint32_t *da, uint32_t *db, uint32_t *dc, double *p, const double p_thres, std::set< differential_t, struct_comp_diff_dx_dy > *diff_set_dx_dy) |
void | xtea_f_xor_pddt (uint32_t n, double p_thres, uint32_t lsh_const, uint32_t rsh_const, std::set< differential_t, struct_comp_diff_dx_dy > *diff_set_dx_dy) |
bool | xtea_is_dx_in_set_dx_dy (uint32_t dy, uint32_t dx_prev, std::set< differential_t, struct_comp_diff_dx_dy > diff_set_dx_dy) |
bool | xtea_is_dx_in_set_dx_dy_mask_i (uint32_t mask_i, const uint32_t dy, const uint32_t dx_prev, std::set< differential_t, struct_comp_diff_dx_dy > diff_set_dx_dy) |
void | xtea_f_da_db_xor_pddt_i (const uint32_t k, const uint32_t n, const uint32_t lsh_const, const uint32_t rsh_const, gsl_matrix *A[2][2][2], gsl_vector *C, const uint32_t da_prev, const uint32_t da, const uint32_t db, uint32_t *dc, double *p, const double p_thres, std::set< differential_t, struct_comp_diff_dx_dy > *hways_diff_set_dx_dy, std::multiset< differential_t, struct_comp_diff_p > *hways_diff_mset_p, std::set< differential_t, struct_comp_diff_dx_dy > *diff_set_dx_dy, uint32_t *cnt_new) |
uint32_t | xtea_f_da_db_xor_pddt (uint32_t n, double p_thres, uint32_t lsh_const, uint32_t rsh_const, const uint32_t da_prev, const uint32_t da_in, std::set< differential_t, struct_comp_diff_dx_dy > *hways_diff_set_dx_dy, std::multiset< differential_t, struct_comp_diff_p > *hways_diff_mset_p, std::set< differential_t, struct_comp_diff_dx_dy > *diff_set_dx_dy) |
void | xtea_xor_pddt_adjust_to_key (uint32_t nrounds, uint32_t npairs, uint32_t lsh_const, uint32_t rsh_const, uint32_t key, uint32_t delta, double p_thres, std::set< differential_t, struct_comp_diff_dx_dy > *diff_set_dx_dy) |
void | xtea_xor_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) |
Computing an XOR partial difference distribution table (pDDT) for the F-function of block cipher XTEA.
uint32_t xtea_f_da_db_xor_pddt | ( | uint32_t | n, |
double | p_thres, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const, | ||
const uint32_t | da_prev, | ||
const uint32_t | da_in, | ||
std::set< differential_t, struct_comp_diff_dx_dy > * | hways_diff_set_dx_dy, | ||
std::multiset< differential_t, struct_comp_diff_p > * | hways_diff_mset_p, | ||
std::set< differential_t, struct_comp_diff_dx_dy > * | diff_set_dx_dy | ||
) |
Wrapper for xtea_f_da_db_xor_pddt_i
void xtea_f_da_db_xor_pddt_i | ( | const uint32_t | k, |
const uint32_t | n, | ||
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const, | ||
gsl_matrix * | A[2][2][2], | ||
gsl_vector * | C, | ||
const uint32_t | da_prev, | ||
const uint32_t | da, | ||
const uint32_t | db, | ||
uint32_t * | dc, | ||
double * | p, | ||
const double | p_thres, | ||
std::set< differential_t, struct_comp_diff_dx_dy > * | hways_diff_set_dx_dy, | ||
std::multiset< differential_t, struct_comp_diff_p > * | hways_diff_mset_p, | ||
std::set< differential_t, struct_comp_diff_dx_dy > * | diff_set_dx_dy, | ||
uint32_t * | cnt_new | ||
) |
Add entries to the pDDT for fixed input diference da and a given prob. threshold. The same as xtea_f_xor_pddt_i, but da is fixed .
void xtea_f_xor_pddt | ( | uint32_t | n, |
double | p_thres, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const, | ||
std::set< differential_t, struct_comp_diff_dx_dy > * | diff_set_dx_dy | ||
) |
Compute an XOR partial DDT (pDDT) for the XTEA F-function: wrapper function of xtea_f_xor_pddt_i . By definition a pDDT contains only differentials that have probability above a fixed probability thershold.
n | word size (default is WORD_SIZE). |
p_thres | probability threshold (default is XTEA_XOR_P_THRES). |
lsh_const | LSH constant (TEA_LSH_CONST). |
rsh_const | RSH constant (TEA_RSH_CONST). |
diff_set_dx_dy | set of differentials in the pDDT ordered by index ; stored in an STL set structure, internally implemented as a Red-Black binary search tree. |
void xtea_f_xor_pddt_i | ( | const uint32_t | k, |
const uint32_t | n, | ||
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const, | ||
gsl_matrix * | A[2][2][2], | ||
gsl_vector * | C, | ||
uint32_t * | da, | ||
uint32_t * | db, | ||
uint32_t * | dc, | ||
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.
k | current bit position in the recursion. |
n | word size (default is WORD_SIZE). |
lsh_const | LSH constant (TEA_LSH_CONST). |
rsh_const | RSH constant (TEA_RSH_CONST). |
A | transition probability matrices for ADD (xdp_add_sf). |
C | unit column vector for computing (xdp_add). |
da | input difference to the F-function of XTEA. |
db | output difference from the component of F ((xtea_f_lxr)). |
dc | output difference from the F-function of XTEA. |
p | probability of the partially constructed differential for the ADD operation in F. |
p_thres | probability threshold (default is XTEA_XOR_P_THRES). |
diff_set_dx_dy | set of differentials in the pDDT ordered by index ; stored in an STL set structure, internally implemented as a Red-Black binary search tree. |
Algorithm Outline:
bool xtea_is_dx_in_set_dx_dy | ( | uint32_t | dy, |
uint32_t | dx_prev, | ||
std::set< differential_t, struct_comp_diff_dx_dy > | diff_set_dx_dy | ||
) |
For a given difference dx, check if in the list of differentials set_dx_dy exists an entry (dx -> dy)
bool xtea_is_dx_in_set_dx_dy_mask_i | ( | uint32_t | mask_i, |
const uint32_t | dy, | ||
const uint32_t | dx_prev, | ||
std::set< differential_t, struct_comp_diff_dx_dy > | diff_set_dx_dy | ||
) |
Same as is_dx_in_set_dx_dy but on the mask_i LSBs .
void xtea_xor_pddt_adjust_to_key | ( | uint32_t | nrounds, |
uint32_t | npairs, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const, | ||
uint32_t | key, | ||
uint32_t | delta, | ||
double | p_thres, | ||
std::set< differential_t, struct_comp_diff_dx_dy > * | diff_set_dx_dy | ||
) |
Adjust the probabailities of the differentials in a pDDT computed with xtea_f_xor_pddt , to the value of a fixed key by performing one-round TEA encryptions over a number of chosen plaintext pairs drawn uniformly at random.
nrounds | total number of rounds (NROUNDS). |
npairs | number of chosen plaintext pairs (NPAIRS). |
lsh_const | LSH constant (TEA_LSH_CONST). |
rsh_const | RSH constant (TEA_RSH_CONST). |
key | round key. |
delta | round constant. |
p_thres | probability threshold (XTEA_XOR_P_THRES). |
diff_set_dx_dy | set of differentials in the pDDT ordered by index . |
void xtea_xor_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.
diff_mset_p | output pDDT: set of differentials ordered by probability; stored in an STL multiset structure, internally implemented as a Red-Black binary search tree. |
diff_set_dx_dy | input pDDT: set of differentials ordered by index ; stored in an STL set structure, internally implemented as a Red-Black binary search tree. |