123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- template <typename T>
- 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<depth; ++i) {
- DPFnode cw;
- is.read((char *)&cw, sizeof(cw));
- cdpf.cw.push_back(cw);
- }
- value_t cfbits = 0;
- is.read((char *)&cfbits, BITBYTES(depth));
- cdpf.cfbits = cfbits;
- is.read((char *)&cdpf.leaf_cwr, sizeof(cdpf.leaf_cwr));
- is.read((char *)&cdpf.as_target, sizeof(cdpf.as_target));
- is.read((char *)&cdpf.xs_target, sizeof(cdpf.xs_target));
- return is;
- }
- template <typename T>
- 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<depth; ++i) {
- os.write((const char *)&cdpf.cw[i], sizeof(cdpf.cw[i]));
- }
- os.write((const char *)&cdpf.cfbits, BITBYTES(depth));
- os.write((const char *)&cdpf.leaf_cwr, sizeof(cdpf.leaf_cwr));
- os.write((const char *)&cdpf.as_target, sizeof(cdpf.as_target));
- os.write((const char *)&cdpf.xs_target, sizeof(cdpf.xs_target));
- return os;
- }
- template <typename T>
- RegBS CDPF::is_zero(MPCTIO &tio, yield_t &yield,
- const T &x, size_t &aes_ops)
- {
-
-
- 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();
-
-
- return is_zero(S, aes_ops);
- } else {
- yield();
- }
-
- RegBS eq;
- return eq;
- }
|