digest-kangarootwelve 0.0.2 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (307) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +71 -37
  3. data/Rakefile +7 -9
  4. data/digest-kangarootwelve.gemspec +323 -14
  5. data/ext/digest/kangarootwelve/ext.c +228 -177
  6. data/ext/digest/kangarootwelve/extconf.rb +15 -1
  7. data/ext/digest/kangarootwelve/keccak/armv6m/KangarooTwelve.link.c +1 -0
  8. data/ext/digest/kangarootwelve/keccak/armv6m/KeccakDuplexWidth1600.link.c +1 -0
  9. data/ext/digest/kangarootwelve/keccak/armv6m/KeccakP-1600-SnP.h +36 -0
  10. data/ext/digest/kangarootwelve/{KeccakP-1600-times2-SnP.h → keccak/armv6m/KeccakP-1600-times2-SnP.h} +10 -10
  11. data/ext/digest/kangarootwelve/{KeccakP-1600-times2-on1.c → keccak/armv6m/KeccakP-1600-times2-on1.c} +13 -7
  12. data/ext/digest/kangarootwelve/{KeccakP-1600-times4-SnP.h → keccak/armv6m/KeccakP-1600-times4-SnP.h} +10 -10
  13. data/ext/digest/kangarootwelve/{KeccakP-1600-times4-on1.c → keccak/armv6m/KeccakP-1600-times4-on1.c} +13 -7
  14. data/ext/digest/kangarootwelve/{KeccakP-1600-times8-SnP.h → keccak/armv6m/KeccakP-1600-times8-SnP.h} +10 -10
  15. data/ext/digest/kangarootwelve/{KeccakP-1600-times8-on1.c → keccak/armv6m/KeccakP-1600-times8-on1.c} +13 -7
  16. data/ext/digest/kangarootwelve/keccak/armv6m/KeccakP-1600-u2-32bi-armv6m-le-gcc.s +1334 -0
  17. data/ext/digest/kangarootwelve/keccak/armv6m/KeccakSpongeWidth1600.link.c +1 -0
  18. data/ext/digest/kangarootwelve/{PlSnP-Fallback.inc → keccak/armv6m/PlSnP-Fallback.inc} +11 -7
  19. data/ext/digest/kangarootwelve/keccak/armv6m/ext.link.c +1 -0
  20. data/ext/digest/kangarootwelve/keccak/armv7a/KangarooTwelve.link.c +1 -0
  21. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakDuplexWidth1600.link.c +1 -0
  22. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-SnP.h +37 -0
  23. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-armv7a-le-neon-gcc.s +826 -0
  24. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-inplace-pl2-armv7a-neon-le-gcc.s +1245 -0
  25. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times2-SnP.h +38 -0
  26. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times4-SnP.h +45 -0
  27. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times4-on2.c +38 -0
  28. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times8-SnP.h +45 -0
  29. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times8-on2.c +38 -0
  30. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakSpongeWidth1600.link.c +1 -0
  31. data/ext/digest/kangarootwelve/keccak/armv7a/PlSnP-Fallback.inc +287 -0
  32. data/ext/digest/kangarootwelve/keccak/armv7a/ext.link.c +1 -0
  33. data/ext/digest/kangarootwelve/keccak/armv7m/KangarooTwelve.link.c +1 -0
  34. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakDuplexWidth1600.link.c +1 -0
  35. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-SnP.h +36 -0
  36. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-inplace-32bi-armv7m-le-gcc.s +1170 -0
  37. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times2-SnP.h +45 -0
  38. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times2-on1.c +37 -0
  39. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times4-SnP.h +45 -0
  40. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times4-on1.c +37 -0
  41. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times8-SnP.h +45 -0
  42. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times8-on1.c +37 -0
  43. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakSpongeWidth1600.link.c +1 -0
  44. data/ext/digest/kangarootwelve/keccak/armv7m/PlSnP-Fallback.inc +287 -0
  45. data/ext/digest/kangarootwelve/keccak/armv7m/ext.link.c +1 -0
  46. data/ext/digest/kangarootwelve/keccak/armv8a/KangarooTwelve.link.c +1 -0
  47. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakDuplexWidth1600.link.c +1 -0
  48. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-SnP.h +28 -0
  49. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-armv8a-neon.s +537 -0
  50. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times2-SnP.h +45 -0
  51. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times2-on1.c +37 -0
  52. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times4-SnP.h +45 -0
  53. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times4-on1.c +37 -0
  54. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times8-SnP.h +45 -0
  55. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times8-on1.c +37 -0
  56. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakSpongeWidth1600.link.c +1 -0
  57. data/ext/digest/kangarootwelve/keccak/armv8a/PlSnP-Fallback.inc +287 -0
  58. data/ext/digest/kangarootwelve/keccak/armv8a/ext.link.c +1 -0
  59. data/ext/digest/kangarootwelve/keccak/asmx86-64/KangarooTwelve.link.c +1 -0
  60. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakDuplexWidth1600.link.c +1 -0
  61. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-SnP.h +37 -0
  62. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times2-SnP.h +45 -0
  63. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times2-on1.c +37 -0
  64. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times4-SnP.h +45 -0
  65. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times4-on1.c +37 -0
  66. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times8-SnP.h +45 -0
  67. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times8-on1.c +37 -0
  68. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-x86-64-gas.s +1190 -0
  69. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakSpongeWidth1600.link.c +1 -0
  70. data/ext/digest/kangarootwelve/keccak/asmx86-64/PlSnP-Fallback.inc +287 -0
  71. data/ext/digest/kangarootwelve/keccak/asmx86-64/ext.link.c +1 -0
  72. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KangarooTwelve.link.c +1 -0
  73. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakDuplexWidth1600.link.c +1 -0
  74. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-SnP.h +37 -0
  75. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times2-SnP.h +45 -0
  76. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times2-on1.c +37 -0
  77. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times4-SnP.h +45 -0
  78. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times4-on1.c +37 -0
  79. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times8-SnP.h +45 -0
  80. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times8-on1.c +37 -0
  81. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-x86-64-shld-gas.s +1190 -0
  82. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakSpongeWidth1600.link.c +1 -0
  83. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/PlSnP-Fallback.inc +287 -0
  84. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/ext.link.c +1 -0
  85. data/ext/digest/kangarootwelve/keccak/avr8/KangarooTwelve.link.c +1 -0
  86. data/ext/digest/kangarootwelve/keccak/avr8/KeccakDuplexWidth1600.link.c +1 -0
  87. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-SnP.h +37 -0
  88. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-avr8-fast.s +1116 -0
  89. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times2-SnP.h +45 -0
  90. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times2-on1.c +37 -0
  91. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times4-SnP.h +45 -0
  92. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times4-on1.c +37 -0
  93. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times8-SnP.h +45 -0
  94. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times8-on1.c +37 -0
  95. data/ext/digest/kangarootwelve/keccak/avr8/KeccakSpongeWidth1600.link.c +1 -0
  96. data/ext/digest/kangarootwelve/keccak/avr8/PlSnP-Fallback.inc +287 -0
  97. data/ext/digest/kangarootwelve/keccak/avr8/ext.link.c +1 -0
  98. data/ext/digest/kangarootwelve/keccak/bulldozer/KangarooTwelve.link.c +1 -0
  99. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakDuplexWidth1600.link.c +1 -0
  100. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-SnP.h +39 -0
  101. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-XOP-config.h +6 -0
  102. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-XOP.c +473 -0
  103. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times2-SIMD128.c +954 -0
  104. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times2-SnP.h +47 -0
  105. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times4-SnP.h +45 -0
  106. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times4-on2.c +38 -0
  107. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times8-SnP.h +45 -0
  108. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times8-on2.c +38 -0
  109. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-unrolling.macros +302 -0
  110. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakSpongeWidth1600.link.c +1 -0
  111. data/ext/digest/kangarootwelve/keccak/bulldozer/PlSnP-Fallback.inc +287 -0
  112. data/ext/digest/kangarootwelve/keccak/bulldozer/SIMD128-config.h +9 -0
  113. data/ext/digest/kangarootwelve/{SnP-Relaned.h → keccak/bulldozer/SnP-Relaned.h} +13 -7
  114. data/ext/digest/kangarootwelve/keccak/bulldozer/ext.link.c +1 -0
  115. data/ext/digest/kangarootwelve/{KangarooTwelve.c → keccak/common/KangarooTwelve.c} +6 -10
  116. data/ext/digest/kangarootwelve/{KangarooTwelve.h → keccak/common/KangarooTwelve.h} +3 -7
  117. data/ext/digest/kangarootwelve/keccak/common/KeccakDuplex-common.h +37 -0
  118. data/ext/digest/kangarootwelve/keccak/common/KeccakDuplex.inc +192 -0
  119. data/ext/digest/kangarootwelve/keccak/common/KeccakDuplexWidth1600.c +34 -0
  120. data/ext/digest/kangarootwelve/keccak/common/KeccakDuplexWidth1600.h +25 -0
  121. data/ext/digest/kangarootwelve/{KeccakSponge-common.h → keccak/common/KeccakSponge-common.h} +5 -7
  122. data/ext/digest/kangarootwelve/{KeccakSponge.inc → keccak/common/KeccakSponge.inc} +6 -8
  123. data/ext/digest/kangarootwelve/{KeccakSpongeWidth1600.c → keccak/common/KeccakSpongeWidth1600.c} +6 -8
  124. data/ext/digest/kangarootwelve/{KeccakSpongeWidth1600.h → keccak/common/KeccakSpongeWidth1600.h} +5 -7
  125. data/ext/digest/kangarootwelve/{Phases.h → keccak/common/Phases.h} +3 -7
  126. data/ext/digest/kangarootwelve/{align.h → keccak/common/align.h} +5 -7
  127. data/ext/digest/kangarootwelve/{brg_endian.h → keccak/common/brg_endian.h} +0 -0
  128. data/ext/digest/kangarootwelve/keccak/compact/KangarooTwelve.link.c +1 -0
  129. data/ext/digest/kangarootwelve/keccak/compact/KeccakDuplexWidth1600.link.c +1 -0
  130. data/ext/digest/kangarootwelve/{KeccakP-1600-SnP.h → keccak/compact/KeccakP-1600-SnP.h} +7 -10
  131. data/ext/digest/kangarootwelve/{KeccakP-1600-compact64.c → keccak/compact/KeccakP-1600-compact64.c} +11 -7
  132. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times2-SnP.h +45 -0
  133. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times2-on1.c +37 -0
  134. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times4-SnP.h +45 -0
  135. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times4-on1.c +37 -0
  136. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times8-SnP.h +45 -0
  137. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times8-on1.c +37 -0
  138. data/ext/digest/kangarootwelve/keccak/compact/KeccakSpongeWidth1600.link.c +1 -0
  139. data/ext/digest/kangarootwelve/keccak/compact/PlSnP-Fallback.inc +287 -0
  140. data/ext/digest/kangarootwelve/keccak/compact/SnP-Relaned.h +140 -0
  141. data/ext/digest/kangarootwelve/keccak/compact/ext.link.c +1 -0
  142. data/ext/digest/kangarootwelve/keccak/generic32/KangarooTwelve.link.c +1 -0
  143. data/ext/digest/kangarootwelve/keccak/generic32/KeccakDuplexWidth1600.link.c +1 -0
  144. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-SnP.h +38 -0
  145. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-inplace32BI.c +1162 -0
  146. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times2-SnP.h +45 -0
  147. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times2-on1.c +37 -0
  148. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times4-SnP.h +45 -0
  149. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times4-on1.c +37 -0
  150. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times8-SnP.h +45 -0
  151. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times8-on1.c +37 -0
  152. data/ext/digest/kangarootwelve/keccak/generic32/KeccakSpongeWidth1600.link.c +1 -0
  153. data/ext/digest/kangarootwelve/keccak/generic32/PlSnP-Fallback.inc +287 -0
  154. data/ext/digest/kangarootwelve/keccak/generic32/SnP-Relaned.h +140 -0
  155. data/ext/digest/kangarootwelve/keccak/generic32/ext.link.c +1 -0
  156. data/ext/digest/kangarootwelve/keccak/generic32lc/KangarooTwelve.link.c +1 -0
  157. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakDuplexWidth1600.link.c +1 -0
  158. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-SnP.h +38 -0
  159. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-inplace32BI.c +1162 -0
  160. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times2-SnP.h +45 -0
  161. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times2-on1.c +37 -0
  162. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times4-SnP.h +45 -0
  163. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times4-on1.c +37 -0
  164. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times8-SnP.h +45 -0
  165. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times8-on1.c +37 -0
  166. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakSpongeWidth1600.link.c +1 -0
  167. data/ext/digest/kangarootwelve/keccak/generic32lc/PlSnP-Fallback.inc +287 -0
  168. data/ext/digest/kangarootwelve/keccak/generic32lc/SnP-Relaned.h +140 -0
  169. data/ext/digest/kangarootwelve/keccak/generic32lc/ext.link.c +1 -0
  170. data/ext/digest/kangarootwelve/keccak/generic64/KangarooTwelve.link.c +1 -0
  171. data/ext/digest/kangarootwelve/keccak/generic64/KeccakDuplexWidth1600.link.c +1 -0
  172. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-64.macros +2195 -0
  173. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-SnP.h +49 -0
  174. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-opt64-config.h +6 -0
  175. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-opt64.c +541 -0
  176. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times2-SnP.h +45 -0
  177. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times2-on1.c +37 -0
  178. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times4-SnP.h +45 -0
  179. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times4-on1.c +37 -0
  180. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times8-SnP.h +45 -0
  181. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times8-on1.c +37 -0
  182. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-unrolling.macros +302 -0
  183. data/ext/digest/kangarootwelve/keccak/generic64/KeccakSpongeWidth1600.link.c +1 -0
  184. data/ext/digest/kangarootwelve/keccak/generic64/PlSnP-Fallback.inc +287 -0
  185. data/ext/digest/kangarootwelve/keccak/generic64/SnP-Relaned.h +140 -0
  186. data/ext/digest/kangarootwelve/keccak/generic64/ext.link.c +1 -0
  187. data/ext/digest/kangarootwelve/keccak/generic64lc/KangarooTwelve.link.c +1 -0
  188. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakDuplexWidth1600.link.c +1 -0
  189. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-64.macros +2195 -0
  190. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-SnP.h +49 -0
  191. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-opt64-config.h +7 -0
  192. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-opt64.c +541 -0
  193. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times2-SnP.h +45 -0
  194. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times2-on1.c +37 -0
  195. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times4-SnP.h +45 -0
  196. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times4-on1.c +37 -0
  197. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times8-SnP.h +45 -0
  198. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times8-on1.c +37 -0
  199. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-unrolling.macros +302 -0
  200. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakSpongeWidth1600.link.c +1 -0
  201. data/ext/digest/kangarootwelve/keccak/generic64lc/PlSnP-Fallback.inc +287 -0
  202. data/ext/digest/kangarootwelve/keccak/generic64lc/SnP-Relaned.h +140 -0
  203. data/ext/digest/kangarootwelve/keccak/generic64lc/ext.link.c +1 -0
  204. data/ext/digest/kangarootwelve/keccak/haswell/KangarooTwelve.link.c +1 -0
  205. data/ext/digest/kangarootwelve/keccak/haswell/KeccakDuplexWidth1600.link.c +1 -0
  206. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-AVX2.s +993 -0
  207. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-SnP.h +41 -0
  208. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times2-SIMD128.c +954 -0
  209. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times2-SnP.h +47 -0
  210. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times4-SIMD256.c +1303 -0
  211. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times4-SnP.h +53 -0
  212. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times8-SnP.h +45 -0
  213. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times8-on4.c +38 -0
  214. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-unrolling.macros +302 -0
  215. data/ext/digest/kangarootwelve/keccak/haswell/KeccakSpongeWidth1600.link.c +1 -0
  216. data/ext/digest/kangarootwelve/keccak/haswell/PlSnP-Fallback.inc +287 -0
  217. data/ext/digest/kangarootwelve/keccak/haswell/SIMD128-config.h +8 -0
  218. data/ext/digest/kangarootwelve/keccak/haswell/SIMD256-config.h +7 -0
  219. data/ext/digest/kangarootwelve/keccak/haswell/ext.link.c +1 -0
  220. data/ext/digest/kangarootwelve/keccak/nehalem/KangarooTwelve.link.c +1 -0
  221. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakDuplexWidth1600.link.c +1 -0
  222. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-64.macros +2195 -0
  223. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-SnP.h +49 -0
  224. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-opt64-config.h +7 -0
  225. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-opt64.c +541 -0
  226. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times2-SIMD128.c +954 -0
  227. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times2-SnP.h +47 -0
  228. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times4-SnP.h +45 -0
  229. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times4-on2.c +38 -0
  230. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times8-SnP.h +45 -0
  231. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times8-on2.c +38 -0
  232. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-unrolling.macros +302 -0
  233. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakSpongeWidth1600.link.c +1 -0
  234. data/ext/digest/kangarootwelve/keccak/nehalem/PlSnP-Fallback.inc +287 -0
  235. data/ext/digest/kangarootwelve/keccak/nehalem/SIMD128-config.h +8 -0
  236. data/ext/digest/kangarootwelve/keccak/nehalem/SnP-Relaned.h +140 -0
  237. data/ext/digest/kangarootwelve/keccak/nehalem/ext.link.c +1 -0
  238. data/ext/digest/kangarootwelve/keccak/reference/KangarooTwelve.link.c +1 -0
  239. data/ext/digest/kangarootwelve/keccak/reference/KeccakDuplexWidth1600.link.c +1 -0
  240. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-SnP.h +41 -0
  241. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-reference.c +424 -0
  242. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-reference.h +20 -0
  243. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times2-SnP.h +45 -0
  244. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times2-on1.c +37 -0
  245. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times4-SnP.h +45 -0
  246. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times4-on1.c +37 -0
  247. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times8-SnP.h +45 -0
  248. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times8-on1.c +37 -0
  249. data/ext/digest/kangarootwelve/keccak/reference/KeccakSpongeWidth1600.link.c +1 -0
  250. data/ext/digest/kangarootwelve/keccak/reference/PlSnP-Fallback.inc +287 -0
  251. data/ext/digest/kangarootwelve/keccak/reference/displayIntermediateValues.c +176 -0
  252. data/ext/digest/kangarootwelve/keccak/reference/displayIntermediateValues.h +29 -0
  253. data/ext/digest/kangarootwelve/keccak/reference/ext.link.c +1 -0
  254. data/ext/digest/kangarootwelve/keccak/reference32bits/KangarooTwelve.link.c +1 -0
  255. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakDuplexWidth1600.link.c +1 -0
  256. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-SnP.h +41 -0
  257. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-reference.h +20 -0
  258. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-reference32BI.c +612 -0
  259. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times2-SnP.h +45 -0
  260. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times2-on1.c +37 -0
  261. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times4-SnP.h +45 -0
  262. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times4-on1.c +37 -0
  263. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times8-SnP.h +45 -0
  264. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times8-on1.c +37 -0
  265. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakSpongeWidth1600.link.c +1 -0
  266. data/ext/digest/kangarootwelve/keccak/reference32bits/PlSnP-Fallback.inc +287 -0
  267. data/ext/digest/kangarootwelve/keccak/reference32bits/displayIntermediateValues.c +176 -0
  268. data/ext/digest/kangarootwelve/keccak/reference32bits/displayIntermediateValues.h +29 -0
  269. data/ext/digest/kangarootwelve/keccak/reference32bits/ext.link.c +1 -0
  270. data/ext/digest/kangarootwelve/keccak/sandybridge/KangarooTwelve.link.c +1 -0
  271. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakDuplexWidth1600.link.c +1 -0
  272. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-64.macros +2195 -0
  273. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-SnP.h +49 -0
  274. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-opt64-config.h +8 -0
  275. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-opt64.c +541 -0
  276. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times2-SIMD128.c +954 -0
  277. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times2-SnP.h +47 -0
  278. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times4-SnP.h +45 -0
  279. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times4-on2.c +38 -0
  280. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times8-SnP.h +45 -0
  281. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times8-on2.c +38 -0
  282. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-unrolling.macros +302 -0
  283. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakSpongeWidth1600.link.c +1 -0
  284. data/ext/digest/kangarootwelve/keccak/sandybridge/PlSnP-Fallback.inc +287 -0
  285. data/ext/digest/kangarootwelve/keccak/sandybridge/SIMD128-config.h +8 -0
  286. data/ext/digest/kangarootwelve/keccak/sandybridge/SnP-Relaned.h +140 -0
  287. data/ext/digest/kangarootwelve/keccak/sandybridge/ext.link.c +1 -0
  288. data/ext/digest/kangarootwelve/keccak/skylakex/KangarooTwelve.link.c +1 -0
  289. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakDuplexWidth1600.link.c +1 -0
  290. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-AVX512-config.h +6 -0
  291. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-AVX512.c +621 -0
  292. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-SnP.h +42 -0
  293. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times2-SIMD512.c +852 -0
  294. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times2-SnP.h +49 -0
  295. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times4-SIMD512.c +883 -0
  296. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times4-SnP.h +49 -0
  297. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times8-SIMD512.c +1473 -0
  298. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times8-SnP.h +53 -0
  299. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakSpongeWidth1600.link.c +1 -0
  300. data/ext/digest/kangarootwelve/keccak/skylakex/SIMD512-2-config.h +7 -0
  301. data/ext/digest/kangarootwelve/keccak/skylakex/SIMD512-4-config.h +7 -0
  302. data/ext/digest/kangarootwelve/keccak/skylakex/SIMD512-config.h +7 -0
  303. data/ext/digest/kangarootwelve/keccak/skylakex/ext.link.c +1 -0
  304. data/ext/digest/kangarootwelve/utils.h +101 -0
  305. data/lib/digest/kangarootwelve/version.rb +2 -2
  306. data/test/test.rb +68 -31
  307. metadata +305 -27
