30 #define RC5_ADD_APPROX 0
31 #define RC5_LAST_ROUND_ADD_APPROX 0
32 #define RC5_LAST_ROUND_PARAMS_INCLUDE_DX 0
37 #define RC5_LAST_ROUND_PARAMS_NVARIANTS_CUT_THRES 5
54 #define RC5_ADD_APPROX_ORDER 5//8
61 #define RC5_ADD_APPROX_P_THRES 1.0//((double)1.0 / (double)((1U << 5) + 1))
64 WORD_T plaintext_first[2];
65 WORD_T plaintext_second[2];
66 WORD_T ciphertext_first[2];
67 WORD_T ciphertext_second[2];
102 uint32_t rot_const_prev;
111 : std::binary_function<eq_x_params_t, eq_x_params_t, bool>
116 #if RC5_LAST_ROUND_PARAMS_INCLUDE_DX // <--- ! do not consider the output difference
117 (first.dx == second.dx) &&
119 (first.y == second.y) &&
120 (first.yy == second.yy) &&
121 (first.b_aux_data == second.b_aux_data) &&
122 (first.rot_const == second.rot_const) &&
123 (first.rot_const_prev == second.rot_const_prev));
133 : std::unary_function<eq_x_params_t, std::size_t>
137 std::size_t seed = 0;
138 #if RC5_LAST_ROUND_PARAMS_INCLUDE_DX // <--- ! do not consider the output difference
139 boost::hash_combine(seed, params.dx);
140 #endif // #if RC5_LAST_ROUND_PARAMS_INCLUDE_DX
141 boost::hash_combine(seed, params.y);
142 boost::hash_combine(seed, params.yy);
143 boost::hash_combine(seed, params.rot_const);
144 boost::hash_combine(seed, params.rot_const_prev);
145 boost::hash_combine(seed, params.b_aux_data);
150 #define RC5_LAST_ROUND_NMATRIX 8 // A[y[i]][yy[i]][dx[i]]
151 #define RC5_LAST_ROUND_MSIZE 4
152 #define RC5_LAST_ROUND_ISTATE 3 // initial state
153 #define RC5_XDP_ADD_LAST_ROUND_COLSUM 2
154 #define RC5_XDP_ADD_LAST_ROUND_NORM 1.0 /(double)RC5_XDP_ADD_LAST_ROUND_COLSUM
156 #define RC5_MID_ROUND_ISTATE 3 // initial state
157 #define RC5_MID_ROUND_NMATRIX 4 // A[dy[i]][dx[i]]
158 #define RC5_MID_ROUND_MSIZE 4
159 #define RC5_XDP_ADD_MID_ROUND_COLSUM 4
160 #define RC5_XDP_ADD_MID_ROUND_NORM 1.0 /(double)RC5_XDP_ADD_MID_ROUND_COLSUM
162 //#if (WORD_SIZE == 32)
171 void rc5_last_round_eq_alloc_matrices_3d(gsl_matrix* A[2][2][2]);
177 void rc5_last_round_eq_add_matrices(gsl_matrix* A[2][2][2], gsl_matrix* AA[2][2][2][2]);
178 void rc5_last_round_eq_normalize_matrices(gsl_matrix* A[2][2][2]);
182 const WORD_T y,
const WORD_T yy,
const WORD_T dx,
double* nval);
183 bool rc5_last_round_eq_key_check_conflict_exper(WORD_T y, WORD_T yy, WORD_T dx);
185 const gsl_matrix* AA[2][2][2][2],
186 const gsl_vector* L,
const gsl_vector* C,
187 const WORD_T y,
const WORD_T yy,
const WORD_T dx);
191 void rc5_last_round_eq_x_count_solutions_all_inputs(
const gsl_matrix* A[2][2][2],
const gsl_matrix* AA[2][2][2][2]);
192 uint32_t rc5_last_round_eq_x_count_solutions_exper(uint32_t y, uint32_t yy, uint32_t dx, std::vector<uint32_t>* sol_vec);
194 const gsl_vector* L,
const gsl_vector* C,
195 const WORD_T y,
const WORD_T yy,
const WORD_T dx);
196 void rc5_xdp_add_last_round_diff_set_out_exper(
const WORD_T y,
const WORD_T yy,
197 const double p_thres,
198 std::vector<WORD_T>* dx_vec);
200 const double p_thres,
201 std::vector<WORD_T>* dx_vec);
203 const double p_thres,
const uint32_t hw_thres,
204 const gsl_matrix* A[2][2][2],
205 const gsl_vector* L,
const gsl_vector* C,
206 const WORD_T y,
const WORD_T yy,
207 const WORD_T dx_prev,
208 const uint32_t rot_const_prev,
211 std::vector<WORD_T>* dx_vec);
213 const WORD_T y,
const WORD_T yy,
214 const WORD_T dx_prev,
215 const uint32_t rot_const_prev,
216 const double p_thres,
217 const uint32_t hw_thres,
218 std::vector<WORD_T>* dx_vec);
221 std::vector<WORD_T>* sol_vec);
223 const gsl_vector* L,
const gsl_vector* C,
225 const WORD_T x_sol, WORD_T* sol);
226 bool rc5_last_round_eq_x_find_solutions_exper(WORD_T y, WORD_T yy, WORD_T dx, std::vector<WORD_T>* sol_vec);
227 bool rc5_last_round_eq_x_is_solution(
const WORD_T x,
const WORD_T y,
const WORD_T yy,
const WORD_T dx);
229 const WORD_T bit_seq,
const uint32_t bit_seq_len);
231 const WORD_T bit_seq,
const uint32_t bit_seq_len);
235 const WORD_T dy,
const WORD_T dz,
const uint32_t order_in);
242 void rc5_mid_round_eq_alloc_matrices_2d(gsl_matrix* A[2][2]);
243 void rc5_mid_round_eq_free_matrices_2d(gsl_matrix* A[2][2]);
247 void rc5_mid_round_eq_normalize_matrices(gsl_matrix* A[2][2]);
250 const gsl_vector* L,
const gsl_vector* C,
251 const WORD_T dy,
const WORD_T dx);
253 const double p_thres,
254 std::vector<WORD_T>* dx_vec);
256 const gsl_vector* L,
const gsl_vector* C,
258 const WORD_T dx_prev,
259 const uint32_t rot_const_prev,
260 const double p_thres,
261 const WORD_T hw_thres,
262 std::vector<WORD_T>* dx_vec);
264 const WORD_T dx_prev,
265 const WORD_T rot_const_prev,
266 const double p_thres,
267 const uint32_t hw_thres,
268 std::vector<WORD_T>* dx_vec);
269 bool rc5_mid_round_add_approx_match(
const uint32_t i,
const WORD_T dx,
270 const WORD_T dy,
const WORD_T dz,
const uint32_t order_in);
273 #endif // #ifndef RC5_DC_H
bool rc5_last_round_eq_x_has_solution(const uint32_t i, const gsl_matrix *A[2][2][2][2], const gsl_vector *L, const gsl_vector *C, const eq_x_params_t eq_params, const WORD_T x_sol, WORD_T *sol)
Definition: rc5-eq.cc:900
bool rc5_last_round_eq_key_is_contradicting(const gsl_matrix *A[2][2][2], const gsl_vector *L, const gsl_vector *C, const WORD_T y, const WORD_T yy, const WORD_T dx, double *nval)
Definition: rc5-eq.cc:454
void rc5_xdp_add_mid_round_diff_set_out(const gsl_matrix *A[2][2], const gsl_vector *L, const gsl_vector *C, const WORD_T dy, const WORD_T dx_prev, const uint32_t rot_const_prev, const double p_thres, const WORD_T hw_thres, std::vector< WORD_T > *dx_vec)
Definition: rc5-eq.cc:1942
Definition: rc5-eq.hh:110
bool b_good
Definition: rc5-eq.hh:68
void rc5_mid_round_eq_print_matrices(gsl_matrix *A[2][2])
Definition: rc5-eq.cc:1636
void rc5_last_round_eq_key_sf(gsl_matrix *A[2][2][2][2])
Definition: rc5-eq.cc:301
void rc5_last_round_eq_free_matrices_4d(gsl_matrix *A[2][2][2][2])
Definition: rc5-eq.cc:178
bool rc5_last_round_eq_x_find_solutions_rec(const gsl_matrix *A[2][2][2][2], const eq_x_params_t eq_params, std::vector< WORD_T > *sol_vec)
Definition: rc5-eq.cc:1042
bool rc5_last_round_add_approx_match(const uint32_t i, const WORD_T x_in, const WORD_T xx_in, const WORD_T dy, const WORD_T dz, const uint32_t order_in)
Definition: rc5-eq.cc:1188
void rc5_xdp_add_mid_round_diff_set_out_exper(const WORD_T dy, const double p_thres, std::vector< WORD_T > *dx_vec)
Definition: rc5-eq.cc:1738
double rc5_xdp_add_mid_round(const gsl_matrix *A[2][2], const gsl_vector *L, const gsl_vector *C, const WORD_T dy, const WORD_T dx)
Definition: rc5-eq.cc:1607
void rc5_last_round_eq_free_matrices_3d(gsl_matrix *A[2][2][2])
Definition: rc5-eq.cc:140
void rc5_xdp_add_last_round_diff_set_out(const gsl_matrix *A[2][2][2], const gsl_vector *L, const gsl_vector *C, const WORD_T y, const WORD_T yy, const WORD_T dx_prev, const uint32_t rot_const_prev, const double p_thres, const uint32_t hw_thres, std::vector< WORD_T > *dx_vec)
Definition: rc5-eq.cc:1332
double rc5_xdp_add_mid_round_exper(const WORD_T dy, const WORD_T dx)
Definition: rc5-eq.cc:1677
void rc5_xdp_add_last_round_diff_set_out_wrapper(const WORD_T y, const WORD_T yy, const double p_thres, std::vector< WORD_T > *dx_vec)
Definition: rc5-eq.cc:1356
double rc5_xdp_add_last_round(const gsl_matrix *A[2][2][2], const gsl_vector *L, const gsl_vector *C, const WORD_T y, const WORD_T yy, const WORD_T dx)
Definition: rc5-eq.cc:1150
void rc5_last_round_eq_alloc_matrices_4d(gsl_matrix *A[2][2][2][2])
Definition: rc5-eq.cc:158
void rc5_xdp_add_last_round_diff_set_out_i(const uint32_t i, const double p_thres, const uint32_t hw_thres, const gsl_matrix *A[2][2][2], const gsl_vector *L, const gsl_vector *C, const WORD_T y, const WORD_T yy, const WORD_T dx_prev, const uint32_t rot_const_prev, const WORD_T dx, const double p, std::vector< WORD_T > *dx_vec)
Definition: rc5-eq.cc:1235
void rc5_mid_round_eq_add_matrices(gsl_matrix *A[2][2], gsl_matrix *AA[2][2][2][2])
Definition: rc5-eq.cc:1459
bool rc5_last_round_eq_x_bit_seq_match(const WORD_T x, const uint32_t rot_const, const WORD_T bit_seq, const uint32_t bit_seq_len)
Definition: rc5-eq.cc:691
bool rc5_mid_round_eq_xy_find_solutions_exper(const WORD_T dy, const WORD_T dx, std::vector< WORD_T > *sol_vec)
Definition: rc5-eq.cc:1709
void rc5_mid_round_eq_free_matrices_4d(gsl_matrix *A[2][2][2][2])
Definition: rc5-eq.cc:105
void rc5_mid_round_eq_xy_sf(gsl_matrix *A[2][2][2][2])
Definition: rc5-eq.cc:1517
void rc5_last_round_eq_key_detect_fixed_key_bits(const gsl_matrix *A[2][2][2], const gsl_matrix *AA[2][2][2][2], const gsl_vector *L, const gsl_vector *C, const WORD_T y, const WORD_T yy, const WORD_T dx)
Definition: rc5-eq.cc:397
Definition: rc5-eq.hh:132
void rc5_mid_round_eq_alloc_matrices_4d(gsl_matrix *A[2][2][2][2])
Definition: rc5-eq.cc:84
void rc5_last_round_eq_print_matrices(gsl_matrix *A[2][2][2])
Definition: rc5-eq.cc:220
void rc5_last_round_eq_x_sf(gsl_matrix *A[2][2][2][2])
Definition: rc5-eq.cc:548
double rc5_xdp_add_first_round_exper(WORD_T x, WORD_T xx, WORD_T dy)
Definition: rc5-eq.cc:1104
double rc5_xdp_add_last_round_exper(WORD_T y, WORD_T yy, WORD_T dx)
Definition: rc5-eq.cc:1079
bool rc5_last_round_eq_x_bit_seq_match_bitwise(const WORD_T x, const uint32_t rot_const, const WORD_T bit_seq, const uint32_t bit_seq_len)
Definition: rc5-eq.cc:878