/* * Multiplier.h * */ #ifndef FHEOFFLINE_MULTIPLIER_H_ #define FHEOFFLINE_MULTIPLIER_H_ #include "FHEOffline/SimpleEncCommit.h" #include "FHE/AddableVector.h" #include "Tools/MemoryUsage.h" #include "OT/BaseOT.h" template using PlaintextVector = AddableVector< Plaintext_ >; template class PairwiseGenerator; class PairwiseMachine; template class Multiplier { PairwiseMachine& machine; OffsetPlayer P; int num_players, my_num; const FHE_PK& other_pk; const Ciphertext& other_enc_alpha; map& timers; // temporary Ciphertext C, mask; Plaintext_ product_share; Random_Coins rc; size_t volatile_capacity; MemoryUsage memory_usage; octetStream o; public: Multiplier(int offset, PairwiseGenerator& generator); Multiplier(int offset, PairwiseMachine& machine, Player& P, map& timers); void multiply_and_add(Plaintext_& res, const Ciphertext& C, const Plaintext_& b); void multiply_and_add(Plaintext_& res, const Ciphertext& C, const Rq_Element& b, OT_ROLE role = BOTH); void add(Plaintext_& res, const Ciphertext& C, OT_ROLE role = BOTH, int n_summands = 1); void multiply_alpha_and_add(Plaintext_& res, const Rq_Element& b, OT_ROLE role = BOTH); int get_offset() { return P.get_offset(); } size_t report_size(ReportType type); void report_size(ReportType type, MemoryUsage& res); size_t report_volatile() { return volatile_capacity; } const vector& get_multiplicands( const vector>& others_ct, const FHE_PK&); }; #endif /* FHEOFFLINE_MULTIPLIER_H_ */