/* * Proof.cpp * */ #include "Proof.h" #include "FHEOffline/EncCommit.h" double Proof::dist = 0; bigint Proof::slack(int slack, int sec, int phim) { switch (slack) { case NONINTERACTIVE_SPDZ1_SLACK: cout << "Computing slack for non-interactive SPDZ1 proof" << endl; return NonInteractiveProof::slack(sec, phim); case INTERACTIVE_SPDZ1_SLACK: cout << "Computing slack for interactive SPDZ1 proof" << endl; return InteractiveProof::slack(sec, phim); case COVERT_SPDZ2_SLACK: cout << "No slack for covert SPDZ2 proof" << endl; return 0; case ACTIVE_SPDZ2_SLACK: cout << "Computing slack for active SPDZ2 proof" << endl; return EncCommit_::active_slack(phim); default: if (slack < 0) throw runtime_error("slack type unknown"); return bigint(1) << slack; } } void Proof::get_challenge(vector& e, const octetStream& ciphertexts) const { unsigned int i; bigint hashout = ciphertexts.check_sum(); for (i=0; i>(i))&1; } } class AbsoluteBoundChecker { bigint bound, neg_bound; public: AbsoluteBoundChecker(bigint bound) : bound(bound), neg_bound(-bound) {} bool outside(const bigint& value, double& dist) { (void)dist; #ifdef PRINT_MIN_DIST dist = max(dist, abs(value.get_d()) / bound.get_d()); #endif return value > bound || value < neg_bound; } }; template bool Proof::check_bounds(T& z, AddableMatrix& t, int i) const { unsigned int j,k; // Check Bound 1 and Bound 2 AbsoluteBoundChecker plain_checker(plain_check * n_proofs); AbsoluteBoundChecker rand_checker(rand_check * n_proofs); for (j=0; j& coeffs = t[k]; for (j=0; j& z, AddableMatrix& t, int i) const; template bool Proof::check_bounds(AddableVector& z, AddableMatrix& t, int i) const; template bool Proof::check_bounds(Plaintext_& z, AddableMatrix& t, int i) const;