/* * ReplicatedPrep.h * */ #ifndef PROCESSOR_REPLICATEDPREP_H_ #define PROCESSOR_REPLICATEDPREP_H_ #include "Networking/Player.h" #include "Data_Files.h" #include template class BufferPrep : public Preprocessing { protected: vector> triples; vector> squares; vector> inverses; vector bits; vector>> inputs; virtual void buffer_triples() = 0; virtual void buffer_squares() = 0; virtual void buffer_inverses() = 0; virtual void buffer_bits() = 0; virtual void buffer_inputs(int player); virtual void buffer_inverses(MAC_Check_Base& MC, Player& P); public: int buffer_size; BufferPrep(DataPositions& usage) : Preprocessing(usage), buffer_size(10000) {} virtual ~BufferPrep() {} void get_three_no_count(Dtype dtype, T& a, T& b, T& c); void get_two_no_count(Dtype dtype, T& a, T& b); void get_one_no_count(Dtype dtype, T& a); void get_input_no_count(T& a, typename T::open_type& x, int i); void get_no_count(vector& S, DataTag tag, const vector& regs, int vector_size); }; template class RingPrep : public BufferPrep { protected: template friend class MaliciousRepPrep; typename T::Protocol* protocol; SubProcessor* proc; int base_player; void buffer_squares(); void buffer_inverses() { throw runtime_error("not inverses in rings"); } public: RingPrep(SubProcessor* proc, DataPositions& usage); virtual ~RingPrep() {} void set_proc(SubProcessor* proc) { this->proc = proc; } void set_protocol(typename T::Protocol& protocol); virtual void buffer_bits(); }; template void generate_triples(vector>& triples, int n_triples, typename T::Protocol* protocol); template class ReplicatedRingPrep : public RingPrep { protected: void buffer_triples(); void buffer_squares(); public: ReplicatedRingPrep(SubProcessor* proc, DataPositions& usage) : RingPrep(proc, usage) {}; }; template class ReplicatedPrep: public ReplicatedRingPrep { void buffer_inverses(); public: ReplicatedPrep(SubProcessor* proc, DataPositions& usage) : ReplicatedRingPrep(proc, usage) {} void buffer_bits(); }; #endif /* PROCESSOR_REPLICATEDPREP_H_ */