@@ -0,0 +1 @@
1
+ #include "../common/KeccakSpongeWidth1600.c"
@@ -0,0 +1,287 @@
1
+ /*
2
+ Implementation by Gilles Van Assche, hereby denoted as "the implementer".
3
+
4
+ For more information, feedback or questions, please refer to our website:
5
+ https://keccak.team/
6
+
7
+ To the extent possible under law, the implementer has waived all copyright
8
+ and related or neighboring rights to the source code in this file.
9
+ http://creativecommons.org/publicdomain/zero/1.0/
10
+
11
+ ---
12
+
13
+ This file contains macros that help make a PlSnP-compatible implementation by
14
+ serially falling back on a SnP-compatible implementation or on a PlSnP-compatible
15
+ implementation of lower parallism degree.
16
+
17
+ Please refer to PlSnP-documentation.h for more details.
18
+ */
19
+
20
+ /* expect PlSnP_baseParallelism, PlSnP_targetParallelism */
21
+ /* expect SnP_stateSizeInBytes, SnP_stateAlignment */
22
+ /* expect prefix */
23
+ /* expect SnP_* */
24
+
25
+ #define JOIN0(a, b) a ## b
26
+ #define JOIN(a, b) JOIN0(a, b)
27
+
28
+ #define PlSnP_StaticInitialize JOIN(prefix, _StaticInitialize)
29
+ #define PlSnP_InitializeAll JOIN(prefix, _InitializeAll)
30
+ #define PlSnP_AddByte JOIN(prefix, _AddByte)
31
+ #define PlSnP_AddBytes JOIN(prefix, _AddBytes)
32
+ #define PlSnP_AddLanesAll JOIN(prefix, _AddLanesAll)
33
+ #define PlSnP_OverwriteBytes JOIN(prefix, _OverwriteBytes)
34
+ #define PlSnP_OverwriteLanesAll JOIN(prefix, _OverwriteLanesAll)
35
+ #define PlSnP_OverwriteWithZeroes JOIN(prefix, _OverwriteWithZeroes)
36
+ #define PlSnP_ExtractBytes JOIN(prefix, _ExtractBytes)
37
+ #define PlSnP_ExtractLanesAll JOIN(prefix, _ExtractLanesAll)
38
+ #define PlSnP_ExtractAndAddBytes JOIN(prefix, _ExtractAndAddBytes)
39
+ #define PlSnP_ExtractAndAddLanesAll JOIN(prefix, _ExtractAndAddLanesAll)
40
+
41
+ #if (PlSnP_baseParallelism == 1)
42
+ #define SnP_stateSizeInBytes JOIN(SnP, _stateSizeInBytes)
43
+ #define SnP_stateAlignment JOIN(SnP, _stateAlignment)
44
+ #else
45
+ #define SnP_stateSizeInBytes JOIN(SnP, _statesSizeInBytes)
46
+ #define SnP_stateAlignment JOIN(SnP, _statesAlignment)
47
+ #endif
48
+ #define PlSnP_factor ((PlSnP_targetParallelism)/(PlSnP_baseParallelism))
49
+ #define SnP_stateOffset (((SnP_stateSizeInBytes+(SnP_stateAlignment-1))/SnP_stateAlignment)*SnP_stateAlignment)
50
+ #define stateWithIndex(i) ((unsigned char *)states+((i)*SnP_stateOffset))
51
+
52
+ #define SnP_StaticInitialize JOIN(SnP, _StaticInitialize)
53
+ #define SnP_Initialize JOIN(SnP, _Initialize)
54
+ #define SnP_InitializeAll JOIN(SnP, _InitializeAll)
55
+ #define SnP_AddByte JOIN(SnP, _AddByte)
56
+ #define SnP_AddBytes JOIN(SnP, _AddBytes)
57
+ #define SnP_AddLanesAll JOIN(SnP, _AddLanesAll)
58
+ #define SnP_OverwriteBytes JOIN(SnP, _OverwriteBytes)
59
+ #define SnP_OverwriteLanesAll JOIN(SnP, _OverwriteLanesAll)
60
+ #define SnP_OverwriteWithZeroes JOIN(SnP, _OverwriteWithZeroes)
61
+ #define SnP_ExtractBytes JOIN(SnP, _ExtractBytes)
62
+ #define SnP_ExtractLanesAll JOIN(SnP, _ExtractLanesAll)
63
+ #define SnP_ExtractAndAddBytes JOIN(SnP, _ExtractAndAddBytes)
64
+ #define SnP_ExtractAndAddLanesAll JOIN(SnP, _ExtractAndAddLanesAll)
65
+
66
+ void PlSnP_StaticInitialize( void )
67
+ {
68
+ SnP_StaticInitialize();
69
+ }
70
+
71
+ void PlSnP_InitializeAll(void *states)
72
+ {
73
+ unsigned int i;
74
+
75
+ for(i=0; i<PlSnP_factor; i++)
76
+ #if (PlSnP_baseParallelism == 1)
77
+ SnP_Initialize(stateWithIndex(i));
78
+ #else
79
+ SnP_InitializeAll(stateWithIndex(i));
80
+ #endif
81
+ }
82
+
83
+ void PlSnP_AddByte(void *states, unsigned int instanceIndex, unsigned char byte, unsigned int offset)
84
+ {
85
+ #if (PlSnP_baseParallelism == 1)
86
+ SnP_AddByte(stateWithIndex(instanceIndex), byte, offset);
87
+ #else
88
+ SnP_AddByte(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, byte, offset);
89
+ #endif
90
+ }
91
+
92
+ void PlSnP_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length)
93
+ {
94
+ #if (PlSnP_baseParallelism == 1)
95
+ SnP_AddBytes(stateWithIndex(instanceIndex), data, offset, length);
96
+ #else
97
+ SnP_AddBytes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, data, offset, length);
98
+ #endif
99
+ }
100
+
101
+ void PlSnP_AddLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
102
+ {
103
+ unsigned int i;
104
+
105
+ for(i=0; i<PlSnP_factor; i++) {
106
+ #if (PlSnP_baseParallelism == 1)
107
+ SnP_AddBytes(stateWithIndex(i), data, 0, laneCount*SnP_laneLengthInBytes);
108
+ #else
109
+ SnP_AddLanesAll(stateWithIndex(i), data, laneCount, laneOffset);
110
+ #endif
111
+ data += PlSnP_baseParallelism*laneOffset*SnP_laneLengthInBytes;
112
+ }
113
+ }
114
+
115
+ void PlSnP_OverwriteBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length)
116
+ {
117
+ #if (PlSnP_baseParallelism == 1)
118
+ SnP_OverwriteBytes(stateWithIndex(instanceIndex), data, offset, length);
119
+ #else
120
+ SnP_OverwriteBytes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, data, offset, length);
121
+ #endif
122
+ }
123
+
124
+ void PlSnP_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
125
+ {
126
+ unsigned int i;
127
+
128
+ for(i=0; i<PlSnP_factor; i++) {
129
+ #if (PlSnP_baseParallelism == 1)
130
+ SnP_OverwriteBytes(stateWithIndex(i), data, 0, laneCount*SnP_laneLengthInBytes);
131
+ #else
132
+ SnP_OverwriteLanesAll(stateWithIndex(i), data, laneCount, laneOffset);
133
+ #endif
134
+ data += PlSnP_baseParallelism*laneOffset*SnP_laneLengthInBytes;
135
+ }
136
+ }
137
+
138
+ void PlSnP_OverwriteWithZeroes(void *states, unsigned int instanceIndex, unsigned int byteCount)
139
+ {
140
+ #if (PlSnP_baseParallelism == 1)
141
+ SnP_OverwriteWithZeroes(stateWithIndex(instanceIndex), byteCount);
142
+ #else
143
+ SnP_OverwriteWithZeroes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, byteCount);
144
+ #endif
145
+ }
146
+
147
+ void PlSnP_PermuteAll(void *states)
148
+ {
149
+ unsigned int i;
150
+
151
+ for(i=0; i<PlSnP_factor; i++) {
152
+ #if (PlSnP_baseParallelism == 1)
153
+ SnP_Permute(stateWithIndex(i));
154
+ #else
155
+ SnP_PermuteAll(stateWithIndex(i));
156
+ #endif
157
+ }
158
+ }
159
+
160
+ #if (defined(SnP_Permute_12rounds) || defined(SnP_PermuteAll_12rounds))
161
+ void PlSnP_PermuteAll_12rounds(void *states)
162
+ {
163
+ unsigned int i;
164
+
165
+ for(i=0; i<PlSnP_factor; i++) {
166
+ #if (PlSnP_baseParallelism == 1)
167
+ SnP_Permute_12rounds(stateWithIndex(i));
168
+ #else
169
+ SnP_PermuteAll_12rounds(stateWithIndex(i));
170
+ #endif
171
+ }
172
+ }
173
+ #endif
174
+
175
+ #if (defined(SnP_Permute_Nrounds) || defined(SnP_PermuteAll_6rounds))
176
+ void PlSnP_PermuteAll_6rounds(void *states)
177
+ {
178
+ unsigned int i;
179
+
180
+ for(i=0; i<PlSnP_factor; i++) {
181
+ #if (PlSnP_baseParallelism == 1)
182
+ SnP_Permute_Nrounds(stateWithIndex(i), 6);
183
+ #else
184
+ SnP_PermuteAll_6rounds(stateWithIndex(i));
185
+ #endif
186
+ }
187
+ }
188
+ #endif
189
+
190
+ #if (defined(SnP_Permute_Nrounds) || defined(SnP_PermuteAll_4rounds))
191
+ void PlSnP_PermuteAll_4rounds(void *states)
192
+ {
193
+ unsigned int i;
194
+
195
+ for(i=0; i<PlSnP_factor; i++) {
196
+ #if (PlSnP_baseParallelism == 1)
197
+ SnP_Permute_Nrounds(stateWithIndex(i), 4);
198
+ #else
199
+ SnP_PermuteAll_4rounds(stateWithIndex(i));
200
+ #endif
201
+ }
202
+ }
203
+ #endif
204
+
205
+ void PlSnP_ExtractBytes(void *states, unsigned int instanceIndex, unsigned char *data, unsigned int offset, unsigned int length)
206
+ {
207
+ #if (PlSnP_baseParallelism == 1)
208
+ SnP_ExtractBytes(stateWithIndex(instanceIndex), data, offset, length);
209
+ #else
210
+ SnP_ExtractBytes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, data, offset, length);
211
+ #endif
212
+ }
213
+
214
+ void PlSnP_ExtractLanesAll(const void *states, unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
215
+ {
216
+ unsigned int i;
217
+
218
+ for(i=0; i<PlSnP_factor; i++) {
219
+ #if (PlSnP_baseParallelism == 1)
220
+ SnP_ExtractBytes(stateWithIndex(i), data, 0, laneCount*SnP_laneLengthInBytes);
221
+ #else
222
+ SnP_ExtractLanesAll(stateWithIndex(i), data, laneCount, laneOffset);
223
+ #endif
224
+ data += laneOffset*SnP_laneLengthInBytes*PlSnP_baseParallelism;
225
+ }
226
+ }
227
+
228
+ void PlSnP_ExtractAndAddBytes(void *states, unsigned int instanceIndex, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
229
+ {
230
+ #if (PlSnP_baseParallelism == 1)
231
+ SnP_ExtractAndAddBytes(stateWithIndex(instanceIndex), input, output, offset, length);
232
+ #else
233
+ SnP_ExtractAndAddBytes(stateWithIndex(instanceIndex/PlSnP_baseParallelism), instanceIndex%PlSnP_baseParallelism, input, output, offset, length);
234
+ #endif
235
+ }
236
+
237
+ void PlSnP_ExtractAndAddLanesAll(const void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset)
238
+ {
239
+ unsigned int i;
240
+
241
+ for(i=0; i<PlSnP_factor; i++) {
242
+ #if (PlSnP_baseParallelism == 1)
243
+ SnP_ExtractAndAddBytes(stateWithIndex(i), input, output, 0, laneCount*SnP_laneLengthInBytes);
244
+ #else
245
+ SnP_ExtractAndAddLanesAll(stateWithIndex(i), input, output, laneCount, laneOffset);
246
+ #endif
247
+ input += laneOffset*SnP_laneLengthInBytes*PlSnP_baseParallelism;
248
+ output += laneOffset*SnP_laneLengthInBytes*PlSnP_baseParallelism;
249
+ }
250
+ }
251
+
252
+ #undef PlSnP_factor
253
+ #undef SnP_stateOffset
254
+ #undef stateWithIndex
255
+ #undef JOIN0
256
+ #undef JOIN
257
+ #undef PlSnP_StaticInitialize
258
+ #undef PlSnP_InitializeAll
259
+ #undef PlSnP_AddByte
260
+ #undef PlSnP_AddBytes
261
+ #undef PlSnP_AddLanesAll
262
+ #undef PlSnP_OverwriteBytes
263
+ #undef PlSnP_OverwriteLanesAll
264
+ #undef PlSnP_OverwriteWithZeroes
265
+ #undef PlSnP_PermuteAll
266
+ #undef PlSnP_ExtractBytes
267
+ #undef PlSnP_ExtractLanesAll
268
+ #undef PlSnP_ExtractAndAddBytes
269
+ #undef PlSnP_ExtractAndAddLanesAll
270
+ #undef SnP_stateAlignment
271
+ #undef SnP_stateSizeInBytes
272
+ #undef PlSnP_factor
273
+ #undef SnP_stateOffset
274
+ #undef stateWithIndex
275
+ #undef SnP_StaticInitialize
276
+ #undef SnP_Initialize
277
+ #undef SnP_InitializeAll
278
+ #undef SnP_AddByte
279
+ #undef SnP_AddBytes
280
+ #undef SnP_AddLanesAll
281
+ #undef SnP_OverwriteBytes
282
+ #undef SnP_OverwriteWithZeroes
283
+ #undef SnP_OverwriteLanesAll
284
+ #undef SnP_ExtractBytes
285
+ #undef SnP_ExtractLanesAll
286
+ #undef SnP_ExtractAndAddBytes
287
+ #undef SnP_ExtractAndAddLanesAll
@@ -0,0 +1,9 @@
1
+ /*
2
+ This file defines some parameters of the implementation in the parent directory.
3
+ */
4
+
5
+ #define KeccakP1600times2_implementation_config "XOP, all rounds unrolled"
6
+ #define KeccakP1600times2_fullUnrolling
7
+ #define KeccakP1600times2_useSSE
8
+ #define KeccakP1600times2_useSSE2
9
+ #define KeccakP1600times2_useXOP
@@ -1,16 +1,22 @@
1
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".
2
+ Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
3
+ Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
4
+ hereby denoted as "the implementer".
5
5
 
6
- For more information, feedback or questions, please refer to our websites:
7
- http://keccak.noekeon.org/
8
- http://keyak.noekeon.org/
9
- http://ketje.noekeon.org/
6
+ For more information, feedback or questions, please refer to our website:
7
+ https://keccak.team/
10
8
 
11
9
  To the extent possible under law, the implementer has waived all copyright
12
10
  and related or neighboring rights to the source code in this file.
13
11
  http://creativecommons.org/publicdomain/zero/1.0/
12
+
13
+ ---
14
+
15
+ This file contains macros that help implement a permutation in a SnP-compatible way.
16
+ It converts an implementation that implement state input/output functions
17
+ in a lane-oriented fashion (i.e., using SnP_AddLanes() and SnP_AddBytesInLane,
18
+ and similarly for Overwite, Extract and ExtractAndAdd) to the byte-oriented SnP.
19
+ Please refer to SnP-documentation.h for more details.
14
20
  */
15
21
 
16
22
  #ifndef _SnP_Relaned_h_
@@ -0,0 +1 @@
1
+ #include "../../ext.c"
@@ -1,12 +1,8 @@
1
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".
2
+ Implementation by Ronny Van Keer, hereby denoted as "the implementer".
5
3
 
6
- For more information, feedback or questions, please refer to our websites:
7
- http://keccak.noekeon.org/
8
- http://keyak.noekeon.org/
9
- http://ketje.noekeon.org/
4
+ For more information, feedback or questions, please refer to our website:
5
+ https://keccak.team/
10
6
 
11
7
  To the extent possible under law, the implementer has waived all copyright
12
8
  and related or neighboring rights to the source code in this file.
@@ -155,7 +151,7 @@ int KangarooTwelve_Update(KangarooTwelve_Instance *ktInstance, const unsigned ch
155
151
  }
156
152
  }
157
153
 
158
- #if defined(KeccakP1600times8_implementation)
154
+ #if defined(KeccakP1600times8_implementation) && !defined(KeccakP1600times8_isFallback)
159
155
  #if defined(KeccakP1600times8_12rounds_FastLoop_supported)
160
156
  ParallelSpongeFastLoop( 8 )
161
157
  #else
@@ -163,7 +159,7 @@ int KangarooTwelve_Update(KangarooTwelve_Instance *ktInstance, const unsigned ch
163
159
  #endif
164
160
  #endif
165
161
 
166
- #if defined(KeccakP1600times4_implementation)
162
+ #if defined(KeccakP1600times4_implementation) && !defined(KeccakP1600times4_isFallback)
167
163
  #if defined(KeccakP1600times4_12rounds_FastLoop_supported)
168
164
  ParallelSpongeFastLoop( 4 )
169
165
  #else
@@ -171,7 +167,7 @@ int KangarooTwelve_Update(KangarooTwelve_Instance *ktInstance, const unsigned ch
171
167
  #endif
172
168
  #endif
173
169
 
174
- #if defined(KeccakP1600times2_implementation)
170
+ #if defined(KeccakP1600times2_implementation) && !defined(KeccakP1600times2_isFallback)
175
171
  #if defined(KeccakP1600times2_12rounds_FastLoop_supported)
176
172
  ParallelSpongeFastLoop( 2 )
177
173
  #else
@@ -1,12 +1,8 @@
1
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".
2
+ Implementation by Ronny Van Keer, hereby denoted as "the implementer".
5
3
 
6
- For more information, feedback or questions, please refer to our websites:
7
- http://keccak.noekeon.org/
8
- http://keyak.noekeon.org/
9
- http://ketje.noekeon.org/
4
+ For more information, feedback or questions, please refer to our website:
5
+ https://keccak.team/
10
6
 
11
7
  To the extent possible under law, the implementer has waived all copyright
12
8
  and related or neighboring rights to the source code in this file.
@@ -0,0 +1,37 @@
1
+ /*
2
+ Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
3
+ Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
4
+ hereby denoted as "the implementer".
5
+
6
+ For more information, feedback or questions, please refer to our website:
7
+ https://keccak.team/
8
+
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
+
14
+ #ifndef _KeccakDuplexCommon_h_
15
+ #define _KeccakDuplexCommon_h_
16
+
17
+ #include "align.h"
18
+
19
+ #define KCP_DeclareDuplexStructure(prefix, size, alignment) \
20
+ ALIGN(alignment) typedef struct prefix##_DuplexInstanceStruct { \
21
+ unsigned char state[size]; \
22
+ unsigned int rate; \
23
+ unsigned int byteInputIndex; \
24
+ unsigned int byteOutputIndex; \
25
+ } prefix##_DuplexInstance;
26
+
27
+ #define KCP_DeclareDuplexFunctions(prefix) \
28
+ int prefix##_DuplexInitialize(prefix##_DuplexInstance *duplexInstance, unsigned int rate, unsigned int capacity); \
29
+ int prefix##_Duplexing(prefix##_DuplexInstance *duplexInstance, const unsigned char *sigmaBegin, unsigned int sigmaBeginByteLen, unsigned char *Z, unsigned int ZByteLen, unsigned char delimitedSigmaEnd); \
30
+ int prefix##_DuplexingFeedPartialInput(prefix##_DuplexInstance *duplexInstance, const unsigned char *input, unsigned int inputByteLen); \
31
+ int prefix##_DuplexingFeedZeroes(prefix##_DuplexInstance *duplexInstance, unsigned int inputByteLen); \
32
+ int prefix##_DuplexingOverwritePartialInput(prefix##_DuplexInstance *duplexInstance, const unsigned char *input, unsigned int inputByteLen); \
33
+ int prefix##_DuplexingOverwriteWithZeroes(prefix##_DuplexInstance *duplexInstance, unsigned int inputByteLen); \
34
+ int prefix##_DuplexingGetFurtherOutput(prefix##_DuplexInstance *duplexInstance, unsigned char *out, unsigned int outByteLen); \
35
+ int prefix##_DuplexingGetFurtherOutputAndAdd(prefix##_DuplexInstance *duplexInstance, const unsigned char *input, unsigned char *output, unsigned int outputByteLen);
36
+
37
+ #endif
@@ -0,0 +1,192 @@
1
+ /*
2
+ Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
3
+ Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
4
+ hereby denoted as "the implementer".
5
+
6
+ For more information, feedback or questions, please refer to our website:
7
+ https://keccak.team/
8
+
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
+
14
+ #define JOIN0(a, b) a ## b
15
+ #define JOIN(a, b) JOIN0(a, b)
16
+
17
+ #define DuplexInstance JOIN(prefix, _DuplexInstance)
18
+ #define DuplexInitialize JOIN(prefix, _DuplexInitialize)
19
+ #define Duplexing JOIN(prefix, _Duplexing)
20
+ #define DuplexingFeedPartialInput JOIN(prefix, _DuplexingFeedPartialInput)
21
+ #define DuplexingFeedZeroes JOIN(prefix, _DuplexingFeedZeroes)
22
+ #define DuplexingOverwritePartialInput JOIN(prefix, _DuplexingOverwritePartialInput)
23
+ #define DuplexingOverwriteWithZeroes JOIN(prefix, _DuplexingOverwriteWithZeroes)
24
+ #define DuplexingGetFurtherOutput JOIN(prefix, _DuplexingGetFurtherOutput)
25
+ #define DuplexingGetFurtherOutputAndAdd JOIN(prefix, _DuplexingGetFurtherOutputAndAdd)
26
+
27
+ #define SnP_stateSizeInBytes JOIN(SnP, _stateSizeInBytes)
28
+ #define SnP_stateAlignment JOIN(SnP, _stateAlignment)
29
+ #define SnP_StaticInitialize JOIN(SnP, _StaticInitialize)
30
+ #define SnP_Initialize JOIN(SnP, _Initialize)
31
+ #define SnP_AddByte JOIN(SnP, _AddByte)
32
+ #define SnP_AddBytes JOIN(SnP, _AddBytes)
33
+ #define SnP_OverwriteBytes JOIN(SnP, _OverwriteBytes)
34
+ #define SnP_OverwriteWithZeroes JOIN(SnP, _OverwriteWithZeroes)
35
+ #define SnP_ExtractBytes JOIN(SnP, _ExtractBytes)
36
+ #define SnP_ExtractAndAddBytes JOIN(SnP, _ExtractAndAddBytes)
37
+
38
+ int DuplexInitialize(DuplexInstance *instance, unsigned int rate, unsigned int capacity)
39
+ {
40
+ if (rate+capacity != SnP_width)
41
+ return 1;
42
+ if ((rate <= 2) || (rate > SnP_width))
43
+ return 1;
44
+ SnP_StaticInitialize();
45
+ instance->rate = rate;
46
+ SnP_Initialize(instance->state);
47
+ instance->byteInputIndex = 0;
48
+ instance->byteOutputIndex = (instance->rate+7)/8;
49
+ return 0;
50
+ }
51
+
52
+ int Duplexing(DuplexInstance *instance, const unsigned char *sigmaBegin, unsigned int sigmaBeginByteLen, unsigned char *Z, unsigned int ZByteLen, unsigned char delimitedSigmaEnd)
53
+ {
54
+ const unsigned int rho_max = instance->rate - 2;
55
+
56
+ if (delimitedSigmaEnd == 0)
57
+ return 1;
58
+ if ((instance->byteInputIndex+sigmaBeginByteLen)*8 > rho_max)
59
+ return 1;
60
+ if (rho_max - sigmaBeginByteLen*8 < 7) {
61
+ unsigned int maxBitsInDelimitedSigmaEnd = rho_max - sigmaBeginByteLen*8;
62
+ if (delimitedSigmaEnd >= (1 << (maxBitsInDelimitedSigmaEnd+1)))
63
+ return 1;
64
+ }
65
+ if (ZByteLen > (instance->rate+7)/8)
66
+ return 1; /* The output length must not be greater than the rate (rounded up to a byte) */
67
+
68
+ SnP_AddBytes(instance->state, sigmaBegin, instance->byteInputIndex, sigmaBeginByteLen);
69
+ #ifdef KeccakReference
70
+ {
71
+ unsigned char block[SnP_width/8];
72
+ memcpy(block, sigmaBegin, sigmaBeginByteLen);
73
+ block[sigmaBeginByteLen] = delimitedSigmaEnd;
74
+ memset(block+sigmaBeginByteLen+1, 0, sizeof(block)-sigmaBeginByteLen-1);
75
+ block[(instance->rate-1)/8] |= 1 << ((instance->rate-1) % 8);
76
+ displayBytes(1, "Block to be absorbed (after padding)", block, (instance->rate+7)/8);
77
+ }
78
+ #endif
79
+
80
+ /* Last few bits, whose delimiter coincides with first bit of padding */
81
+ SnP_AddByte(instance->state, delimitedSigmaEnd, instance->byteInputIndex+sigmaBeginByteLen);
82
+ /* Second bit of padding */
83
+ SnP_AddByte(instance->state, (unsigned char)1 << ((instance->rate - 1)%8), (instance->rate - 1)/8);
84
+ SnP_Permute(instance->state);
85
+ SnP_ExtractBytes(instance->state, Z, 0, ZByteLen);
86
+
87
+ if (ZByteLen*8 > instance->rate) {
88
+ unsigned char mask = (unsigned char)(1 << (instance->rate % 8)) - 1;
89
+ Z[ZByteLen-1] &= mask;
90
+ }
91
+
92
+ instance->byteInputIndex = 0;
93
+ instance->byteOutputIndex = ZByteLen;
94
+
95
+ return 0;
96
+ }
97
+
98
+ int DuplexingFeedPartialInput(DuplexInstance *instance, const unsigned char *input, unsigned int inputByteLen)
99
+ {
100
+ const unsigned int rho_max = instance->rate - 2;
101
+
102
+ if ((instance->byteInputIndex+inputByteLen)*8 > rho_max)
103
+ return 1;
104
+
105
+ SnP_AddBytes(instance->state, input, instance->byteInputIndex, inputByteLen);
106
+ instance->byteInputIndex += inputByteLen;
107
+ return 0;
108
+ }
109
+
110
+ int DuplexingFeedZeroes(DuplexInstance *instance, unsigned int inputByteLen)
111
+ {
112
+ const unsigned int rho_max = instance->rate - 2;
113
+
114
+ if ((instance->byteInputIndex+inputByteLen)*8 > rho_max)
115
+ return 1;
116
+
117
+ instance->byteInputIndex += inputByteLen;
118
+ return 0;
119
+ }
120
+
121
+ int DuplexingOverwritePartialInput(DuplexInstance *instance, const unsigned char *input, unsigned int inputByteLen)
122
+ {
123
+ const unsigned int rho_max = instance->rate - 2;
124
+
125
+ if ((instance->byteInputIndex+inputByteLen)*8 > rho_max)
126
+ return 1;
127
+
128
+ SnP_OverwriteBytes(instance->state, input, instance->byteInputIndex, inputByteLen);
129
+ instance->byteInputIndex += inputByteLen;
130
+ return 0;
131
+ }
132
+
133
+ int DuplexingOverwriteWithZeroes(DuplexInstance *instance, unsigned int inputByteLen)
134
+ {
135
+ const unsigned int rho_max = instance->rate - 2;
136
+
137
+ if ((instance->byteInputIndex != 0) || (inputByteLen*8 > rho_max))
138
+ return 1;
139
+
140
+ SnP_OverwriteWithZeroes(instance->state, inputByteLen);
141
+ instance->byteInputIndex = inputByteLen;
142
+
143
+ return 0;
144
+ }
145
+
146
+ int DuplexingGetFurtherOutput(DuplexInstance *instance, unsigned char *output, unsigned int outputByteLen)
147
+ {
148
+ if ((outputByteLen+instance->byteOutputIndex) > (instance->rate+7)/8)
149
+ return 1; /* The output length must not be greater than the rate (rounded up to a byte) */
150
+
151
+ SnP_ExtractBytes(instance->state, output, instance->byteOutputIndex, outputByteLen);
152
+ instance->byteOutputIndex += outputByteLen;
153
+ if (instance->byteOutputIndex*8 > instance->rate) {
154
+ unsigned char mask = (1 << (instance->rate % 8)) - 1;
155
+ output[outputByteLen-1] &= mask;
156
+ }
157
+ return 0;
158
+ }
159
+
160
+ int DuplexingGetFurtherOutputAndAdd(DuplexInstance *instance, const unsigned char *input, unsigned char *output, unsigned int outputByteLen)
161
+ {
162
+ if ((outputByteLen+instance->byteOutputIndex) > (instance->rate+7)/8)
163
+ return 1; /* The output length must not be greater than the rate (rounded up to a byte) */
164
+
165
+ SnP_ExtractAndAddBytes(instance->state, input, output, instance->byteOutputIndex, outputByteLen);
166
+ instance->byteOutputIndex += outputByteLen;
167
+ if (instance->byteOutputIndex*8 > instance->rate) {
168
+ unsigned char mask = (1 << (instance->rate % 8)) - 1;
169
+ output[outputByteLen-1] &= mask;
170
+ }
171
+ return 0;
172
+ }
173
+
174
+ #undef DuplexInstance
175
+ #undef DuplexInitialize
176
+ #undef Duplexing
177
+ #undef DuplexingFeedPartialInput
178
+ #undef DuplexingFeedZeroes
179
+ #undef DuplexingOverwritePartialInput
180
+ #undef DuplexingOverwriteWithZeroes
181
+ #undef DuplexingGetFurtherOutput
182
+ #undef DuplexingGetFurtherOutputAndAdd
183
+ #undef SnP_stateSizeInBytes
184
+ #undef SnP_stateAlignment
185
+ #undef SnP_StaticInitialize
186
+ #undef SnP_Initialize
187
+ #undef SnP_AddByte
188
+ #undef SnP_AddBytes
189
+ #undef SnP_OverwriteBytes
190
+ #undef SnP_OverwriteWithZeroes
191
+ #undef SnP_ExtractBytes
192
+ #undef SnP_ExtractAndAddBytes