typedefs.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. \file typedefs.h
  3. \author michael.zohner@ec-spride.de
  4. \copyright ABY - A Framework for Efficient Mixed-protocol Secure Two-party Computation
  5. Copyright (C) 2019 ENCRYPTO Group, TU Darmstadt
  6. This program is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU Lesser General Public License as published
  8. by the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. ABY is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public License
  15. along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. \brief Typedefs Implementation
  17. */
  18. #ifndef __TYPEDEFS_H__
  19. #define __TYPEDEFS_H__
  20. #include <cstdint>
  21. typedef int BOOL;
  22. typedef unsigned char BYTE;
  23. typedef uint64_t UGATE_T;
  24. typedef uint64_t REGISTER_SIZE;
  25. typedef struct SECURITYLEVELS {
  26. uint32_t statbits;
  27. uint32_t symbits;
  28. uint32_t ifcbits;
  29. //ECCLVL depends on CMAKE settings
  30. } seclvl;
  31. //ECCLVL depends on CMAKE settings
  32. #define GATE_T_BITS (sizeof(UGATE_T) * 8)
  33. typedef REGISTER_SIZE REGSIZE;
  34. #define LOG2_REGISTER_SIZE ceil_log2(sizeof(REGISTER_SIZE) << 3)
  35. #define FILL_BYTES AES_BYTES
  36. #define FILL_BITS AES_BITS
  37. #define RETRY_CONNECT 1000
  38. #define CONNECT_TIMEO_MILISEC 10000
  39. #define SNDVALS 2
  40. #define OTEXT_BLOCK_SIZE_BITS AES_BITS
  41. #define OTEXT_BLOCK_SIZE_BYTES AES_BYTES
  42. #define VECTOR_INTERNAL_SIZE 8
  43. #define SERVER_ID 0
  44. #define CLIENT_ID 1
  45. template<class T>
  46. T rem(T a, T b) {
  47. return ((a) > 0) ? (a) % (b) : (a) % (b) + ((b) > 0 ? (b) : (b) * -1);
  48. }
  49. template<class T>
  50. T sub(T a, T b, T m) {
  51. return ((b) > (a)) ? (a) + (m) - (b) : (a) - (b);
  52. }
  53. #ifndef FALSE
  54. #define FALSE 0
  55. #endif
  56. #ifndef TRUE
  57. #define TRUE 1
  58. #endif
  59. #define ZERO_BYTE 0
  60. #define MAX_BYTE 0xFF
  61. #endif //__TYPEDEFS_H__