constants.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. \file constants.h
  3. \author michael.zohner@ec-spride.de, daniel.demmler@crisp-da.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 File containing all crypto and networking constants used throughout the source
  17. */
  18. #ifndef _CONSTANTS_H_
  19. #define _CONSTANTS_H_
  20. #include "typedefs.h"
  21. #include <cstdint>
  22. #define BATCH
  23. //#define FIXED_KEY_AES_HASHING
  24. //#define USE_PIPELINED_AES_NI
  25. //#define SIMPLE_TRANSPOSE //activate the simple transpose, only required for benchmarking, not recommended
  26. #define AES_KEY_BITS 128
  27. #define AES_KEY_BYTES 16
  28. #define AES_BITS 128
  29. #define AES_BYTES 16
  30. #define LOG2_AES_BITS ceil_log2(AES_BITS)
  31. #define SHA1_OUT_BYTES 20
  32. #define SHA256_OUT_BYTES 32
  33. #define SHA512_OUT_BYTES 64
  34. #define MAX_NUM_COMM_CHANNELS 256
  35. #define ADMIN_CHANNEL MAX_NUM_COMM_CHANNELS-1
  36. enum field_type {P_FIELD, ECC_FIELD, FIELD_LAST};
  37. static const seclvl ST = { 40, 80, 1024 };
  38. static const seclvl MT = { 40, 112, 2048 };
  39. static const seclvl LT = { 40, 128, 3072 };
  40. static const seclvl XLT = { 40, 192, 7680 };
  41. static const seclvl XXLT = { 40, 256, 15360 };
  42. const uint8_t m_vFixedKeyAESSeed[AES_KEY_BYTES] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
  43. /** \var m_vSeed
  44. \brief Static seed for various testing functionalities
  45. */
  46. const uint8_t m_vSeed[AES_KEY_BYTES] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
  47. inline const char* getFieldType(field_type ftype) {
  48. switch (ftype) {
  49. case P_FIELD: return "P_FIELD";
  50. case ECC_FIELD: return "ECC_FIELD";
  51. default: return "unknown field";
  52. }
  53. }
  54. #endif /* _CONSTANTS_H_ */