rdpf.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 constructed collaboratively by P0 and P1,
  27. // with the server P2 helping by providing correlated randomness,
  28. // such as SelectTriples.
  29. //
  30. // Cost:
  31. // (2 DPFnode + 2 bytes)*depth + 1 word communication in
  32. // 2*depth + 1 messages
  33. // (2 DPFnode + 1 byte)*depth communication from P2 to each party
  34. // 2^{depth+1}-2 local AES operations for P0,P1
  35. // 0 local AES operations for P2
  36. RDPF(MPCTIO &tio, yield_t &yield,
  37. RegXS target, nbits_t depth);
  38. };
  39. #endif