ABY Framework  1.0
Arithmetic Bool Yao Framework
 All Classes Files Functions Variables Enumerations Enumerator Macros
yaoclientsharing.h
Go to the documentation of this file.
1 
18 #ifndef __YAOCLIENTSHARING_H__
19 #define __YAOCLIENTSHARING_H__
20 
21 #include "sharing.h"
22 #include <algorithm>
23 #include "yaosharing.h"
24 
25 //#define DEBUGYAOCLIENT
26 
31 
32 public:
34  YaoClientSharing(e_role role, uint32_t sharebitlen, ABYCircuit* circuit, crypto* crypt) :
35  YaoSharing(role, sharebitlen, circuit, crypt) {
36  InitClient();
37  }
38  ;
41  Reset();
42  }
43  ;
44 
45  //MEMBER FUNCTIONS FROM SUPER CLASS YAO SHARING
46  void Reset();
47  void PrepareSetupPhase(ABYSetup* setup);
48  void PerformSetupPhase(ABYSetup* setup);
49  void FinishSetupPhase(ABYSetup* setup);
50  void EvaluateLocalOperations(uint32_t gateid);
51  void EvaluateInteractiveOperations(uint32_t gateid);
52  void EvaluateConversionGate(uint32_t gateid);
53 
54  void FinishCircuitLayer();
55 
56  void PrepareOnlinePhase();
57 
58  void InstantiateGate(GATE* gate);
59  void UsedGate(uint32_t gateid);
60 
61  void GetDataToSend(vector<BYTE*>& sendbuf, vector<uint32_t>& bytesize);
62  void GetBuffersToReceive(vector<BYTE*>& rcvbuf, vector<uint32_t>& rcvbytes);
63 
64  uint32_t AssignInput(CBitVector& input);
65  uint32_t GetOutput(CBitVector& out);
66 
67  const char* sharing_type() {
68  return "Yao client";
69  }
70  ;
71  //ENDS HERE..
72 
73 private:
74 
75  CBitVector m_vROTMasks;
76  uint32_t m_nChoiceBitCtr;
77  CBitVector m_vChoiceBits;
78  uint32_t m_nKeyInputRcvIdx;
80  uint32_t m_nServerInBitCtr;
81  uint32_t m_nClientSndOTCtr;
82  uint32_t m_nClientRcvKeyCtr;
83  uint32_t m_nClientOutputShareCtr;
84  uint32_t m_nServerOutputShareCtr;
86  uint32_t m_nClientOUTBitCtr;
88  CBitVector m_vServerKeyRcvBuf;
89  vector<CBitVector> m_vClientKeyRcvBuf;
91  uint32_t m_nGarbledCircuitRcvCtr;
93  CBitVector m_vOutputShareRcvBuf;
94  CBitVector m_vOutputShareSndBuf;
96  vector<uint32_t> m_vClientSendCorrectionGates;
97  vector<uint32_t> m_vClientRcvInputKeyGates;
99  vector<uint32_t> m_vServerInputGates;
101  CBitVector m_vROTSndBuf;
102  uint32_t m_vROTCtr;
104  uint8_t** m_vTmpEncBuf;
105 
110  void ReceiveServerKeys(uint32_t gateid);
115  void ReceiveClientKeys(uint32_t gateid);
116 
120  void AssignServerInputKeys();
124  void AssignClientInputKeys();
125 
131  void EvaluateXORGate(GATE* gate);
137  void EvaluateANDGate(GATE* gate);
145  BOOL EvaluateGarbledTable(GATE* gate, uint32_t pos, GATE* gleft, GATE* gright);
150  void EvaluateServerOutputGate(GATE* gate);
156  void EvaluateSIMDGate(uint32_t gateid);
157 
161  void InitClient();
165  void InitNewLayer();
166 
172  void EvaluateClientOutputGate(uint32_t gateid);
173 
178  void ReceiveGarbledCircuitAndOutputShares(ABYSetup* setup);
179 };
180 
181 #endif /* __YAOCLIENTSHARING_H__ */
void EvaluateInteractiveOperations(uint32_t gateid)
Definition: yaoclientsharing.cpp:170
uint32_t AssignInput(CBitVector &input)
Definition: yaoclientsharing.cpp:627
void GetBuffersToReceive(vector< BYTE * > &rcvbuf, vector< uint32_t > &rcvbytes)
Definition: yaoclientsharing.cpp:449
void PrepareSetupPhase(ABYSetup *setup)
Definition: yaoclientsharing.cpp:55
void InstantiateGate(GATE *gate)
Definition: yaoclientsharing.cpp:555
void PerformSetupPhase(ABYSetup *setup)
Definition: yaoclientsharing.cpp:102
void UsedGate(uint32_t gateid)
Definition: yaoclientsharing.cpp:560
Definition: crypto.h:58
Sharing class. A virtual class that contains the methods which the sharing schemes have to implement...
Definition: abycircuit.h:122
void FinishSetupPhase(ABYSetup *setup)
Definition: yaoclientsharing.cpp:126
Definition: yaoclientsharing.h:30
void PrepareOnlinePhase()
Definition: yaoclientsharing.cpp:108
YaoClientSharing(e_role role, uint32_t sharebitlen, ABYCircuit *circuit, crypto *crypt)
Definition: yaoclientsharing.h:34
const char * sharing_type()
Definition: yaoclientsharing.h:67
Definition: yaosharing.h:42
void GetDataToSend(vector< BYTE * > &sendbuf, vector< uint32_t > &bytesize)
Definition: yaoclientsharing.cpp:410
void EvaluateLocalOperations(uint32_t gateid)
Definition: yaoclientsharing.cpp:137
e_role
Defines the role of the party or the source / target for certain operations (e.g., input/output)
Definition: constants.h:139
void FinishCircuitLayer()
Definition: yaoclientsharing.cpp:474
void Reset()
Definition: yaoclientsharing.cpp:671
Definition: abycircuit.h:144
~YaoClientSharing()
Definition: yaoclientsharing.h:40
Definition: abysetup.h:77
uint32_t GetOutput(CBitVector &out)
Definition: yaoclientsharing.cpp:653
Definition: cbitvector.h:123
Yao Sharing class.