MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / eval

Method eval

BMR/Register.cpp:221–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221void Register::eval(const Register& left, const Register& right, GarbledGate& gate,
222 party_id_t my_id, char* prf_output, int w_o, int w_l, int w_r)
223{
224 (void)w_o;
225 (void)w_l;
226 (void)w_r;
227 size_t n_parties = CommonParty::singleton->get_n_parties();
228 int sig_l = left.get_external();
229 int sig_r = right.get_external();
230 int entry = 2 * sig_l + sig_r;
231
232#ifdef DEBUG_MASK
233 cout << "input signals: " << sig_l << " " << sig_r << endl;
234#endif
235
236#ifdef DEBUG
237 gate.print();
238 cout << "picking " << entry << endl;
239#endif
240
241 garbled_entry = gate[entry];
242 int ext_l = entry%2 ? 1 : 0 ;
243 int ext_r = entry<2 ? 0 : 1 ;
244
245#ifdef DEBUG
246 printf("left input");
247 phex(gate.input(ext_l, 1), 16);
248 printf("right input");
249 phex(gate.input(ext_r, 1), 16);
250 unsigned g = gate.id;
251#endif
252
253 Key k;
254 for(party_id_t i=1; i<=n_parties; i++) {
255#ifdef DEBUG
256 std::cout << "using key: " << left.external_key(i) << endl;
257#endif
258 PRF_chunk(left.external_key(i), gate.input(ext_l, 1), prf_output, PAD_TO_8(n_parties));
259 for(party_id_t j=1; j<=n_parties; j++) {
260 k = *(Key*)(prf_output+16*(j-1));
261#ifdef DEBUG
262 printf("Fk^%d_{%u,%d}(%d,%u,%d) = ",i, w_l, sig_l,ext_l,g,j);
263 std::cout << k << std::endl;
264#endif
265 garbled_entry[j-1] -= k;
266 }
267
268#ifdef DEBUG
269 std::cout << "using key: " << right.external_key(i) << endl;
270#endif
271 PRF_chunk(right.external_key(i), gate.input(ext_r, 1) , prf_output, PAD_TO_8(n_parties));
272 for(party_id_t j=1; j<=n_parties; j++) {
273 k = *(Key*)(prf_output+16*(j-1));
274#ifdef DEBUG
275 printf("Fk^%d_{%u,%d}(%d,%u,%d) = ",i, w_r, sig_r,ext_r,g,j);
276 std::cout << k << std::endl;
277#endif
278 garbled_entry[j-1] -= k;

Callers 1

runMethod · 0.45

Calls 7

PRF_chunkFunction · 0.85
get_n_partiesMethod · 0.80
get_externalMethod · 0.80
get_signalMethod · 0.80
phexFunction · 0.70
printMethod · 0.45
inputMethod · 0.45

Tested by

no test coverage detected