rdpf.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef __RDPF_HPP__
  2. #define __RDPF_HPP__
  3. #include <vector>
  4. #include "mpcio.hpp"
  5. #include "coroutine.hpp"
  6. #include "types.hpp"
  7. struct RDPF {
  8. // The 128-bit seed
  9. DPFnode seed;
  10. // correction words; the depth of the DPF is the length of this
  11. // vector
  12. std::vector<DPFnode> cw;
  13. // correction flag bits: the one for level i is bit i of this word
  14. value_t cfbits;
  15. // The amount we have to scale the low words of the leaf values by
  16. // to get additive shares of a unit vector
  17. value_t unit_sum_inverse;
  18. // Additive share of the scaling value M_as such that the high words
  19. // of the leaf values for P0 and P1 add to M_as * e_{target}
  20. RegAS scaled_sum;
  21. // XOR share of the scaling value M_xs such that the high words
  22. // of the leaf values for P0 and P1 XOR to M_xs * e_{target}
  23. RegXS scaled_xor;
  24. // Construct a DPF with the given (XOR-shared) target location, and
  25. // of the given depth, to be used for random-access memory reads and
  26. // writes. The DPF is construction collaboratively by P0 and P1,
  27. // with the server P2 helping by providing various kinds of
  28. // correlated randomness, such as MultTriples and AndTriples.
  29. //
  30. // Cost:
  31. // (3 DPFnode + 1 byte)*depth + 1 word communication in
  32. // 2*depth + 1 messages
  33. // 3*depth DPFnode communication from P2 to each party
  34. // 2^{depth+1}-2 local AES operations
  35. RDPF(MPCTIO &tio, yield_t &yield,
  36. RegXS target, nbits_t depth);
  37. };
  38. #endif