YAARX: Yet Another ARX Toolkit  0.1
 All Data Structures Files Functions Variables Macros Pages
rc5-tests.cc File Reference

Tests for rc5-tests.cc . More...

#include "common.hh"
#include "xdp-add.hh"
#include "adp-xor.hh"
#include "max-adp-xor.hh"
#include "adp-rot.hh"
#include "rc5-ref.hh"
#include "rc5-lwcs.hh"
#include "rc5-eq.hh"
#include "rc5-dc.hh"
#include "rc5-alex.hh"
#include "add-approx.hh"
#include "rc5-blind-oracle.hh"

Macros

#define FMT_DEC(n)   std::dec << std::setw((n)) << std::setfill(' ')
 
#define FMT_HEX(n)   std::hex << std::setw((n)) << std::setfill('0')
 

Functions

void rc5_good_pairs_global_arr_to_vec (std::vector< pair_t > *good_pairs_vec, uint32_t arr_len)
 
void test_rc5_lwcs (int argc, const char *argv[])
 
void test_rc5_differential ()
 
void test_rc5_equal_rot_differential ()
 
void rc5_xdp_add_last_round_print_matrices_sage (gsl_matrix *A[2][2][2], gsl_matrix *B[2][2][2][2])
 
void test_rc5_last_round_matrices ()
 
void test_rc5 ()
 
void test_rc5_encrypt_get_intermediate_values ()
 
void test_rc5_good_pairs_goup_filter_debug ()
 
uint32_t rc5_good_pairs_count (const std::vector< pair_t > good_pairs_vec)
 
void test_rc5_fib_main ()
 
void test_rc5_filter_go_up_debug_main ()
 
void test_rc5_last_round_eq_key_contradictions_all_inputs (const gsl_matrix *A[2][2][2], const gsl_matrix *AA[2][2][2][2])
 
void test_rc5_last_round_eq_key ()
 
void test_rc5_last_round_eq_x_find_solutions_exper ()
 
void test_rc5_last_round_eq_x_find_solutions_rec ()
 
void test_rc5_last_round_eq_x_find_solutions_rec_all ()
 
void test_rc5_last_round_eq_x_bit_seq_match ()
 
void test_rc5_last_round_eq_x_bit_seq_match_all ()
 
void test_rc5_last_round_eq_x_bit_seq_match_rand ()
 
void test_rc5_key_struct ()
 
void test_rc5_xdp_add_last_round ()
 
void test_rc5_xdp_add_first_round_all ()
 
void test_rc5_xdp_add_last_round_all ()
 
void test_rc5_xdp_add_last_round_compare_prob_vs_hw_all ()
 
void test_rc5_xdp_add_mid_round_compare_prob_vs_hw_all ()
 
void test_rc5_xdp_add_last_round_diff_set_out_all ()
 
void test_rc5_xdp_add_last_round_diff_set_out_wrapper ()
 
void test_rc5_xdp_add_last_round_diff_set_out ()
 
void test_rc5_mid_round_matrices ()
 
void test_rc5_xdp_add_mid_round_all ()
 
void test_rc5_mid_round_eq_xy_find_solutions_all ()
 
void test_rc5_xdp_add_mid_round_diff_set_out ()
 
void test_rc5_xdp_add_mid_round_diff_set_out_all ()
 
void test_rc5_equal_rot_attack_compute_average_prob_hw ()
 
void test_add_sub_approx ()
 
void test_add_sub_approx_any_order ()
 
void test_add_block_approx ()
 
void test_add_block_approx_all ()
 
void test_xdp_add_approx ()
 
void test_xdp_add_approx_all ()
 
void test_xdp_add_fixed_x_approx ()
 
void test_xdp_add_fixed_x_approx_all ()
 
void test_xdp_sub_approx ()
 
void test_xdp_sub_approx_all ()
 
void test_xdp_sub_fixed_x_approx ()
 
void test_xdp_sub_fixed_x_approx_all ()
 
void test_add_bitwise ()
 
void test_sub_bitwise ()
 
void test_rc5_filtered_pairs_read_from_file ()
 
void test_rc5_filtered_pairs_process_from_file ()
 
void test_rc5_last_round_rot_const_keyrec ()
 
void test_rc5_log_file_read ()
 
void test_rc5_compute_structures ()
 
void test_rc5_filtered_pairs_slide_win_vote ()
 
void test_rc5_filtered_pairs_neutral_bits ()
 
void test_rc5_good_pairs_collect ()
 
void parse_rand_val_from_stdin (const char *str, WORD_T *n)
 
