/* * Replicated.h * */ #ifndef PROCESSOR_REPLICATED_H_ #define PROCESSOR_REPLICATED_H_ #include #include using namespace std; #include "Tools/octetStream.h" #include "Tools/random.h" #include "Networking/Player.h" template class SubProcessor; template class ReplicatedMC; template class ReplicatedInput; template class ReplicatedPrivateOutput; template class Share; template class Rep3Share; template class MAC_Check_Base; class ReplicatedBase { public: PRNG shared_prngs[2]; Player& P; ReplicatedBase(Player& P); }; template class PrepLessProtocol { int counter; public: PrepLessProtocol(); virtual ~PrepLessProtocol(); void muls(const vector& reg, SubProcessor& proc, MAC_Check_Base& MC, int size); virtual void init_mul(SubProcessor* proc) = 0; virtual typename T::clear prepare_mul(const T& x, const T& y) = 0; virtual void exchange() = 0; virtual T finalize_mul() = 0; virtual T get_random() = 0; }; template class Replicated : public ReplicatedBase, public PrepLessProtocol { vector os; deque add_shares; public: typedef ReplicatedMC MAC_Check; typedef ReplicatedInput Input; typedef ReplicatedPrivateOutput PrivateOutput; Replicated(Player& P); static void assign(T& share, const typename T::clear& value, int my_num) { assert(T::length == 2); share.assign_zero(); if (my_num < 2) share[my_num] = value; } void init_mul(SubProcessor* proc); void init_mul(); typename T::clear prepare_mul(const T& x, const T& y); void exchange(); T finalize_mul(); T get_random(); }; #endif /* PROCESSOR_REPLICATED_H_ */