Skip to content

Commit

Permalink
Merge pull request encryptogroup#140 from MartKro/evaluation_fix
Browse files Browse the repository at this point in the history
Fix for the false evaluation
  • Loading branch information
dd23 authored May 7, 2019
2 parents 318652c + 99b1035 commit a04c4f6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
13 changes: 8 additions & 5 deletions src/abycore/aby/abyparty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class ABYParty::CPartyWorkerThread: public CThread {
m_evt.Set();
}

CEvent* GetEvent() {
return &m_evt;
}
private:
void ThreadMain();
uint32_t threadid;
Expand Down Expand Up @@ -211,7 +214,7 @@ void ABYParty::ExecCircuit() {
std::cout << "Performing setup phase for " << m_vSharings[i]->sharing_type() << " sharing" << std::endl;
#endif
if(i == S_YAO) {
StartWatch("Starting Circuit Garbling", P_GARBLE);
StartRecording("Starting Circuit Garbling", P_GARBLE, m_vSockets);
if(m_eRole == SERVER) {
m_vSharings[S_YAO]->PerformSetupPhase(m_pSetup.get());
m_vSharings[S_YAO_REV]->PerformSetupPhase(m_pSetup.get());
Expand All @@ -223,7 +226,7 @@ void ABYParty::ExecCircuit() {
m_vSharings[S_YAO_REV]->PerformSetupPhase(m_pSetup.get());*/
m_vSharings[S_YAO]->FinishSetupPhase(m_pSetup.get());
m_vSharings[S_YAO_REV]->FinishSetupPhase(m_pSetup.get());
StopWatch("Time for Circuit garbling: ", P_GARBLE);
StopRecording("Time for Circuit garbling: ", P_GARBLE, m_vSockets);
} else if (i == S_YAO_REV) {
//Do nothing, was done in parallel to Yao
} else {
Expand Down Expand Up @@ -409,7 +412,7 @@ BOOL ABYParty::PerformInteraction() {
return success;
}

BOOL ABYParty::ThreadSendValues() {
BOOL ABYParty::ThreadSendValues(uint32_t id) {
std::vector<std::vector<BYTE*> >sendbuf(m_vSharings.size());
std::vector<std::vector<uint64_t> >sndbytes(m_vSharings.size());

Expand Down Expand Up @@ -440,7 +443,7 @@ BOOL ABYParty::ThreadSendValues() {
//gettimeofday(&tstart, NULL);
if(snd_buf_size_total > 0) {
//m_vSockets[2]->Send(snd_buf_total, snd_buf_size_total);
m_tPartyChan->send(snd_buf_total, snd_buf_size_total);
m_tPartyChan->blocking_send(m_vThreads[id]->GetEvent(), snd_buf_total, snd_buf_size_total);
}
free(snd_buf_total);

Expand Down Expand Up @@ -697,7 +700,7 @@ void ABYParty::CPartyWorkerThread::ThreadMain() {
return;
case e_Party_Comm:
if (threadid == 0){
bSuccess = m_pCallback->ThreadSendValues();
bSuccess = m_pCallback->ThreadSendValues(threadid);
}
else{
bSuccess = m_pCallback->ThreadReceiveValues();
Expand Down
2 changes: 1 addition & 1 deletion src/abycore/aby/abyparty.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ABYParty {
void UsedGate(uint32_t gateid);

BOOL PerformInteraction();
BOOL ThreadSendValues();
BOOL ThreadSendValues(uint32_t id);
BOOL ThreadReceiveValues();

void PrintPerformanceStatistics();
Expand Down
6 changes: 4 additions & 2 deletions src/abycore/aby/abysetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,13 @@ void ABYSetup::AddReceiveTask(BYTE* rcvbuf, uint64_t rcvbytes) {
WakeupWorkerThreads(e_Receive);
}

BOOL ABYSetup::ThreadSendData() {
m_tSetupChan->send(m_tsndtask.sndbuf, m_tsndtask.sndbytes);

BOOL ABYSetup::ThreadSendData(uint32_t threadid) {
m_tSetupChan->blocking_send(m_vThreads[threadid]->GetEvent(), m_tsndtask.sndbuf, m_tsndtask.sndbytes);
return true;
}


BOOL ABYSetup::ThreadReceiveData() {
m_tSetupChan->blocking_receive(m_trcvtask.rcvbuf, m_trcvtask.rcvbytes);
return true;
Expand Down
7 changes: 5 additions & 2 deletions src/abycore/aby/abysetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ class ABYSetup {
BOOL ThreadRunKKSnd(uint32_t exec);
BOOL ThreadRunKKRcv(uint32_t exec);

BOOL ThreadSendData();
BOOL ThreadReceiveData();
BOOL ThreadSendData(uint32_t id);
BOOL ThreadReceiveData(uint32_t id);

BOOL ThreadRunPaillierMTGen(uint32_t exec);
BOOL ThreadRunDGKMTGen(uint32_t threadid);
Expand Down Expand Up @@ -220,6 +220,9 @@ class ABYSetup {
m_eJob = e;
m_evt.Set();
}
CEvent* GetEvent() {
return &m_evt;
}
private:
void ThreadMain();
uint32_t threadid;
Expand Down

0 comments on commit a04c4f6

Please sign in to comment.