YAARX: Yet Another ARX Toolkit  0.1
 All Data Structures Files Functions Variables Macros Pages
adp-tea-f-fk.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013 Luxembourg University,
3  * Laboratory of Algorithmics, Cryptology and Security (LACS).
4  *
5  * This file is part of the YAARX toolkit. YAARX stands for
6  * Yet Another ARX toolkit for analysis of ARX cryptographic algorithms.
7  *
8  * YAARX is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * YAARX is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with YAARX. If not, see <http://www.gnu.org/licenses/>.
20  */
27 #ifndef ADP_TEA_F_FK_H
28 #define ADP_TEA_F_FK_H
29 
30 bool adp_f_check_x(const uint32_t lsh_const, const uint32_t rsh_const,
31  const uint32_t k0, const uint32_t k1, const uint32_t delta,
32  const uint32_t dx, const uint32_t dy, const uint32_t x);
33 
34 
35 bool adp_f_is_sat(const uint32_t mask_i, const uint32_t lsh_const, const uint32_t rsh_const,
36  const uint32_t k0, const uint32_t k1, const uint32_t delta,
37  const uint32_t dx, const uint32_t dy, int32_t x);
38 
39 uint32_t adp_f_assign_bit_x(const uint32_t n, const uint32_t i, const uint32_t mask_i, const uint32_t x,
40  const uint32_t lsh_const, const uint32_t rsh_const,
41  const uint32_t k0, const uint32_t k1, const uint32_t delta,
42  const uint32_t dx, const uint32_t dy, uint32_t* x_cnt, double* prob);
43 
44 double adp_f_fk(const uint32_t n, const uint32_t dx, const uint32_t dy,
45  const uint32_t k0, const uint32_t k1, const uint32_t delta,
46  const uint32_t lsh_const, const uint32_t rsh_const);
47 
48 uint32_t adp_f_assign_bit_x_dx(const uint32_t n, const uint32_t i, const uint32_t mask_i, const uint32_t x,
49  const uint32_t lsh_const, const uint32_t rsh_const,
50  const uint32_t k0, const uint32_t k1, const uint32_t delta,
51  const uint32_t dx, const uint32_t dy, uint64_t* x_cnt,
52  double* ret_prob, uint32_t* ret_dx);
53 
54 double max_dx_adp_f_fk(const uint32_t n, uint32_t* ret_dx, const uint32_t dy,
55  const uint32_t k0, const uint32_t k1, const uint32_t delta,
56  const uint32_t lsh_const, const uint32_t rsh_const);
57 
58 
59 uint32_t adp_f_assign_bit_x_dy(const uint32_t n, const uint32_t i, const uint32_t mask_i, const uint32_t x,
60  const uint32_t lsh_const, const uint32_t rsh_const,
61  const uint32_t k0, const uint32_t k1, const uint32_t delta,
62  const uint32_t dx, const uint32_t dy, uint64_t* x_cnt,
63  double* ret_prob, uint32_t* ret_dy);
64 
65 double max_dy_adp_f_fk(const uint32_t n, const uint32_t dx, uint32_t* ret_dy,
66  const uint32_t k0, const uint32_t k1, const uint32_t delta,
67  const uint32_t lsh_const, const uint32_t rsh_const);
68 
69 double all_dy_adp_f_fk(const uint32_t n, const uint32_t dx, uint32_t* ret_dy,
70  const uint32_t k0, const uint32_t k1, const uint32_t delta,
71  const uint32_t lsh_const, const uint32_t rsh_const, uint64_t* x_cnt);
72 
73 
74 uint32_t adp_f_assign_bit_x_dx_dy(const uint32_t n, const uint32_t i, const uint32_t mask_i, const uint32_t x,
75  const uint32_t lsh_const, const uint32_t rsh_const,
76  const uint32_t k0, const uint32_t k1, const uint32_t delta,
77  const uint32_t dx, const uint32_t dy, differential_t* x_cnt,
78  double* ret_prob, uint32_t* ret_dx, uint32_t* ret_dy);
79 
80 double max_dx_dy_adp_f_fk(const uint32_t n, uint32_t* ret_dx, uint32_t* ret_dy,
81  const uint32_t k0, const uint32_t k1, const uint32_t delta,
82  const uint32_t lsh_const, const uint32_t rsh_const);
83 
84 uint32_t adp_f_assign_bit_x_dx_key(const uint32_t n, const uint32_t i, const uint32_t mask_i, const uint32_t x,
85  const uint32_t lsh_const, const uint32_t rsh_const,
86  const uint32_t k0, const uint32_t k1, const uint32_t delta,
87  const uint32_t dx, const uint32_t dy, uint64_t*** x_cnt,
88  double* ret_prob, uint32_t* ret_dx, uint32_t* ret_k0, uint32_t* ret_k1);
89 
90 double max_key_dx_adp_f_fk(const uint32_t n, uint32_t* ret_dx, const uint32_t dy,
91  uint32_t* ret_k0, uint32_t* ret_k1, const uint32_t delta,
92  const uint32_t lsh_const, const uint32_t rsh_const);
93 
94 double adp_f_fk_v2(const uint32_t da, const uint32_t dd,
95  const uint32_t k0, const uint32_t k1, const uint32_t delta,
96  const uint32_t lsh_const, const uint32_t rsh_const);
97 
98 void f_sfun(const uint32_t n,
99  const uint32_t x_word, const uint32_t dx_word, const uint32_t delta_word,
100  const uint32_t k0_word, const uint32_t k1_word);
101 
102 double adp_f_fk_exper(const uint32_t da, const uint32_t db,
103  const uint32_t k0, const uint32_t k1, const uint32_t delta,
104  uint32_t lsh_const, uint32_t rsh_const);
105 
106 double max_dx_adp_f_fk_exper(uint32_t* max_dx, const uint32_t dy,
107  const uint32_t k0, const uint32_t k1, const uint32_t delta,
108  uint32_t lsh_const, uint32_t rsh_const);
109 
110 double max_dy_adp_f_fk_exper(const uint32_t dx, uint32_t* max_dy,
111  const uint32_t k0, const uint32_t k1, const uint32_t delta,
112  uint32_t lsh_const, uint32_t rsh_const);
113 
114 double max_dx_dy_adp_f_fk_exper(uint32_t* max_dx, uint32_t* max_dy,
115  const uint32_t k0, const uint32_t k1, const uint32_t delta,
116  uint32_t lsh_const, uint32_t rsh_const);
117 
118 uint64_t*** x_cnt_alloc();
119 
120 void x_cnt_free(uint64_t*** x_cnt);
121 
122 void x_cnt_print(uint32_t*** x_cnt);
123 
124 #endif // #ifndef ADP_TEA_F_FK_H
125 
126 
double max_dx_adp_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)
Definition: adp-tea-f-fk.cc:349
double adp_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)
Definition: adp-tea-f-fk.cc:1428
double max_dy_adp_f_fk_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)
Definition: adp-tea-f-fk.cc:1504
Definition: common.hh:272
uint32_t adp_f_assign_bit_x_dx_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, differential_t *x_cnt, double *ret_prob, uint32_t *ret_dx, uint32_t *ret_dy)
Definition: adp-tea-f-fk.cc:713
uint32_t adp_f_assign_bit_x_dx_key(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, uint32_t *ret_k0, uint32_t *ret_k1)
Definition: adp-tea-f-fk.cc:1004
double max_dx_dy_adp_f_fk_exper(uint32_t *max_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)
Definition: adp-tea-f-fk.cc:1546
double max_dx_dy_adp_f_fk(const uint32_t n, uint32_t *ret_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)
Definition: adp-tea-f-fk.cc:829
double max_dx_adp_f_fk_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)
Definition: adp-tea-f-fk.cc:1471
double adp_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)
Definition: adp-tea-f-fk.cc:200
void f_sfun(const uint32_t n, const uint32_t x_word, const uint32_t dx_word, const uint32_t delta_word, const uint32_t k0_word, const uint32_t k1_word)
Definition: adp-tea-f-fk.cc:1301
void x_cnt_print(uint32_t ***x_cnt)
Definition: adp-tea-f-fk.cc:959
void x_cnt_free(uint64_t ***x_cnt)
Definition: adp-tea-f-fk.cc:944
uint32_t adp_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)
Definition: adp-tea-f-fk.cc:450
uint32_t adp_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)
Definition: adp-tea-f-fk.cc:129
bool adp_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)
Definition: adp-tea-f-fk.cc:88
double max_key_dx_adp_f_fk(const uint32_t n, uint32_t *ret_dx, const uint32_t dy, uint32_t *ret_k0, uint32_t *ret_k1, const uint32_t delta, const uint32_t lsh_const, const uint32_t rsh_const)
Definition: adp-tea-f-fk.cc:1103
double adp_f_fk_v2(const uint32_t da, const uint32_t dd, const uint32_t k0, const uint32_t k1, const uint32_t delta, const uint32_t lsh_const, const uint32_t rsh_const)
Definition: adp-tea-f-fk.cc:1194
uint32_t adp_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)
Definition: adp-tea-f-fk.cc:267
bool adp_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)
Definition: adp-tea-f-fk.cc:55
uint64_t *** x_cnt_alloc()
Definition: adp-tea-f-fk.cc:927
double max_dy_adp_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)
Definition: adp-tea-f-fk.cc:540
double all_dy_adp_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, uint64_t *x_cnt)
Definition: adp-tea-f-fk.cc:626