ot_blinds.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef _OTTEST_H_
  2. #define _OTTEST_H_
  3. #include <ENCRYPTO_utils/typedefs.h>
  4. #include <ENCRYPTO_utils/crypto/crypto.h>
  5. #include <ENCRYPTO_utils/socket.h>
  6. #include "ot/iknp-ot-ext-snd.h"
  7. #include "ot/iknp-ot-ext-rec.h"
  8. #include "ot/alsz-ot-ext-snd.h"
  9. #include "ot/alsz-ot-ext-rec.h"
  10. #include "ot/nnob-ot-ext-snd.h"
  11. #include "ot/nnob-ot-ext-rec.h"
  12. #include <ENCRYPTO_utils/cbitvector.h>
  13. #include "ot/xormasking.h"
  14. #include <ENCRYPTO_utils/rcvthread.h>
  15. #include <ENCRYPTO_utils/sndthread.h>
  16. #include <ENCRYPTO_utils/channel.h>
  17. #include <ENCRYPTO_utils/timer.h>
  18. #include <vector>
  19. #include <sys/time.h>
  20. #include <limits.h>
  21. #include <iomanip>
  22. #include <string>
  23. uint16_t m_nPort = 7894;
  24. const std::string* m_nAddr;
  25. static const char* m_cConstSeed[2] = {"437398417012387813714564100", "15657566154164561"};
  26. struct test_options {
  27. ot_ext_prot prot;
  28. uint64_t numots;
  29. uint64_t bitlen;
  30. snd_ot_flavor sflavor;
  31. rec_ot_flavor rflavor;
  32. uint32_t nthreads;
  33. field_type ftype;
  34. bool usemecr;
  35. };
  36. test_options* tests;
  37. uint32_t m_nTests;
  38. uint32_t gen_tests;
  39. uint32_t m_nPID;
  40. void recursive_assign_test_params(uint32_t* max, uint32_t depth, test_options** tops, uint32_t max_depth);
  41. void assign_param(uint32_t ctr, uint32_t depth, test_options* tops);
  42. BOOL Init();
  43. BOOL Cleanup();
  44. BOOL Connect();
  45. BOOL Listen();
  46. void InitSender(const std::string& address, const int port, CLock *glock);
  47. void InitReceiver(const std::string& address, const int port, CLock *glock);
  48. OTExtSnd* InitOTExtSnd(ot_ext_prot m_eProt, uint32_t nbaseots, uint32_t nchecks, bool enablemecr, field_type ftype, crypto* crypt);
  49. OTExtRec* InitOTExtRec(ot_ext_prot m_eProt, uint32_t nbaseots, uint32_t nchecks, bool enablemecr, field_type ftype, crypto* crypt);
  50. void run_test_sender(uint32_t numots, uint32_t bitlength, snd_ot_flavor stype, rec_ot_flavor rtype, uint32_t numthreads, crypto* crypt, OTExtSnd* sender);
  51. void run_test_receiver(uint32_t numots, uint32_t bitlength, snd_ot_flavor stype, rec_ot_flavor rtype, uint32_t numthreads, crypto* crypt, OTExtRec* receiver);
  52. // Network Communication
  53. std::unique_ptr<CSocket> m_Socket;
  54. SndThread* sndthread;
  55. RcvThread* rcvthread;
  56. #endif