18 #ifndef __BOOLEANCIRCUITS_H_
19 #define __BOOLEANCIRCUITS_H_
21 #include "../util/typedefs.h"
43 uint32_t PutANDGate(uint32_t left, uint32_t right);
44 vector<uint32_t> PutANDGate(vector<uint32_t> inleft, vector<uint32_t> inright);
47 uint32_t PutVectorANDGate(uint32_t choiceinput, uint32_t vectorinput);
49 uint32_t PutXORGate(uint32_t left, uint32_t right);
50 vector<uint32_t> PutXORGate(vector<uint32_t> inleft, vector<uint32_t> inright);
53 uint32_t PutORGate(uint32_t a, uint32_t b);
55 vector<uint32_t> PutORGate(vector<uint32_t> a, vector<uint32_t> b);
57 uint32_t PutINGate(uint32_t nvals,
e_role src);
58 template<
class T> uint32_t PutINGate(uint32_t nvals, T val);
59 uint32_t PutINGate(uint32_t nvals, uint64_t val,
e_role role);
60 uint32_t PutINGate(uint32_t ninvals, uint32_t* val,
e_role role);
61 share* PutINGate(uint32_t nvals, uint64_t val, uint32_t bitlen,
e_role role);
62 share* PutINGate(uint32_t nvals, uint32_t* val, uint32_t bitlen,
e_role role);
63 share* PutINGate(uint32_t nvals, uint8_t* val, uint32_t bitlen,
e_role role);
65 uint32_t PutOUTGate(uint32_t parent,
e_role dst);
66 vector<uint32_t> PutOUTGate(vector<uint32_t> parents,
e_role dst);
69 share* PutCONSGate(uint32_t nvals, UGATE_T val, uint32_t bitlen);
70 share* PutCONSGate(uint32_t nvals, uint32_t* val, uint32_t bitlen);
71 share* PutCONSGate(uint32_t nvals, uint8_t* val, uint32_t bitlen);
72 uint32_t PutConstantGate(UGATE_T val, uint32_t nvals = 1);
74 uint32_t GetNumB2YGates() {
78 uint32_t GetNumA2YGates() {
83 int GetNumANDGates() {
84 return m_vANDs[0].numgates;
89 return m_nNumANDSizes;
98 vector<uint32_t> PutMulGate(vector<uint32_t> a, vector<uint32_t> b, uint32_t resbitlen);
99 vector<uint32_t> PutAddGate(vector<uint32_t> left, vector<uint32_t> right, BOOL bCarry = FALSE);
102 vector<uint32_t> PutSizeOptimizedAddGate(vector<uint32_t> left, vector<uint32_t> right, BOOL bCarry = FALSE);
103 vector<uint32_t> PutDepthOptimizedAddGate(vector<uint32_t> lefta, vector<uint32_t> right, BOOL bCARRY = FALSE);
105 vector<uint32_t> PutSUBGate(vector<uint32_t> a, vector<uint32_t> b);
107 vector<uint32_t> PutWideAddGate(vector<vector<uint32_t> > ins, uint32_t resbitlen);
108 uint32_t PutGEGate(vector<uint32_t> a, vector<uint32_t> b);
109 uint32_t PutSizeOptimizedGEGate(vector<uint32_t> a, vector<uint32_t> b);
110 uint32_t PutDepthOptimizedGEGate(vector<uint32_t> a, vector<uint32_t> b);
111 uint32_t PutEQGate(vector<uint32_t> a, vector<uint32_t> b);
114 vector<uint32_t> PutMUXGate(vector<uint32_t> a, vector<uint32_t> b, uint32_t s, BOOL vecand =
false);
115 vector<uint32_t> PutVecANDMUXGate(vector<uint32_t> a, vector<uint32_t> b, vector<uint32_t> s);
116 uint32_t PutVecANDMUXGate(uint32_t a, uint32_t b, uint32_t s);
117 uint32_t PutWideGate(
e_gatetype type, vector<uint32_t> ins);
118 vector<vector<uint32_t> > PutCondSwapGate(vector<uint32_t> a, vector<uint32_t> b, uint32_t s, BOOL vectorized);
119 vector<uint32_t> PutELM0Gate(vector<uint32_t> val, uint32_t b);
121 vector<uint32_t> LShift(vector<uint32_t> val, uint32_t pos, uint32_t nvals = 1);
123 uint32_t PutIdxGate(uint32_t r, uint32_t maxidx);
125 share* PutRepeaterGate(
share* input, uint32_t nvals);
126 uint32_t PutRepeaterGate(uint32_t input, uint32_t nvals);
127 uint32_t PutCombinerGate(vector<uint32_t>& input);
128 uint32_t PutCombineAtPosGate(vector<uint32_t>& input, uint32_t pos);
130 uint32_t PutSubsetGate(uint32_t input, uint32_t* posids, uint32_t nvals);
131 share* PutSubsetGate(
share* input, uint32_t* posids, uint32_t nvals);
134 vector<uint32_t> PutSplitterGate(uint32_t input);
136 uint32_t PutCallbackGate(vector<uint32_t> in, uint32_t rounds,
void (*callback)(
GATE*,
void*),
void* infos, uint32_t nvals);
137 share* PutCallbackGate(
share* in, uint32_t rounds,
void (*callback)(
GATE*,
void*),
void* infos, uint32_t nvals);
142 uint32_t PutY2BCONVGate(uint32_t parentid);
143 uint32_t PutB2YCONVGate(uint32_t parentid);
144 vector<uint32_t> PutY2BCONVGate(vector<uint32_t> parentid);
145 vector<uint32_t> PutB2YCONVGate(vector<uint32_t> parentid);
147 vector<uint32_t> PutA2YCONVGate(vector<uint32_t> parentid);
151 cerr <<
"B2A not available for Boolean circuits, please use Arithmetic circuits instead" << endl;
155 uint32_t PutINVGate(uint32_t parentid);
156 vector<uint32_t> PutINVGate(vector<uint32_t> parentid);
160 vector<uint32_t> PutMinGate(vector<vector<uint32_t> > a);
162 void PutMinIdxGate(
share** a,
share** b, uint32_t nvals,
share** minval_shr,
share** minid_shr);
163 void PutMinIdxGate(vector<vector<uint32_t> > a, vector<vector<uint32_t> > idx,
164 vector<uint32_t>& minval, vector<uint32_t>& minid);
167 void UpdateInteractiveQueue(uint32_t);
168 void UpdateLocalQueue(uint32_t gateid);
171 uint32_t m_nNumANDSizes;
173 uint32_t m_nB2YGates;
174 uint32_t m_nA2YGates;
Definition: booleancircuits.h:27
e_gatetype
Enumeration which defines the type of the gate in the circuit.
Definition: constants.h:67
Definition: abycircuit.h:122
Definition: circuit.h:258
Contains the class for generic circuits, which is a super-class of Boolean and Arithmetic circuits...
Circuit(ABYCircuit *aby, e_sharing context, e_role myrole, uint32_t bitlen, e_circuit circ)
Definition: circuit.h:34
e_role
Defines the role of the party or the source / target for certain operations (e.g., input/output)
Definition: constants.h:139
Definition: constants.h:46
Definition: circuit.h:332
Definition: abycircuit.h:144
e_sharing
Enumeration which defines the different sharing which are there in the framework. ...
Definition: constants.h:124
Definition: abycircuit.h:137