#include "DistDecrypt.h" #include "FHE/P2Data.h" #include "Protocols/MAC_Check.h" template DistDecrypt::DistDecrypt(const Player& P, const FHE_SK& share, const FHE_PK& pk, const FD& FTD) : P(P), share(share), pk(pk), mf(FTD), f(FTD) { vv.resize(pk.get_params().phi_m()); vv1.resize(pk.get_params().phi_m()); // extra limb for operations bigint limit = pk.get_params().Q() << 64; vv.allocate_slots(limit); vv1.allocate_slots(limit); mf.allocate_slots(pk.p() << 64); } class ModuloTreeSum : public TreeSum { bigint modulo; void post_add_process(vector& values) { for (auto& v : values) v %= modulo; } public: ModuloTreeSum(bigint modulo) : modulo(modulo) { } }; template Plaintext_& DistDecrypt::run(const Ciphertext& ctx, bool NewCiphertext) { CODE_LOCATION const FHE_Params& params=ctx.get_params(); share.dist_decrypt_1(vv, ctx,P.my_num(),P.num_players()); if (not NewCiphertext) intermediate_step(); if ((int)vv.size() != params.phi_m()) throw length_error("wrong length of ring element"); if (OnlineOptions::singleton.direct) { // Now pack into an octetStream for broadcasting vector os(P.num_players()); for (int i=0; i; template class DistDecrypt;