YAARX: Yet Another ARX Toolkit
0.1
|
Common functions used in the analysis of block cipher XTEA. More...
Functions | |
void | xtea_r (uint32_t nrounds, uint32_t v[2], uint32_t const k[4], uint32_t lsh_const, uint32_t rsh_const) |
uint32_t | xtea_f (uint32_t x, uint32_t k, uint32_t delta, uint32_t lsh_const, uint32_t rsh_const) |
uint32_t | xtea_f_i (const uint32_t mask_i, const uint32_t lsh_const, const uint32_t rsh_const, const uint32_t x_in, const uint32_t k, const uint32_t delta) |
uint32_t | xtea_f2 (uint32_t xx, uint32_t x, uint32_t k, uint32_t delta, uint32_t lsh_const, uint32_t rsh_const) |
uint32_t | xtea_f2_i (const uint32_t mask_i, const uint32_t lsh_const, const uint32_t rsh_const, const uint32_t xx_in, const uint32_t x_in, const uint32_t k, const uint32_t delta) |
uint32_t | xtea_f_lxr (uint32_t x, uint32_t lsh_const, uint32_t rsh_const) |
uint32_t | xtea_f_lxr_i (const uint32_t mask_i, const uint32_t lsh_const, const uint32_t rsh_const, const uint32_t x_in) |
void | xtea_all_round_keys_and_deltas (uint32_t key[4], uint32_t round_key[64], uint32_t round_delta[64]) |
double | xtea_one_round_xor_differential_exper (uint64_t npairs, int round_idx, uint32_t key, uint32_t delta, uint32_t daa, uint32_t da, uint32_t db) |
double | xtea_one_round_add_differential_exper (uint64_t npairs, int round_idx, uint32_t key, uint32_t delta, uint32_t da, uint32_t db) |
double | xtea_xor_differential_exper_v2 (uint64_t npairs, int r, uint32_t key[4], uint32_t da[2], uint32_t db[2], uint32_t lsh_const, uint32_t rsh_const) |
double | xtea_add_differential_exper_v2 (uint64_t npairs, int r, uint32_t key[4], uint32_t da[2], uint32_t db[2], uint32_t lsh_const, uint32_t rsh_const) |
uint32_t | xtea_xor_verify_differential (uint32_t nrounds, uint32_t npairs, uint32_t lsh_const, uint32_t rsh_const, uint32_t key[4], uint32_t dxx_init, differential_t trail[NROUNDS]) |
uint32_t | xtea_add_verify_differential (uint32_t nrounds, uint32_t npairs, uint32_t lsh_const, uint32_t rsh_const, uint32_t key[4], differential_t trail[NROUNDS]) |
uint32_t | xtea_xor_verify_trail (uint32_t nrounds, uint32_t npairs, uint32_t round_key[64], uint32_t round_delta[64], uint32_t dxx_init, differential_t trail[NROUNDS]) |
uint32_t | xtea_add_verify_trail (uint32_t nrounds, uint32_t npairs, uint32_t round_key[64], uint32_t round_delta[64], differential_t trail[NROUNDS]) |
Common functions used in the analysis of block cipher XTEA.
double xtea_add_differential_exper_v2 | ( | uint64_t | npairs, |
int | r, | ||
uint32_t | key[4], | ||
uint32_t | da[2], | ||
uint32_t | db[2], | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const | ||
) |
Experimentally verify the probability of an r
round ADD differential for XTEA, for a fixed key, over a number of chosen plaintexts.
uint32_t xtea_add_verify_differential | ( | uint32_t | nrounds, |
uint32_t | npairs, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const, | ||
uint32_t | key[4], | ||
differential_t | trail[NROUNDS] | ||
) |
Given an ADD trail for rounds of XTEA, experimentally verify the probabilities of the corresponding differentials:
- Differential for 1 round: round 0. - Differential for 2 rounds: rounds \form#316. - Differential for 3 rounds: rounds \form#317. - \form#318 - Differential for \form#315 rounds: rounds \form#319.
uint32_t xtea_add_verify_trail | ( | uint32_t | nrounds, |
uint32_t | npairs, | ||
uint32_t | round_key[64], | ||
uint32_t | round_delta[64], | ||
differential_t | trail[NROUNDS] | ||
) |
Experimentally verify the probability of all 1-round differentials from which an N round ADD trail for XTEA is composed.
void xtea_all_round_keys_and_deltas | ( | uint32_t | key[4], |
uint32_t | round_key[64], | ||
uint32_t | round_delta[64] | ||
) |
Compute all round keys and round constants of block cipher XTEA.
key | initial key. |
round_key | all round keys. |
round_delta | all round constants of XTEA. |
uint32_t xtea_f | ( | uint32_t | x, |
uint32_t | k, | ||
uint32_t | delta, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const | ||
) |
The F-function of block cipher XTEA: .
x | input to . |
k | round key. |
delta | round constant. |
lsh_const | LSH constant (default is 4). |
rsh_const | RSH constant (default is 5). |
uint32_t xtea_f2 | ( | uint32_t | xx, |
uint32_t | x, | ||
uint32_t | k, | ||
uint32_t | delta, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const | ||
) |
The F-function of block cipher XTEA including the modular addition with the input to the previous Fesitel round. It is denoted by and is defined as:
,
where is the XTEA F-function (xtea_f).
x | first input to . |
xx | second input to . |
k | round key. |
delta | round constant. |
lsh_const | LSH constant (default is 4). |
rsh_const | RSH constant (default is 5). |
uint32_t xtea_f2_i | ( | const uint32_t | mask_i, |
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const, | ||
const uint32_t | xx_in, | ||
const uint32_t | x_in, | ||
const uint32_t | k, | ||
const uint32_t | delta | ||
) |
The F'-function of block cipher XTEA (xtea_f2) computed on the first i
least-significant (LS) bits.
mask_i | i bit LSB mask. |
lsh_const | LSH constant (default is 4). |
rsh_const | RSH constant (default is 5). |
x_in | first input to . |
xx_in | second input to . |
k | round key. |
delta | round constant. |
x_in
and xx_in
must be minimum (rsh_const
+ 1) bits long so that it can be shifted right by rsh_const
positions.uint32_t xtea_f_i | ( | const uint32_t | mask_i, |
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const, | ||
const uint32_t | x_in, | ||
const uint32_t | k, | ||
const uint32_t | delta | ||
) |
The F-function of block cipher XTEA (xtea_f) computed on the first i
least-significant (LS) bits.
mask_i | i bit LSB mask. |
lsh_const | LSH constant (default is 4). |
rsh_const | RSH constant (default is 5). |
x_in | input to . |
k | round key. |
delta | round constant. |
x_in
must be minimum (rsh_const
+ 1) bits long so that it can be shifted right by rsh_const
positions.uint32_t xtea_f_lxr | ( | uint32_t | x, |
uint32_t | lsh_const, | ||
uint32_t | rsh_const | ||
) |
This function represents a sub-component of the XTEA F-function denoted by and defined as: .
x | input to . |
lsh_const | LSH constant (default is 4). |
rsh_const | RSH constant (default is 5). |
uint32_t xtea_f_lxr_i | ( | const uint32_t | mask_i, |
const uint32_t | lsh_const, | ||
const uint32_t | rsh_const, | ||
const uint32_t | x_in | ||
) |
The component of the XTEA F-function (xtea_f_lxr) computed on the first i
least-significant (LS) bits.
mask_i | i bit LSB mask. |
lsh_const | LSH constant (default is 4). |
rsh_const | RSH constant (default is 5). |
x_in | first input to . |
x_in
must be minimum (rsh_const
+ 1) bits long so that it can be shifted right by rsh_const
positions.double xtea_one_round_add_differential_exper | ( | uint64_t | npairs, |
int | round_idx, | ||
uint32_t | key, | ||
uint32_t | delta, | ||
uint32_t | da, | ||
uint32_t | db | ||
) |
Experimentally verify the probability of an ADD differential for 1 round of XTEA, for a fixed key and round constant, over a number of chosen plaintexts.
double xtea_one_round_xor_differential_exper | ( | uint64_t | npairs, |
int | round_idx, | ||
uint32_t | key, | ||
uint32_t | delta, | ||
uint32_t | daa, | ||
uint32_t | da, | ||
uint32_t | db | ||
) |
Experimentally verify the probability of a XOR differential for 1 round of XTEA, for a fixed key and round constant, over a number of chosen plaintexts.
void xtea_r | ( | uint32_t | nrounds, |
uint32_t | v[2], | ||
uint32_t const | k[4], | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const | ||
) |
Round-reduced version of block cipher XTEA. Reference: https://en.wikipedia.org/wiki/XTEA.
nrounds | number of rounds (1 nrounds 64). |
v | plaintext. |
k | secret key. |
lsh_const | LSH constant (default is 4). |
rsh_const | RSH constant (default is 5). |
double xtea_xor_differential_exper_v2 | ( | uint64_t | npairs, |
int | r, | ||
uint32_t | key[4], | ||
uint32_t | da[2], | ||
uint32_t | db[2], | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const | ||
) |
Experimentally verify the probability of an r
round XOR differential for XTEA, for a fixed key, over a number of chosen plaintexts.
uint32_t xtea_xor_verify_differential | ( | uint32_t | nrounds, |
uint32_t | npairs, | ||
uint32_t | lsh_const, | ||
uint32_t | rsh_const, | ||
uint32_t | key[4], | ||
uint32_t | dxx_init, | ||
differential_t | trail[NROUNDS] | ||
) |
Given an XOR trail for rounds of XTEA, experimentally verify the probabilities of the corresponding differentials:
- Differential for 1 round: round 0. - Differential for 2 rounds: rounds \form#316. - Differential for 3 rounds: rounds \form#317. - \form#318 - Differential for \form#315 rounds: rounds \form#319.
nrounds | number of rounds covered by the trail (NROUNDS). |
npairs | number of chosen plaintext pairs (NPAIRS). |
lsh_const | LSH constant (TEA_LSH_CONST). |
rsh_const | RSH constant (TEA_RSH_CONST). |
key | cryptographic key of XTEA. |
dxx_init | first input difference to XTEA function (xtea_f2) for round . |
trail | differential trail for nrounds . |
uint32_t xtea_xor_verify_trail | ( | uint32_t | nrounds, |
uint32_t | npairs, | ||
uint32_t | round_key[64], | ||
uint32_t | round_delta[64], | ||
uint32_t | dxx_init, | ||
differential_t | trail[NROUNDS] | ||
) |
Experimentally verify the probability of all 1-round differentials from which an N round XOR trail for XTEA is composed.