27 #ifndef RC5_BLIND_ORACLE_H
28 #define RC5_BLIND_ORACLE_H
30 #if ((WORD_SIZE == 16) || (WORD_SIZE == 32) || (WORD_SIZE == 64))
31 WORD_T rc5_get_bit_seq(
const WORD_T word,
const WORD_T start,
const WORD_T len);
32 void rc5_blind_oracle_rot4_roundkeys_intervals(
const WORD_T r1,
const WORD_T r2,
33 const WORD_T r3,
const WORD_T r4,
34 std::vector<WORD_T>* I_k0, std::vector<WORD_T>* I_k1,
35 std::vector<WORD_T>* I_k2, std::vector<WORD_T>* I_k3,
36 std::vector<WORD_T>* I_k4);
37 void rc5_blind_oracle_rot5_roundkeys_intervals(
const WORD_T r1,
const WORD_T r2,
38 const WORD_T r3,
const WORD_T r4,
const WORD_T r5,
39 std::vector<WORD_T>* I_k0, std::vector<WORD_T>* I_k1,
40 std::vector<WORD_T>* I_k2, std::vector<WORD_T>* I_k3,
41 std::vector<WORD_T>* I_k4, std::vector<WORD_T>* I_k5);
42 void rc5_blind_oracle_rot4_plaintext_intervals(
const WORD_T r1,
const WORD_T r2,
const WORD_T r3,
43 std::vector<WORD_T>* I_L, std::vector<WORD_T>* I_R);
44 void rc5_blind_oracle_rot5_plaintext_intervals(
const WORD_T r1,
const WORD_T r2,
45 const WORD_T r3,
const WORD_T r4,
46 std::vector<WORD_T>* I_L, std::vector<WORD_T>* I_R);
47 void rc5_blind_oracle_compute_mask_bool(
const std::vector<WORD_T> I_L,
const std::vector<WORD_T> I_R,
48 bool M_L[
WORD_SIZE],
bool M_R[WORD_SIZE]);
49 void rc5_blind_oracle_print_mask_bool(
const bool M[
WORD_SIZE]);
50 void rc5_blind_oracle_print_all_masks_hex(WORD_T*** M_L, WORD_T*** M_R);
51 void rc5_blind_oracle_print_all_masks_hex(WORD_T**** M_L, WORD_T**** M_R);
52 void rc5_blind_oracle_print_selected_masks_hex(WORD_T**** M_L, WORD_T**** M_R);
53 void rc5_blind_oracle_rot4_const_allowed(
const WORD_T active_mask_L,
const WORD_T active_mask_R,
54 WORD_T*** M_L, WORD_T*** M_R,
56 void rc5_blind_oracle_rot5_const_allowed(
const WORD_T active_mask_L,
const WORD_T active_mask_R,
58 const WORD_T M_R[WORD_SIZE][WORD_SIZE][WORD_SIZE][WORD_SIZE],
59 bool r_allowed[WORD_SIZE][WORD_SIZE][WORD_SIZE][WORD_SIZE]);
60 void rc5_blind_oracle_mask_bool_to_bin(
const bool bool_M[
WORD_SIZE], WORD_T* bin_M);
61 void rc5_blind_oracle_rot4_compute_plaintext_masks(WORD_T*** M_L, WORD_T*** M_R);
62 void rc5_blind_oracle_rot5_compute_plaintext_masks(WORD_T**** M_L, WORD_T**** M_R);
63 void rc5_blind_oracle_rot5_compute_selected_plaintext_masks(
const WORD_T lim_r1[2],
const WORD_T lim_r2[2],
64 const WORD_T lim_r3[2],
const WORD_T lim_r4[2],
65 std::vector<WORD_T>* M_L, std::vector<WORD_T>* M_R);
66 void rc5_blind_oracle_rot4_vars_print(
const WORD_T S[RC5_STAB_LEN_T],
67 WORD_T*** M_L, WORD_T*** M_R,
68 const WORD_T plaintext_L,
const WORD_T plaintext_R,
69 const WORD_T rot_const[4]);
70 void rc5_blind_oracle_rot5_vars_print(
const WORD_T S[RC5_STAB_LEN_T],
71 WORD_T**** M_L, WORD_T**** M_R,
72 const WORD_T plaintext_L,
const WORD_T plaintext_R,
73 const WORD_T rot_const[5]);
74 bool rc5_blind_oracle_rot4_solution_search(
const WORD_T S[RC5_STAB_LEN_T],
75 WORD_T*** M_L, WORD_T*** M_R,
76 WORD_T* ret_M_L, WORD_T* ret_M_R,
77 WORD_T* ret_X_L, WORD_T* ret_X_R,
78 WORD_T* ret_XX_L, WORD_T* ret_XX_R,
80 bool rc5_blind_oracle_rot5_solution_search(
const WORD_T S[RC5_STAB_LEN_T],
81 WORD_T**** M_L, WORD_T**** M_R,
82 WORD_T* ret_M_L, WORD_T* ret_M_R,
83 WORD_T* ret_X_L, WORD_T* ret_X_R,
84 WORD_T* ret_XX_L, WORD_T* ret_XX_R,
86 void rc5_blind_oracle_rot4_solution_all(
const WORD_T S[RC5_STAB_LEN_T],
87 WORD_T*** arr_M_L, WORD_T*** arr_M_R,
88 std::vector<std::pair<WORD_T, WORD_T>>* vec_M,
89 std::vector<std::pair<WORD_T, WORD_T>>* vec_X);
90 void rc5_blind_oracle_rot4_modify_round_keys(WORD_T S[RC5_STAB_LEN_T],
const WORD_T rot_const[4]);
92 #endif // #if ((WORD_SIZE == 16) || (WORD_SIZE == 32) || (WORD_SIZE == 64))
93 #endif // #ifndef RC5_BLIND_ORACLE_H
#define WORD_SIZE
Definition: common.hh:119