YAARX: Yet Another ARX Toolkit
0.1
|
Header file for xdp-tea-f-fk.cc. More...
Go to the source code of this file.
Functions | |
double | xdp_f_fk_exper (const uint32_t da, const uint32_t db, const uint32_t k0, const uint32_t k1, const uint32_t delta, uint32_t lsh_const, uint32_t rsh_const) |
double | max_xdp_f_fk_dx_exper (uint32_t *max_dx, const uint32_t dy, const uint32_t k0, const uint32_t k1, const uint32_t delta, uint32_t lsh_const, uint32_t rsh_const) |
double | max_xdp_f_fk_dy_exper (const uint32_t dx, uint32_t *max_dy, const uint32_t k0, const uint32_t k1, const uint32_t delta, uint32_t lsh_const, uint32_t rsh_const) |
bool | xdp_f_is_sat (const uint32_t mask_i, const uint32_t lsh_const, const uint32_t rsh_const, const uint32_t k0, const uint32_t k1, const uint32_t delta, const uint32_t dx, const uint32_t dy, int32_t x) |
bool | xdp_f_check_x (const uint32_t lsh_const, const uint32_t rsh_const, const uint32_t k0, const uint32_t k1, const uint32_t delta, const uint32_t dx, const uint32_t dy, const uint32_t x) |
uint32_t | xdp_f_assign_bit_x (const uint32_t n, const uint32_t i, const uint32_t mask_i, const uint32_t x, const uint32_t lsh_const, const uint32_t rsh_const, const uint32_t k0, const uint32_t k1, const uint32_t delta, const uint32_t dx, const uint32_t dy, uint32_t *x_cnt, double *prob) |
double | xdp_f_fk (const uint32_t n, const uint32_t dx, const uint32_t dy, const uint32_t k0, const uint32_t k1, const uint32_t delta, const uint32_t lsh_const, const uint32_t rsh_const) |
uint32_t | xdp_f_assign_bit_x_dx (const uint32_t n, const uint32_t i, const uint32_t mask_i, const uint32_t x, const uint32_t lsh_const, const uint32_t rsh_const, const uint32_t k0, const uint32_t k1, const uint32_t delta, const uint32_t dx, const uint32_t dy, uint64_t *x_cnt, double *ret_prob, uint32_t *ret_dx) |
double | max_dx_xdp_f_fk (const uint32_t n, uint32_t *ret_dx, const uint32_t dy, const uint32_t k0, const uint32_t k1, const uint32_t delta, const uint32_t lsh_const, const uint32_t rsh_const) |
uint32_t | xdp_f_assign_bit_x_dy (const uint32_t n, const uint32_t i, const uint32_t mask_i, const uint32_t x, const uint32_t lsh_const, const uint32_t rsh_const, const uint32_t k0, const uint32_t k1, const uint32_t delta, const uint32_t dx, const uint32_t dy, uint64_t *x_cnt, double *ret_prob, uint32_t *ret_dy) |
double | max_dy_xdp_f_fk (const uint32_t n, const uint32_t dx, uint32_t *ret_dy, const uint32_t k0, const uint32_t k1, const uint32_t delta, const uint32_t lsh_const, const uint32_t rsh_const) |
Header file for xdp-tea-f-fk.cc.
double max_dx_xdp_f_fk | ( | const uint32_t | n, |
uint32_t * | ret_dx, | ||
const uint32_t | dy, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const | ||
) |
For given output difference dy
, compute the maximum probability input differences dx
over all input differences: . Complexity: . Memory: Bytes.
n | word size. |
ret_dx | maximum probability input difference. |
dy | output difference. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
double max_dy_xdp_f_fk | ( | const uint32_t | n, |
const uint32_t | dx, | ||
uint32_t * | ret_dy, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const | ||
) |
For given input difference dx
, compute the maximum probability output difference dy
over all output differences: . Complexity: . Memory requirement: Bytes.
n | word size. |
dx | input difference. |
ret_dy | maximum probability output difference. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
double max_xdp_f_fk_dx_exper | ( | uint32_t * | max_dx, |
const uint32_t | dy, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const | ||
) |
For given output difference dy
, compute the maximum probability input differences dx
over all input differences: through exhaustive search over all input values and input differences. Complexity: .
max_dx | maximum probability input difference. |
dy | output difference. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
double max_xdp_f_fk_dy_exper | ( | const uint32_t | dx, |
uint32_t * | max_dy, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const | ||
) |
For given input difference dx
, compute the maximum probability output difference dy
over all output differences: through exhaustive search over all input values and input differences. Complexity: .
dx | input difference. |
max_dy | maximum probability output difference. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
uint32_t xdp_f_assign_bit_x | ( | const uint32_t | n, |
const uint32_t | i, | ||
const uint32_t | mask_i, | ||
const uint32_t | x, | ||
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
const uint32_t | dx, | ||
const uint32_t | dy, | ||
uint32_t * | x_cnt, | ||
double * | prob | ||
) |
Counts the number of values x
for which the differential for the F-function of TEA is satisfied. The function operates by recursively assigning the bits of x
starting from bit position i
and terminating at the MS bit n
. The recursion proceeds to bit only if the differential is satisfied on the i
LS bits. This is checked by applying xdp_f_is_sat.
n | word size (terminating bit popsition). |
i | current bit position. |
mask_i | mask on the i LS bits of x . |
x | input value of size at least (i + rsh_const ). |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
dx | input difference. |
dy | output difference. |
x_cnt | number of values satisfying . |
prob | the fixed-key XOR probability of F: . |
1
if satisfies ; 0
otherwise. uint32_t xdp_f_assign_bit_x_dx | ( | const uint32_t | n, |
const uint32_t | i, | ||
const uint32_t | mask_i, | ||
const uint32_t | x, | ||
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
const uint32_t | dx, | ||
const uint32_t | dy, | ||
uint64_t * | x_cnt, | ||
double * | ret_prob, | ||
uint32_t * | ret_dx | ||
) |
For given output difference dy
, compute all input differences dx
and their probabilities, by counting all values x
that satisfy the differential for a fixed key and round constant. At the same time keeps track of the maximum probability input difference.
The function works by recursively assigning the bits of x
and dx
starting at bit position i
and terminating at the MS bit n
. The recursion proceeds to bit only if the differential is satisfied on the i
LS bits. This is checked by applying xdp_f_is_sat .
n | word size (terminating bit popsition). |
i | current bit position. |
mask_i | mask on the i LS bits of x . |
x | input value of size at least (i + rsh_const ). |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
dx | input difference. |
dy | output difference. |
x_cnt | array of counters - each one keeps track of the number of values satisfying for every dx . |
ret_prob | the maximum probability over all input differences . |
ret_dx | the input difference that has maximum probability. |
1
if satisfies ; 0
otherwise.uint32_t xdp_f_assign_bit_x_dy | ( | const uint32_t | n, |
const uint32_t | i, | ||
const uint32_t | mask_i, | ||
const uint32_t | x, | ||
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
const uint32_t | dx, | ||
const uint32_t | dy, | ||
uint64_t * | x_cnt, | ||
double * | ret_prob, | ||
uint32_t * | ret_dy | ||
) |
For given input difference dx
, compute all output differences dy
and their probabilities, by counting all values x
that satisfy the differential for a fixed key and round constant. At the same time keeps track of the maximum probability output difference.
The function works by recursively assigning the bits of x
and dy
starting at bit position i
and terminating at the MS bit n
. The recursion proceeds to bit only if the differential is satisfied on the i
LS bits. This is checked by applying xdp_f_is_sat.
n | word size (terminating bit popsition). |
i | current bit position. |
mask_i | mask on the i LS bits of x . |
x | input value of size at least (i + rsh_const ). |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
dx | input difference. |
dy | output difference. |
x_cnt | array of counters - each one keeps track of the number of values satisfying for every dy . |
ret_prob | the maximum probability over all output differences . |
ret_dy | the output difference that has maximum probability. |
1
if satisfies ; 0
otherwise.bool xdp_f_check_x | ( | const uint32_t | lsh_const, |
const uint32_t | rsh_const, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
const uint32_t | dx, | ||
const uint32_t | dy, | ||
const uint32_t | x | ||
) |
Check if a given value x
satisfies the XOR differential for the TEA F-function.
lsh_const | LSH constant. |
rsh_const | RSH constant. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
dx | input difference. |
dy | output difference. |
x | input value. |
double xdp_f_fk | ( | const uint32_t | n, |
const uint32_t | dx, | ||
const uint32_t | dy, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const | ||
) |
Compute the fixed-key, fixed-constant XOR differential probability of the F-function of block cipher TEA: . Complexity: .
n | word size. |
dx | input difference. |
dy | output difference. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
double xdp_f_fk_exper | ( | const uint32_t | da, |
const uint32_t | db, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const | ||
) |
Compute the fixed-key, fixed-constant XOR differential probability of the F-function of block cipher TEA: through exhaustive search over all input values. Complexity: .
da | input difference. |
db | output difference. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
bool xdp_f_is_sat | ( | const uint32_t | mask_i, |
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const, | ||
const uint32_t | k0, | ||
const uint32_t | k1, | ||
const uint32_t | delta, | ||
const uint32_t | dx, | ||
const uint32_t | dy, | ||
int32_t | x | ||
) |
Check if the differential for F
is satisfied on the i
LS bits of x
i.e. check if .
x
must be of size at least bits where R
is the RSH constant of F
.mask_i | i bit mask. |
lsh_const | LSH constant. |
rsh_const | RSH constant. |
k0 | first round key. |
k1 | second round key. |
delta | round constant. |
dx | input difference. |
dy | output difference. |
x | input value of size at least (i + rsh_const ). |