ABY Framework  1.0
Arithmetic Bool Yao Framework
 All Classes Files Functions Variables Enumerations Enumerator Macros
constants.h
Go to the documentation of this file.
1 
19 #ifndef CONSTANTS_H_
20 #define CONSTANTS_H_
21 
22 #include "typedefs.h"
23 
24 #define AES_KEY_BITS 128
25 #define AES_KEY_BYTES 16
26 #define AES_BITS 128
27 #define AES_BYTES 16
28 #define LOG2_AES_BITS ceil_log2(AES_BITS)
29 
30 enum field_type {
31  P_FIELD, ECC_FIELD
32 };
33 
34 static const seclvl ST = { 40, 80, 1024, 160, 163 };
35 static const seclvl MT = { 40, 112, 2048, 192, 233 };
36 static const seclvl LT = { 40, 128, 3072, 256, 283 };
37 static const seclvl XLT = { 40, 192, 7680, 384, 409 };
38 static const seclvl XXLT = { 40, 256, 15360, 512, 571 };
39 
44 enum e_circuit {
45 
46  C_BOOLEAN = 0,
48  C_LAST = 2
49 };
50 
56 
57  MT_OT = 0,
59  MT_DGK = 2,
60  MT_LAST = 3
61 };
62 
67 enum e_gatetype {
68 
69  G_LIN = 0x00,
70  G_NON_LIN = 0x01,
71  G_NON_LIN_VEC = 0x02,
72  G_IN = 0x03,
73  G_OUT = 0x04,
74  G_INV = 0x05,
75  G_CONSTANT = 0x06,
76  G_CONV = 0x07,
77  G_CALLBACK = 0x08,
78  G_COMBINE = 0x80,
79  G_SPLIT = 0x81,
80  G_REPEAT = 0x82,
81  G_PERM = 0x83,
82  G_COMBINEPOS = 0x84,
83  G_SUBSET = 0x85,
84 //G_YAO_BUILD /**< Enum for */
85 };
86 
92 
93  OP_XOR = 0,
94  OP_AND = 1,
95  OP_ADD = 2,
96  OP_MUL = 3,
97  OP_CMP = 4,
98  OP_EQ = 5,
99  OP_MUX = 6,
100  OP_SUB = 7,
113  OP_COMBINE = 0x80,
114  OP_SPLIT = 0x81,
115  OP_REPEAT = 0x82,
116  OP_PERM = 0x83,
118 };
124 enum e_sharing {
125 
126  S_BOOL = 0,
127  S_YAO = 1,
128  S_ARITH = 2,
129  S_LAST = 3,
132 };
133 
134 
139 enum e_role {
140  SERVER, CLIENT, ALL
141 };
142 
143 static string get_role_name(e_role r) {
144  switch(r) {
145  case SERVER:
146  return "SERVER";
147  case CLIENT:
148  return "CLIENT";
149  case ALL:
150  return "ALL";
151  default:
152  return "NN";
153  }
154 }
155 
156 static string get_sharing_name(e_sharing s) {
157  switch (s) {
158  case S_BOOL:
159  return "BOOL";
160  case S_YAO:
161  return "YAO";
162  case S_ARITH:
163  return "ARITH";
164  default:
165  return "NN";
166  }
167 }
168 
169 
170 static string get_gate_type_name(e_gatetype g) {
171  switch (g) {
172  case G_LIN: return "Linear";
173  case G_NON_LIN: return "Non-Linear";
174  case G_NON_LIN_VEC: return "Vector-Non-Linear";
175  case G_IN: return "Input";
176  case G_OUT: return "Output";
177  case G_INV: return "Inversion";
178  case G_CONSTANT: return "Constant";
179  case G_CONV: return "Conversion";
180  case G_COMBINE: return "Combiner";
181  case G_SPLIT: return "Splitter";
182  case G_REPEAT: return "Repeater";
183  case G_PERM: return "Permutation";
184  case G_COMBINEPOS: return "Combiner-Position";
185  default: return "NN";
186  }
187 }
188 
189 
190 static string get_op_name(e_operation op) {
191  switch (op) {
192  case OP_XOR:
193  return "XOR";
194  case OP_AND:
195  return "AND";
196  case OP_ADD:
197  return "ADD";
198  case OP_AND_VEC:
199  return "AND_VEC";
200  case OP_SUB:
201  return "SUB";
202  case OP_MUL:
203  return "MUL";
204  case OP_MUL_VEC:
205  return "MUL_VEC";
206  case OP_CMP:
207  return "CMP";
208  case OP_EQ:
209  return "EQ";
210  case OP_MUX:
211  return "MUX";
212  case OP_IN:
213  return "IN";
214  case OP_OUT:
215  return "OUT";
216  case OP_INV:
217  return "INV";
218  case OP_CONSTANT:
219  return "CONS";
220  case OP_CONV:
221  return "CONV";
222  case OP_A2Y:
223  return "A2Y";
224  case OP_B2A:
225  return "B2A";
226  case OP_B2Y:
227  return "B2Y";
228  case OP_Y2B:
229  return "Y2B";
230  case OP_COMBINE:
231  return "CMB";
232  case OP_SPLIT:
233  return "SPL";
234  case OP_REPEAT:
235  return "REP";
236  case OP_PERM:
237  return "PERM";
238  case OP_COMBINEPOS:
239  return "CMBP";
240  default:
241  return "NN";
242  }
243 }
244 
249 #define GARBLED_TABLE_WINDOW 100000000 //1048575 //=0xFFFFF for faster modulo operation
250 
254 const uint8_t g_TruthTable[4] = { 0, 0, 0, 1 }; // and
258 const uint8_t m_vFixedKeyAESSeed[AES_KEY_BYTES] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
262 const uint8_t m_vSeed[AES_KEY_BYTES] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
263 
264 #endif /* CONSTANTS_H_ */
Definition: constants.h:109
Definition: constants.h:82
e_gatetype
Enumeration which defines the type of the gate in the circuit.
Definition: constants.h:67
Definition: constants.h:100
Definition: constants.h:71
const uint8_t g_TruthTable[4]
A truth-table for an AND gate.
Definition: constants.h:254
Definition: constants.h:70
Definition: constants.h:99
Definition: constants.h:98
Definition: constants.h:111
Definition: constants.h:127
Definition: constants.h:126
Definition: constants.h:110
Definition: constants.h:59
const uint8_t m_vSeed[AES_KEY_BYTES]
Static seed for various testing functionalities.
Definition: constants.h:262
Definition: constants.h:94
e_mt_gen_alg
Enumeration which defines the method that is used for arithmetic multiplication triple generation...
Definition: constants.h:55
Definition: constants.h:106
Definition: constants.h:115
Definition: constants.h:130
Definition: constants.h:76
Definition: constants.h:95
Definition: constants.h:129
Definition: constants.h:74
Definition: constants.h:116
Definition: constants.h:75
Definition: constants.h:107
Definition: constants.h:77
Definition: constants.h:83
Definition: constants.h:58
Definition: constants.h:48
Definition: constants.h:80
Definition: constants.h:78
Definition: constants.h:104
Definition: constants.h:96
Definition: constants.h:102
Definition: constants.h:112
Definition: constants.h:57
Definition: constants.h:69
e_role
Defines the role of the party or the source / target for certain operations (e.g., input/output)
Definition: constants.h:139
Definition: constants.h:46
Definition: constants.h:72
Definition: constants.h:113
Definition: constants.h:60
Definition: typedefs.h:79
Definition: constants.h:97
e_circuit
Definition: constants.h:44
Definition: constants.h:103
Definition: constants.h:108
Typedefs Implementation.
Definition: constants.h:105
Definition: constants.h:114
Definition: constants.h:93
Definition: constants.h:79
e_sharing
Enumeration which defines the different sharing which are there in the framework. ...
Definition: constants.h:124
Definition: constants.h:101
Definition: constants.h:73
Definition: constants.h:117
Definition: constants.h:128
const uint8_t m_vFixedKeyAESSeed[AES_KEY_BYTES]
The seed from which the key is generated.
Definition: constants.h:258
Definition: constants.h:47
Definition: constants.h:81
e_operation
Enumeration which defines all the operations which are there in the framework.
Definition: constants.h:91