forked from data61/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OTTripleSetup.cpp
42 lines (36 loc) · 980 Bytes
/
OTTripleSetup.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "OTTripleSetup.h"
void OTTripleSetup::setup()
{
timeval baseOTstart, baseOTend;
gettimeofday(&baseOTstart, NULL);
G.ReSeed();
for (int i = 0; i < nbase; i++)
{
base_receiver_inputs[i] = G.get_uchar() & 1;
}
//baseReceiverInput.randomize(G);
for (int i = 0; i < nparties - 1; i++)
{
baseOTs[i]->set_receiver_inputs(base_receiver_inputs);
baseOTs[i]->exec_base(false);
}
gettimeofday(&baseOTend, NULL);
double basetime = timeval_diff(&baseOTstart, &baseOTend);
cout << "\t\tBaseTime: " << basetime/1000000 << endl << flush;
// Receiver send something to force synchronization
// (since Sender finishes baseOTs before Receiver)
}
void OTTripleSetup::close_connections()
{
for (size_t i = 0; i < players.size(); i++)
{
delete players[i];
}
}
OTTripleSetup::~OTTripleSetup()
{
for (size_t i = 0; i < baseOTs.size(); i++)
{
delete baseOTs[i];
}
}