// Templated method implementations for cdpf.hpp // I/O for CDPFs // Read the DPF from the output stream. You can use this to read DPFs // from files or from the network. template T& operator>>(T &is, CDPF &cdpf) { is.read((char *)&cdpf.seed, sizeof(cdpf.seed)); cdpf.whichhalf = get_lsb(cdpf.seed); uint8_t depth = VALUE_BITS - 7; cdpf.cw.clear(); for (uint8_t i=0; i T& operator<<(T &os, const CDPF &cdpf) { os.write((const char *)&cdpf.seed, sizeof(cdpf.seed)); uint8_t depth = VALUE_BITS - 7; for (uint8_t i=0; i RegBS CDPF::is_zero(MPCTIO &tio, yield_t &yield, const T &x, size_t &aes_ops) { // Reconstruct S = target-x // The server does nothing in this protocol if (tio.player() < 2) { T S_share; get_target(S_share); S_share -= x; tio.iostream_peer() << S_share; yield(); T peer_S_share; tio.iostream_peer() >> peer_S_share; S_share += peer_S_share; value_t S = S_share.share(); // After that one single-word exchange, the rest of this // algorithm is entirely a local computation. return is_zero(S, aes_ops); } else { yield(); } // The server gets a share of 0 RegBS eq; return eq; }