ABY Framework  1.0
Arithmetic Bool Yao Framework
 All Classes Files Functions Variables Enumerations Enumerator Macros
sharing.h
Go to the documentation of this file.
1 
21 #ifndef __SHARING_H__
22 #define __SHARING_H__
23 
24 //#include "../circuit/circuit.h"
25 #include "../circuit/abycircuit.h"
26 #include "../circuit/circuit.h"
27 #include "../util/cbitvector.h"
28 #include "../aby/abysetup.h"
29 #include "../util/constants.h"
30 #include "../util/crypto/crypto.h"
31 #include <assert.h>
32 //#define DEBUGSHARING
33 
38 #define MAXSHAREBUFSIZE 1000000
39 
43 class Sharing {
44 public:
53  Sharing(e_role role, uint32_t sharebitlen, ABYCircuit* circuit, crypto* crypt) {
54  m_nShareBitLen = sharebitlen;
55  m_pCircuit = circuit;
56  m_pGates = m_pCircuit->Gates();
57  m_eRole = role;
58  m_cCrypto = crypt;
59  m_nSecParamBytes = ceil_divide(m_cCrypto->get_seclvl().symbits, 8);
60  }
61  ;
66  }
67  ;
68 
70  virtual void Reset() = 0;
71 
76  virtual void PrepareSetupPhase(ABYSetup* setup) = 0;
81  virtual void PerformSetupPhase(ABYSetup* setup) = 0;
86  virtual void FinishSetupPhase(ABYSetup* setup) = 0;
87 
92  virtual void EvaluateLocalOperations(uint32_t level) = 0;
97  virtual void EvaluateInteractiveOperations(uint32_t level) = 0;
98 
102  virtual void PrepareOnlinePhase() = 0;
103 
107  virtual void FinishCircuitLayer() = 0;
108 
114  virtual void GetDataToSend(vector<BYTE*>& sendbuf, vector<uint32_t>& bytesize) = 0;
120  virtual void GetBuffersToReceive(vector<BYTE*>& rcvbuf, vector<uint32_t>& rcvbytes) = 0;
125  virtual void InstantiateGate(GATE* gate) = 0;
130  virtual void UsedGate(uint32_t gateid) = 0;
131 
136  virtual uint32_t AssignInput(CBitVector& input) = 0;
141  virtual uint32_t GetOutput(CBitVector& out) = 0;
145  virtual uint32_t GetMaxCommunicationRounds() = 0;
149  virtual uint32_t GetNumNonLinearOperations() = 0;
153  virtual const char* sharing_type() = 0;
157  virtual void PrintPerformanceStatistics() = 0;
161  virtual Circuit* GetCircuitBuildRoutine() = 0;
162 
163 protected:
169  void EvaluateCallbackGate(uint32_t gateid);
170 
171  uint32_t m_nShareBitLen;
175  uint32_t m_nSecParamBytes;
177 };
178 
179 #endif
uint32_t m_nSecParamBytes
Definition: sharing.h:175
Definition: sharing.h:43
virtual void FinishSetupPhase(ABYSetup *setup)=0
virtual void InstantiateGate(GATE *gate)=0
Definition: crypto.h:58
virtual Circuit * GetCircuitBuildRoutine()=0
ABYCircuit * m_pCircuit
Definition: sharing.h:173
virtual void GetBuffersToReceive(vector< BYTE * > &rcvbuf, vector< uint32_t > &rcvbytes)=0
virtual void PrepareOnlinePhase()=0
virtual void EvaluateLocalOperations(uint32_t level)=0
virtual void Reset()=0
Definition: abycircuit.h:122
virtual void PrepareSetupPhase(ABYSetup *setup)=0
virtual uint32_t AssignInput(CBitVector &input)=0
virtual void UsedGate(uint32_t gateid)=0
virtual const char * sharing_type()=0
virtual uint32_t GetOutput(CBitVector &out)=0
e_role
Defines the role of the party or the source / target for certain operations (e.g., input/output)
Definition: constants.h:139
virtual uint32_t GetNumNonLinearOperations()=0
virtual void PrintPerformanceStatistics()=0
GATE * m_pGates
Definition: sharing.h:172
e_role m_eRole
Definition: sharing.h:174
virtual void EvaluateInteractiveOperations(uint32_t level)=0
~Sharing()
Definition: sharing.h:65
virtual void GetDataToSend(vector< BYTE * > &sendbuf, vector< uint32_t > &bytesize)=0
crypto * m_cCrypto
Definition: sharing.h:176
Definition: abycircuit.h:144
virtual void PerformSetupPhase(ABYSetup *setup)=0
virtual uint32_t GetMaxCommunicationRounds()=0
Definition: abysetup.h:77
Definition: circuit.h:30
uint32_t m_nShareBitLen
Definition: sharing.h:171
void EvaluateCallbackGate(uint32_t gateid)
Definition: sharing.cpp:20
Sharing(e_role role, uint32_t sharebitlen, ABYCircuit *circuit, crypto *crypt)
Initialises the members of the class.
Definition: sharing.h:53
virtual void FinishCircuitLayer()=0
Definition: cbitvector.h:123