void parse_key_from_stdin (const char *str, uint8_t *n)
 
void test_rc5_get_bit_seq ()
 
void test_rc5_blind_oracle_various ()
 
void test_yaarx_matrices_4d ()
 
void test_rc5_adp_lrot ()
 
void test_rc5_split_struct_v2 (WORD_T sub_struct_id, WORD_T sub_struct_nbits)
 
int main (int argc, const char *argv[])
 

Variables

uint32_t g_arr_len
 
double g_min_prob_arr [(2 *NROUNDS)+3]
 
double g_max_hw_arr [(2 *NROUNDS)+3]
 
uint32_t g_add_approx_arr [(2 *NROUNDS)+3][WORD_SIZE]
 
uint32_t RC5_DIFF [13][2]
 

Detailed Description

Function Documentation

int main ( int  argc,
const char *  argv[] 
)

Main function of the tests.

GoUP linear as in the original BK paper (for comparison purpouses only!)

GoUP_NL ADD expand from our paper

uint32_t rc5_good_pairs_count ( const std::vector< pair_t good_pairs_vec)

Find one or several good pairs and from them try to "learn" (ie. construct) more.

void rc5_good_pairs_global_arr_to_vec ( std::vector< pair_t > *  good_pairs_vec,
uint32_t  arr_len 
)

Transforms the elements of the global array g_good_pairs into a vector.

void rc5_xdp_add_last_round_print_matrices_sage ( gsl_matrix *  A[2][2][2],
gsl_matrix *  B[2][2][2][2] 
)

Print the matrices for rc5_xdp_add_last_round in a format readable by the computer algebra system Sage (http://www.sagemath.org/).

Parameters
Atransition probability matrices for rc5_xdp_add_last_round .

LAST round: A[y][yy][dx] : LAST round (y, yy, dx - fixed) FIRST round: A[x][xx][dy] : FIRST round (x, xx, dy - fixed)

LAST round: B[x][y][yy][dx] : LAST round (y, yy, dx - fixed) FIRST round: B[y][x][xx][dy] : FIRST round (x, xx, dy - fixed)

See Also
rc5_xdp_add_last_round, rc5_last_round_eq_x_sf, xdp_add_print_matrices_sage
void test_rc5_fib_main ( )
Parameters
keykey
rand_L,rand_Rrandom values used in the generation of the structures (i.e. the A words)
rc5_structures_nbits
See Also
RC5_STRUCTURES_NBITS
Parameters
sub_struct_idsequence number of a sub structure: used in order to parallelize the filtration on the HPC cluster (mostly relevant for 64-bit)
sub_struct_nbitstotal number of bits of the substructures (2^{sub_struct_nbits} > sub_struct_id)
void test_rc5_filtered_pairs_process_from_file ( )

Read a list of filtered pairs from a file and process it

See Also
test_rc5_filtered_pairs_read_from_file
void test_rc5_filtered_pairs_read_from_file ( )

Read a list of filtered pairs from a file

void test_rc5_get_bit_seq ( )

Compute "good" constants for the structures. Compute a random "good" constant for the structures. Note: obsolete version. See test_rc5_compute_struct_const_rand First find a number of good pairs. Next from them construct the rand_LR constants by extracting the common 1s and 0s between all pairs. Compute a vector of constants rand_L, rand_R

void test_rc5_good_pairs_collect ( )

Collect good pairs for multiple keys. The data is intended to be used for plotting the distribution of neutral regions.

See Also
test_rc5_equal_rot_differential, test_rc5_filtered_pairs_neutral_bits
void test_rc5_last_round_rot_const_keyrec ( )

Test the key recovery precedure

See Also
test_rc5_encrypt_get_intermediate_values, rc5_last_round_rot_const_keyrec, rc5_pairs_classify_by_last_round_rot_const
void test_rc5_xdp_add_last_round_compare_prob_vs_hw_all ( )

Compare probability threshold vs. Hamming weight threshold

void test_rc5_xdp_add_mid_round_compare_prob_vs_hw_all ( )

Compare probability threshold vs. Hamming weight threshold

Variable Documentation

uint32_t RC5_DIFF[13][2]
Initial value:
= {
{0x80000000, 0x80000000},
{0x00000000, 0x00000800},
{0x00000800, 0x00000000},
{0x00001800, 0x00001400},
{0x00000E00, 0x00002A00},
{0x0000E400, 0x00006100},
{0x00083000, 0x00853000},
{0x00383000, 0x010A0000},
{0x00367180, 0x78003439},
{0, 0},
{0, 0},
{0, 0},
{0, 0}
}