mpcops.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef __MPCOPS_HPP__
  2. #define __MPCOPS_HPP__
  3. #include "types.hpp"
  4. #include "mpcio.hpp"
  5. #include "coroutine.hpp"
  6. // as_ denotes additive shares
  7. // xs_ denotes xor shares
  8. // bs_ denotes a share of a single bit (which is effectively both an xor
  9. // share and an additive share mod 2)
  10. // P0 and P1 both hold additive shares of x and y; compute additive
  11. // shares of z = x*y. x, y, and z are each at most nbits bits long.
  12. //
  13. // Cost:
  14. // 1 word sent in 1 message
  15. // consumes 1 MultTriple
  16. void mpc_mul(MPCIO &mpcio, size_t thread_num, yield_t &yield,
  17. value_t &as_z, value_t as_x, value_t as_y,
  18. MultTriple &T, nbits_t nbits = VALUE_BITS);
  19. // P0 holds the (complete) value x, P1 holds the (complete) value y;
  20. // compute additive shares of z = x*y. x, y, and z are each at most
  21. // nbits bits long. The parameter is called x, but P1 will pass y
  22. // there.
  23. //
  24. // Cost:
  25. // 1 word sent in 1 message
  26. // consumes 1 HalfTriple
  27. void mpc_valuemul(MPCIO &mpcio, size_t thread_num, yield_t &yield,
  28. value_t &as_z, value_t x,
  29. HalfTriple &H, nbits_t nbits = VALUE_BITS);
  30. #endif