emp-toolkit
ideal.h
Go to the documentation of this file.
1 #ifndef OT_IDEAL_H__
2 #define OT_IDEAL_H__
3 #include "ot.h"
8 class OTIdeal: public OT<OTIdeal> { public:
9  int cnt = 0;
10  OTIdeal(NetIO * io): OT(io) {
11  }
12 
13  void send_impl(const block* data0, const block* data1, int length) {
14  cnt+=length;
15  io->send_block(data0, length);
16  io->send_block(data1, length);
17  }
18 
19  void recv_impl(block* data, const bool* b, int length) {
20  cnt+=length;
21  block *data1 = new block[length];
22  io->recv_block(data, length);
23  io->recv_block(data1, length);
24  for(int i = 0; i < length; ++i)
25  if(b[i])
26  data[i] = data1[i];
27  delete []data1;
28  }
29 };
31 #endif// OT_IDEAL_H__
int cnt
Definition: ideal.h:9
__m128i block
Definition: block.h:8
Definition: net_io_channel.h:22
void recv_impl(block *data, const bool *b, int length)
Definition: ideal.h:19
OTIdeal(NetIO *io)
Definition: ideal.h:10
NetIO * io
Definition: ot.h:9
Definition: ideal.h:8
void send_block(const block *data, int nblock)
Definition: io_channel.h:132
void recv_block(block *data, int nblock)
Definition: io_channel.h:136
Definition: ot.h:6
void send_impl(const block *data0, const block *data1, int length)
Definition: ideal.h:13