/* * MaliciousRepPrep.cpp * */ #include "RepPrep.h" #include "ShareThread.h" #include "Processor/OnlineOptions.h" #include "Protocols/MalRepRingPrep.hpp" #include "Protocols/ReplicatedPrep.hpp" #include "Protocols/Replicated.hpp" #include "Protocols/MAC_Check_Base.hpp" namespace GC { template RepPrep::RepPrep(DataPositions& usage, Thread& thread) : BufferPrep(usage), protocol(0) { (void) thread; } template RepPrep::~RepPrep() { if (protocol) delete protocol; } template void RepPrep::set_protocol(typename T::Protocol& protocol) { this->protocol = new ReplicatedBase(protocol.P); } template void RepPrep::buffer_triples() { assert(protocol != 0); auto MC = ShareThread::s().new_mc(); shuffle_triple_generation(this->triples, protocol->P, *MC, 64); delete MC; } template void RepPrep::buffer_bits() { assert(this->protocol != 0); assert(this->protocol->P.num_players() == 3); for (int i = 0; i < OnlineOptions::singleton.batch_size; i++) { this->bits.push_back({}); for (int j = 0; j < 2; j++) this->bits.back()[j] = this->protocol->shared_prngs[j].get_bit(); } } } /* namespace GC */