KeccakSponge.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
  3. Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, hereby
  4. denoted as "the implementer".
  5. For more information, feedback or questions, please refer to our websites:
  6. http://keccak.noekeon.org/
  7. http://keyak.noekeon.org/
  8. http://ketje.noekeon.org/
  9. To the extent possible under law, the implementer has waived all copyright
  10. and related or neighboring rights to the source code in this file.
  11. http://creativecommons.org/publicdomain/zero/1.0/
  12. */
  13. #include "KeccakSponge.h"
  14. #ifdef KeccakReference
  15. #include "displayIntermediateValues.h"
  16. #endif
  17. #ifndef KeccakP200_excluded
  18. #include "KeccakP-200-SnP.h"
  19. #define prefix KeccakWidth200
  20. #define SnP KeccakP200
  21. #define SnP_width 200
  22. #define SnP_Permute KeccakP200_Permute_18rounds
  23. #if defined(KeccakF200_FastLoop_supported)
  24. #define SnP_FastLoop_Absorb KeccakF200_FastLoop_Absorb
  25. #endif
  26. #include "KeccakSponge.inc"
  27. #undef prefix
  28. #undef SnP
  29. #undef SnP_width
  30. #undef SnP_Permute
  31. #undef SnP_FastLoop_Absorb
  32. #endif
  33. #ifndef KeccakP400_excluded
  34. #include "KeccakP-400-SnP.h"
  35. #define prefix KeccakWidth400
  36. #define SnP KeccakP400
  37. #define SnP_width 400
  38. #define SnP_Permute KeccakP400_Permute_20rounds
  39. #if defined(KeccakF400_FastLoop_supported)
  40. #define SnP_FastLoop_Absorb KeccakF400_FastLoop_Absorb
  41. #endif
  42. #include "KeccakSponge.inc"
  43. #undef prefix
  44. #undef SnP
  45. #undef SnP_width
  46. #undef SnP_Permute
  47. #undef SnP_FastLoop_Absorb
  48. #endif
  49. #ifndef KeccakP800_excluded
  50. #include "KeccakP-800-SnP.h"
  51. #define prefix KeccakWidth800
  52. #define SnP KeccakP800
  53. #define SnP_width 800
  54. #define SnP_Permute KeccakP800_Permute_22rounds
  55. #if defined(KeccakF800_FastLoop_supported)
  56. #define SnP_FastLoop_Absorb KeccakF800_FastLoop_Absorb
  57. #endif
  58. #include "KeccakSponge.inc"
  59. #undef prefix
  60. #undef SnP
  61. #undef SnP_width
  62. #undef SnP_Permute
  63. #undef SnP_FastLoop_Absorb
  64. #endif
  65. #ifndef KeccakP1600_excluded
  66. #include "KeccakP-1600-SnP.h"
  67. #define prefix KeccakWidth1600
  68. #define SnP KeccakP1600
  69. #define SnP_width 1600
  70. #define SnP_Permute KeccakP1600_Permute_24rounds
  71. #if defined(KeccakF1600_FastLoop_supported)
  72. #define SnP_FastLoop_Absorb KeccakF1600_FastLoop_Absorb
  73. #endif
  74. #include "KeccakSponge.inc"
  75. #undef prefix
  76. #undef SnP
  77. #undef SnP_width
  78. #undef SnP_Permute
  79. #undef SnP_FastLoop_Absorb
  80. #endif
  81. #ifndef KeccakP1600_excluded
  82. #include "KeccakP-1600-SnP.h"
  83. #define prefix KeccakWidth1600_12rounds
  84. #define SnP KeccakP1600
  85. #define SnP_width 1600
  86. #define SnP_Permute KeccakP1600_Permute_12rounds
  87. #if defined(KeccakP1600_12rounds_FastLoop_supported)
  88. #define SnP_FastLoop_Absorb KeccakP1600_12rounds_FastLoop_Absorb
  89. #endif
  90. #include "KeccakSponge.inc"
  91. #undef prefix
  92. #undef SnP
  93. #undef SnP_width
  94. #undef SnP_Permute
  95. #undef SnP_FastLoop_Absorb
  96. #endif