ABY Framework  1.0
Arithmetic Bool Yao Framework
 All Classes Files Functions Variables Enumerations Enumerator Macros
yaosharing.h
Go to the documentation of this file.
1 
19 #ifndef __YAOSHARING_H__
20 #define __YAOSHARING_H__
21 
22 #include "sharing.h"
23 #include "../util/yaokey.h"
24 #include "../circuit/booleancircuits.h"
25 #include "../util/constants.h"
26 
27 #define FIXED_KEY_GARBLING
28 //#define MAXSHAREBUFSIZE 1000000
29 
30 //TODO the garbled table is addressed as uint32_t and might overflow if sufficient (>4mio AND gates) are required. Change to LONG
31 
32 
37 #define KEYS_PER_GATE_IN_TABLE 2
38 
42 class YaoSharing: public Sharing {
43 
44 public:
45 
47  YaoSharing(e_role role, uint32_t sharebitlen, ABYCircuit* circuit, crypto* crypt) :
48  Sharing(role, sharebitlen, circuit, crypt) {
49  Init();
50  }
51  ;
54  }
55  ;
56 
57  // METHODS FROM SUPER CLASS SHARING...
58  virtual void Reset() = 0;
59  virtual void PrepareSetupPhase(ABYSetup* setup) = 0;
60  virtual void PerformSetupPhase(ABYSetup* setup) = 0;
61  virtual void FinishSetupPhase(ABYSetup* setup) = 0;
62  virtual void EvaluateLocalOperations(uint32_t gateid) = 0;
63 
64  virtual void FinishCircuitLayer() = 0;
65 
66  virtual void PrepareOnlinePhase() = 0;
67 
68  virtual void InstantiateGate(GATE* gate) = 0;
69  virtual void UsedGate(uint32_t gateid) = 0;
70 
71  virtual void GetDataToSend(vector<BYTE*>& sendbuf, vector<uint32_t>& bytesize) = 0;
72  virtual void GetBuffersToReceive(vector<BYTE*>& rcvbuf, vector<uint32_t>& rcvbytes) = 0;
73 
74  virtual uint32_t AssignInput(CBitVector& input) = 0;
75  virtual uint32_t GetOutput(CBitVector& out) = 0;
76 
78  return m_cBoolCircuit->GetMaxDepth();
79  }
80  ;
82  return m_nANDGates;
83  }
84  ;
85 
87  return m_cBoolCircuit;
88  }
89  ;
90 
92  //SUPER CLASS METHODS END HERE...
93 
98  void EvaluateSIMDGate(uint32_t gateid);
99 
100 protected:
101  /* A variable that points to inline functions for key xor */
103  uint32_t m_nANDGates;
104  uint32_t m_nXORGates;
107  vector<GATE*> m_vANDGates;
109  vector<GATE*> m_vOutputShareGates;
121  //CBitVector m_vConversionInputKeys;
122 
129  BYTE* m_bZeroBuf;
134  uint32_t m_nSecParamIters;
136  uint64_t m_nANDWindowCtr;
137  uint64_t m_nRemANDGates;
139 #ifdef FIXED_KEY_GARBLING
140  BYTE* m_bResKeyBuf;
141  AES_KEY_CTX* m_kGarble;
142 #endif
143 
145  void Init();
146 
153  BOOL EncryptWire(BYTE* c, BYTE* p, uint32_t id);
154 
156  void PrintKey(BYTE* key);
157 };
158 
159 #endif /* __YAOSHARING_H__ */
void PrintPerformanceStatistics()
Definition: yaosharing.cpp:85
virtual void PrepareSetupPhase(ABYSetup *setup)=0
uint64_t m_nANDWindowCtr
Definition: yaosharing.h:136
uint32_t m_nSecParamIters
Definition: yaosharing.h:134
virtual void FinishSetupPhase(ABYSetup *setup)=0
virtual void FinishCircuitLayer()=0
Definition: booleancircuits.h:27
Definition: sharing.h:43
void PrintKey(BYTE *key)
Definition: yaosharing.cpp:78
uint32_t m_nANDGates
Definition: yaosharing.h:103
CBitVector m_vClientInputKeys
Definition: yaosharing.h:118
uint32_t m_nClientInputBits
Definition: yaosharing.h:117
uint32_t GetMaxDepth()
Definition: circuit.h:70
vector< GATE * > m_vANDGates
Definition: yaosharing.h:107
void Init()
Definition: yaosharing.cpp:21
Definition: crypto.h:58
Sharing class. A virtual class that contains the methods which the sharing schemes have to implement...
~YaoSharing()
Definition: yaosharing.h:53
BYTE * m_bZeroBuf
Definition: yaosharing.h:129
virtual void EvaluateLocalOperations(uint32_t gateid)=0
uint32_t GetMaxCommunicationRounds()
Definition: yaosharing.h:77
BYTE * m_bTempKeyBuf
Definition: yaosharing.h:130
Definition: yaokey.h:27
Definition: abycircuit.h:122
virtual void GetBuffersToReceive(vector< BYTE * > &rcvbuf, vector< uint32_t > &rcvbytes)=0
AES_KEY_CTX * m_kGarble
Definition: yaosharing.h:141
vector< GATE * > m_vOutputShareGates
Definition: yaosharing.h:109
Circuit * GetCircuitBuildRoutine()
Definition: yaosharing.h:86
Definition: xormasking.h:24
CBitVector m_vGarbledCircuit
Definition: yaosharing.h:126
virtual void PerformSetupPhase(ABYSetup *setup)=0
uint64_t m_nGarbledTableCtr
Definition: yaosharing.h:127
uint32_t m_nConversionInputBits
Definition: yaosharing.h:120
uint64_t m_nRemANDGates
Definition: yaosharing.h:137
Definition: yaosharing.h:42
YaoSharing(e_role role, uint32_t sharebitlen, ABYCircuit *circuit, crypto *crypt)
Definition: yaosharing.h:47
uint32_t m_nOutputShareRcvSize
Definition: yaosharing.h:115
virtual uint32_t GetOutput(CBitVector &out)=0
virtual uint32_t AssignInput(CBitVector &input)=0
virtual void Reset()=0
e_role
Defines the role of the party or the source / target for certain operations (e.g., input/output)
Definition: constants.h:139
XORMasking * fMaskFct
Definition: yaosharing.h:106
virtual void PrepareOnlinePhase()=0
BOOL EncryptWire(BYTE *c, BYTE *p, uint32_t id)
Definition: yaosharing.cpp:41
virtual void GetDataToSend(vector< BYTE * > &sendbuf, vector< uint32_t > &bytesize)=0
void EvaluateSIMDGate(uint32_t gateid)
uint32_t m_nInputShareSndSize
Definition: yaosharing.h:111
virtual void InstantiateGate(GATE *gate)=0
BooleanCircuit * m_cBoolCircuit
Definition: yaosharing.h:132
uint32_t GetNumNonLinearOperations()
Definition: yaosharing.h:81
BYTE * m_bResKeyBuf
Definition: yaosharing.h:140
CBitVector m_vServerInputKeys
Definition: yaosharing.h:124
YaoKey * m_pKeyOps
Definition: yaosharing.h:102
virtual void UsedGate(uint32_t gateid)=0
uint32_t m_nXORGates
Definition: yaosharing.h:104
Definition: abycircuit.h:144
uint32_t m_nOutputShareSndSize
Definition: yaosharing.h:112
uint32_t m_nServerInputBits
Definition: yaosharing.h:123
Definition: abysetup.h:77
Definition: circuit.h:30
uint32_t m_nInputShareRcvSize
Definition: yaosharing.h:114
Definition: cbitvector.h:123