digest-kangarootwelve 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +51 -11
  3. data/Rakefile +2 -2
  4. data/digest-kangarootwelve.gemspec +322 -42
  5. data/ext/digest/kangarootwelve/ext.c +1 -1
  6. data/ext/digest/kangarootwelve/extconf.rb +13 -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/lib/digest/kangarootwelve/version.rb +1 -1
  305. metadata +299 -21
@@ -0,0 +1 @@
1
+ #include "../../ext.c"
@@ -0,0 +1 @@
1
+ #include "../common/KangarooTwelve.c"
@@ -0,0 +1 @@
1
+ #include "../common/KeccakDuplexWidth1600.c"
@@ -0,0 +1,28 @@
1
+ /*
2
+ Implementation by Andre Moraes
3
+
4
+ ---
5
+
6
+ Please refer to SnP-documentation.h for more details.
7
+ */
8
+
9
+ #ifndef _KeccakP_1600_SnP_h_
10
+ #define _KeccakP_1600_SnP_h_
11
+
12
+ #define KeccakP1600_implementation "64-bit optimized ARMv8a assembler implementation"
13
+ #define KeccakP1600_stateSizeInBytes 200
14
+ #define KeccakP1600_stateAlignment 64
15
+
16
+ #define KeccakP1600_StaticInitialize()
17
+ void KeccakP1600_Initialize(void *state);
18
+ void KeccakP1600_AddByte(void *state, unsigned char data, unsigned int offset);
19
+ void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
20
+ void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
21
+ void KeccakP1600_OverwriteWithZeroes(void *state, unsigned int byteCount);
22
+ void KeccakP1600_Permute_Nrounds(void *state, unsigned int nrounds);
23
+ void KeccakP1600_Permute_12rounds(void *state);
24
+ void KeccakP1600_Permute_24rounds(void *state);
25
+ void KeccakP1600_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length);
26
+ void KeccakP1600_ExtractAndAddBytes(const void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
27
+
28
+ #endif
@@ -0,0 +1,537 @@
1
+ // Implementation by Andre Moraes
2
+ //
3
+ // This file implements Keccak-p[1600] in a SnP-compatible way.
4
+ // Please refer to SnP-documentation.h for more details.
5
+ //
6
+ // This implementation comes with KeccakP-1600-SnP.h in the same folder.
7
+ // Please refer to LowLevel.build for the exact list of other files it must be combined with.
8
+
9
+ // INFO: Tested on Cortex-A53(odroid-c2), using gcc.
10
+ // WARNING: These functions work only on little endian CPU with ARMv8a + NEON architecture
11
+ // WARNING: State must be 512 bit (64 bytes) aligned.
12
+ // WARNING: Don't use V8-V15 or X19-X28 since we aren't saving them
13
+
14
+ // Note that byte order, same as the Keyakv2 Convection:
15
+ // v19 = A[0] || A[4]
16
+ // v19.2d[0] = A[0]
17
+ // v19.2d[1] = A[4]
18
+
19
+ // Register-Lane Lookup
20
+ // v19 = A[0] || A[4]
21
+ // v20 = A[1] || A[5]
22
+ // v21 = A[2] || A[6]
23
+ // v22 = A[3] || A[7]
24
+
25
+ // v23 = A[8] || A[12]
26
+ // v24 = A[9] || A[13]
27
+ // v25 = A[10] || A[14]
28
+ // v26 = A[11] || A[15]
29
+
30
+ // v27 = A[16] || A[20]
31
+ // v28 = A[17] || A[21]
32
+ // v29 = A[18] || A[22]
33
+ // v30 = A[19] || A[23]
34
+
35
+ // v31 = A[24] || ?????
36
+
37
+ // Transpose
38
+ // trn1 v0.2d, v19.2d, v20.2d
39
+ // trn2 v2.2d, v19.2d, v20.2d
40
+ // v0 = A[0] || A[1]
41
+ // v1 = A[4] || A[5]
42
+
43
+ // Extract
44
+ // ext v0.16b, v19.16b, v20.16b, #8
45
+ // v0 = A[4] || A[1]
46
+
47
+ .macro LoadState
48
+ ld4 { v19.2d, v20.2d, v21.2d, v22.2d }, [x0], #64
49
+ ld4 { v23.2d, v24.2d, v25.2d, v26.2d }, [x0], #64
50
+ ld4 { v27.2d, v28.2d, v29.2d, v30.2d }, [x0], #64
51
+ ld1 { v31.d }[0], [x0], #8
52
+ sub x0, x0, #200
53
+ movi v16.2d, #0
54
+ .endm
55
+
56
+ .macro StoreState
57
+ st4 { v19.2d, v20.2d, v21.2d, v22.2d }, [x0], #64
58
+ st4 { v23.2d, v24.2d, v25.2d, v26.2d }, [x0], #64
59
+ st4 { v27.2d, v28.2d, v29.2d, v30.2d }, [x0], #64
60
+ st1 { v31.d }[0], [x0], #8
61
+ .endm
62
+
63
+ .macro RhoPi dst, src, sav, rot
64
+ ror \src, \src, #64-\rot
65
+ mov \sav, \dst
66
+ mov \dst, \src
67
+ .endm
68
+
69
+ // NEON has no BIT-wise vector rotate operation
70
+ .macro ROTL64 dst, src, rot
71
+ .if (\rot & 7) != 0 // Bit-wise rotation
72
+ shl \dst\().2d, \src\().2d, #\rot
73
+ sri \dst\().2d, \src\().2d, #64-\rot
74
+ .else // Byte-wise rotation, we can use EXT
75
+ ext \dst\().16b, \src\().16b, \src\().16b, #\rot/8
76
+ .endif
77
+ .endm
78
+
79
+ .macro KeccakRound
80
+ // Theta - Build new lanes
81
+ eor v0.16b, v19.16b, v25.16b // v0 = (A[0] ^ A[10]) || (A[4] ^ A[14])
82
+ eor v1.16b, v20.16b, v26.16b // v1 = (A[1] ^ A[11]) || (A[5] ^ A[15])
83
+ eor v2.16b, v21.16b, v28.16b // v2 = (A[2] ^ A[17]) || (A[6] ^ A[21])
84
+ eor v3.16b, v22.16b, v23.16b // v3 = (A[3] ^ A[8]) || (A[7] ^ A[12])
85
+ eor v4.16b, v24.16b, v30.16b // v4 = (A[9] ^ A[19]) || (A[13] ^ A[23])
86
+
87
+ eor v1.16b, v1.16b, v27.16b // v1 = (A[1] ^ A[11] ^ A[16]) || (A[5] ^ A[15] ^ A[20])
88
+ eor v3.16b, v3.16b, v29.16b // v3 = (A[3] ^ A[8] ^ A[18]) || (A[7] ^ A[12] ^ A[22])
89
+
90
+ trn1 v5.2d, v0.2d, v1.2d // v5 = (A[0] ^ A[10]) || (A[1] ^ A[11] ^ A[16])
91
+ trn2 v6.2d, v1.2d, v2.2d // v6 = (A[5] ^ A[15] ^ A[20]) || (A[6] ^ A[21])
92
+ eor v1.16b, v5.16b, v6.16b // v1 = B[0] || B[1]
93
+
94
+ ext v5.16b, v4.16b, v2.16b, #8 // v5 = (A[13] ^ A[23]) || (A[2] ^ A[17])
95
+ eor v3.16b, v3.16b, v5.16b // v3 = B[3] || B[2]
96
+
97
+ mov v5.2d[0], v0.2d[1] // v5 = (A[4] ^ A[14]) || ????
98
+ eor v4.16b, v4.16b, v5.16b // v4 = (A[9] ^ A[19] ^ A[4] ^ A[14]) || ????
99
+ eor v4.16b, v4.16b, v31.16b // v4 = B[4] || ????
100
+
101
+ ext v2.16b, v1.16b, v1.16b, #8 // v2 = B[1] || B[0]
102
+ mov v4.2d[1], v3.2d[0] // v4 = B[4] || B[3]
103
+ trn2 v0.2d, v3.2d, v1.2d // v0 = B[2] || B[1]
104
+
105
+ ROTL64 v5, v2, 1 // v5 = ROTL64(B[1], 1) || ROTL64(B[0], 1)
106
+ ROTL64 v6, v3, 1 // v6 = ROTL64(B[3], 1) || ROTL64(B[2], 1)
107
+ ROTL64 v7, v4, 1 // v7 = ROTL64(B[4], 1) || ROTL64(B[3], 1)
108
+
109
+ eor v18.16b, v4.16b, v5.16b // v18 = B[4] ^ ROTL64(B[1], 1) || B[3] ^ ROTL64(B[0], 1)
110
+ eor v2.16b, v2.16b, v6.16b // v2 = B[1] ^ ROTL64(B[3], 1) || B[0] ^ ROTL64(B[2], 1)
111
+ eor v0.16b, v0.16b, v7.16b // v0 = B[2] ^ ROTL64(B[4], 1) || B[1] ^ ROTL64(B[3], 1)
112
+
113
+ ext v7.16b, v5.16b, v7.16b, #8 // v7 = ROTL64(B[0], 1) || ROTL64(B[4], 1)
114
+ eor v7.16b, v3.16b, v7.16b // v7 = B[3] ^ ROTL64(B[0], 1) || B[2] ^ ROTL64(B[4], 1)
115
+
116
+ ext v6.16b, v6.16b, v5.16b, #8 // v6 = ROTL64(B[2], 1) || ROTL64(B[1], 1)
117
+ trn1 v4.2d, v1.2d, v4.2d // v4 = B[0] || B[4]
118
+ eor v6.16b, v4.16b, v6.16b // v6 = B[0] ^ ROTL64(B[2], 1) || B[4] ^ ROTL64(B[1], 1)
119
+
120
+ // Theta - Apply lanes
121
+ eor v19.16b, v19.16b, v18.16b // A[0] ^= B[4] ^ ROTL64(B[1], 1), A[4] ^= B[3] ^ ROTL64(B[0], 1)
122
+ eor v20.16b, v20.16b, v6.16b // A[1] ^= B[0] ^ ROTL64(B[2], 1), A[5] ^= B[4] ^ ROTL64(B[1], 1)
123
+ eor v21.16b, v21.16b, v2.16b // A[2] ^= B[1] ^ ROTL64(B[3], 1), A[6] ^= B[0] ^ ROTL64(B[2], 1)
124
+ eor v22.16b, v22.16b, v0.16b // A[3] ^= B[2] ^ ROTL64(B[4], 1), A[7] ^= B[1] ^ ROTL64(B[3], 1)
125
+ eor v23.16b, v23.16b, v0.16b // A[8] ^= B[2] ^ ROTL64(B[4], 1), A[12] ^= B[1] ^ ROTL64(B[3], 1)
126
+ eor v24.16b, v24.16b, v7.16b // A[9] ^= B[3] ^ ROTL64(B[0], 1), A[13] ^= B[2] ^ ROTL64(B[4], 1)
127
+ eor v25.16b, v25.16b, v18.16b // A[10] ^= B[4] ^ ROTL64(B[1], 1), A[14] ^= B[3] ^ ROTL64(B[0], 1)
128
+ eor v26.16b, v26.16b, v6.16b // A[11] ^= B[0] ^ ROTL64(B[2], 1), A[15] ^= B[4] ^ ROTL64(B[1], 1)
129
+ eor v27.16b, v27.16b, v6.16b // A[16] ^= B[0] ^ ROTL64(B[2], 1), A[20] ^= B[4] ^ ROTL64(B[1], 1)
130
+ eor v28.16b, v28.16b, v2.16b // A[17] ^= B[1] ^ ROTL64(B[3], 1), A[21] ^= B[0] ^ ROTL64(B[2], 1)
131
+ eor v29.16b, v29.16b, v0.16b // A[18] ^= B[2] ^ ROTL64(B[4], 1), A[22] ^= B[1] ^ ROTL64(B[3], 1)
132
+ eor v30.16b, v30.16b, v7.16b // A[19] ^= B[3] ^ ROTL64(B[0], 1), A[23] ^= B[2] ^ ROTL64(B[4], 1)
133
+ eor v31.16b, v31.16b, v7.16b // A[24] ^= B[3] ^ ROTL64(B[0], 1), ????
134
+
135
+ // Rho Pi
136
+ mov x11, v20.2d[0] // x11 = A[1]
137
+
138
+ RhoPi v25.2d[0], x11, x10, 1 // A[10] = ROTL64(A[1], 1)
139
+ RhoPi v22.2d[1], x10, x11, 3 // A[7] = ROTL64(A[10], 3)
140
+ RhoPi v26.2d[0], x11, x10, 6 // A[11] = ROTL64(A[7], 6)
141
+ RhoPi v28.2d[0], x10, x11, 10 // A[17] = ROTL64(A[11], 10)
142
+ RhoPi v29.2d[0], x11, x10, 15 // A[18] = ROTL64(A[17], 15)
143
+ RhoPi v22.2d[0], x10, x11, 21 // A[3] = ROTL64(A[18], 21)
144
+ RhoPi v20.2d[1], x11, x10, 28 // A[5] = ROTL64(A[3], 28)
145
+ RhoPi v27.2d[0], x10, x11, 36 // A[16] = ROTL64(A[5], 36)
146
+ RhoPi v23.2d[0], x11, x10, 45 // A[8] = ROTL64(A[16], 45)
147
+ RhoPi v28.2d[1], x10, x11, 55 // A[21] = ROTL64(A[8], 55)
148
+ RhoPi v31.2d[0], x11, x10, 2 // A[24] = ROTL64(A[21], 2)
149
+ RhoPi v19.2d[1], x10, x11, 14 // A[4] = ROTL64(A[24], 14)
150
+ RhoPi v26.2d[1], x11, x10, 27 // A[15] = ROTL64(A[4], 27)
151
+ RhoPi v30.2d[1], x10, x11, 41 // A[23] = ROTL64(A[15], 41)
152
+ RhoPi v30.2d[0], x11, x10, 56 // A[19] = ROTL64(A[23], 56)
153
+ RhoPi v24.2d[1], x10, x11, 8 // A[13] = ROTL64(A[19], 8)
154
+ RhoPi v23.2d[1], x11, x10, 25 // A[12] = ROTL64(A[13], 25)
155
+ RhoPi v21.2d[0], x10, x11, 43 // A[2] = ROTL64(A[12], 43)
156
+ RhoPi v27.2d[1], x11, x10, 62 // A[20] = ROTL64(A[2], 62)
157
+ RhoPi v25.2d[1], x10, x11, 18 // A[14] = ROTL64(A[20], 18)
158
+ RhoPi v29.2d[1], x11, x10, 39 // A[22] = ROTL64(A[14], 39)
159
+ RhoPi v24.2d[0], x10, x11, 61 // A[9] = ROTL64(A[22], 61)
160
+ RhoPi v21.2d[1], x11, x10, 20 // A[6] = ROTL64(A[9], 20)
161
+
162
+ ror x10, x10, #20
163
+ mov v20.2d[0], x10 // A[1] = ROTL64(A[6], 44)
164
+
165
+ // Chi - Some lanes are applied earlier so we can reuse registers
166
+ ext v18.16b, v26.16b, v31.16b, #8 // v18 = A[15] || A[24]
167
+ bic v6.16b, v27.16b, v18.16b // v6 = ~A[15] & A[16] || ~A[24] & A[20]
168
+
169
+ ext v17.16b, v26.16b, v31.16b, #8 // v17 = A[15] || A[24]
170
+ bic v5.16b, v17.16b, v30.16b // v5 = ~A[19] & A[15] || ~A[23] & A[24]
171
+
172
+ bic v3.16b, v30.16b, v29.16b // v3 = ~A[18] & A[19] || ~A[22] & A[23]
173
+
174
+ eor v30.16b, v30.16b, v6.16b // A[19] ^= ~A[15] & A[16], A[23] ^= ~A[24] & A[20]
175
+
176
+ trn1 v18.2d, v26.2d, v25.2d // v18 = A[11] || A[10]
177
+ ext v17.16b, v23.16b, v26.16b, #8 // v17 = A[12] || A[11]
178
+ bic v7.16b, v17.16b, v18.16b // v7 = ~A[11] & A[12] || ~A[10] & A[11]
179
+
180
+ trn2 v18.2d, v20.2d, v25.2d // v18 = A[5] || A[14]
181
+ ext v17.16b, v21.16b, v25.16b, #8 // v17 = A[6] || A[10]
182
+ bic v6.16b, v17.16b, v18.16b // v6 = ~A[5] & A[6] || ~A[14] & A[10]
183
+
184
+ trn1 v18.2d, v20.2d, v19.2d // v18 = A[1] || A[0]
185
+ trn1 v17.2d, v21.2d, v20.2d // v17 = A[2] || A[1]
186
+ bic v1.16b, v17.16b, v18.16b // v1 = ~A[1] & A[2] || ~A[0] & A[1]
187
+
188
+ ext v18.16b, v19.16b, v23.16b, #8 // v18 = A[4] || A[8]
189
+ trn1 v17.2d, v19.2d, v24.2d // v17 = A[0] || A[9]
190
+ bic v0.16b, v17.16b, v18.16b // v0 = ~A[4] & A[0] || ~A[8] & A[9]
191
+
192
+ ext v18.16b, v23.16b, v27.16b, #8 // v18 = A[12] || A[16]
193
+ ext v17.16b, v24.16b, v28.16b, #8 // v17 = A[13] || A[17]
194
+ bic v4.16b, v17.16b, v18.16b // v4 = ~A[12] & A[13] || ~A[16] & A[17]
195
+
196
+ mov v18.2d[0], v27.2d[1] // v18 = A[20] || ????
197
+ mov v17.2d[0], v28.2d[1] // v17 = A[21] || ????
198
+ bic v2.16b, v17.16b, v18.16b // v2 = ~A[20] & A[21] || ????
199
+ eor v31.16b, v31.16b, v2.16b // A[24] ^= ~A[20] & A[21], ????
200
+
201
+ bic v2.16b, v29.16b, v28.16b // v2 = ~A[17] & A[18] || ~A[21] & A[22]
202
+ eor v27.16b, v27.16b, v2.16b // A[16] ^= ~A[17] & A[18], A[20] ^= ~A[21] & A[22]
203
+
204
+ bic v2.16b, v22.16b, v21.16b // v2 = ~A[2] & A[3] || ~A[6] & A[7]
205
+
206
+ eor v28.16b, v28.16b, v3.16b // A[17] ^= ~A[18] & A[19], A[21] ^= ~A[22] & A[23]
207
+ eor v29.16b, v29.16b, v5.16b // A[18] ^= ~A[19] & A[15], A[22] ^= ~A[23] & A[24]
208
+
209
+ ext v17.16b, v19.16b, v23.16b, #8 // v17 = A[4] || A[8]
210
+ bic v3.16b, v17.16b, v22.16b // v3 = ~A[3] & A[4] || ~A[7] & A[8]
211
+
212
+ trn2 v17.2d, v20.2d, v25.2d // v17 = A[5] || A[14]
213
+ bic v5.16b, v17.16b, v24.16b // v5 = ~A[9] & A[5] || ~A[13] & A[14]
214
+
215
+ // Chi - Apply remaining lanes
216
+ eor v19.16b, v19.16b, v1.16b // A[0] ^= ~A[1] & A[2], A[4] ^= ~A[0] & A[1]
217
+ eor v20.16b, v20.16b, v2.16b // A[1] ^= ~A[2] & A[3], A[5] ^= ~A[6] & A[7]
218
+ eor v21.16b, v21.16b, v3.16b // A[2] ^= ~A[3] & A[4], A[6] ^= ~A[7] & A[8]
219
+ eor v22.16b, v22.16b, v0.16b // A[3] ^= ~A[4] & A[0], A[7] ^= ~A[8] & A[9]
220
+ eor v23.16b, v23.16b, v5.16b // A[8] ^= ~A[9] & A[5], A[12] ^= ~A[13] & A[14]
221
+ eor v24.16b, v24.16b, v6.16b // A[9] ^= ~A[5] & A[6], A[13] ^= ~A[14] & A[10]
222
+ eor v25.16b, v25.16b, v7.16b // A[10] ^= ~A[11] & A[12], A[14] ^= ~A[10] & A[11]
223
+ eor v26.16b, v26.16b, v4.16b // A[11] ^= ~A[12] & A[13], A[15] ^= ~A[16] & A[17]
224
+
225
+ // Iota
226
+ ld1 { v16.d }[0], [x1], #8
227
+ eor v19.16b, v19.16b, v16.16b
228
+ .endm
229
+
230
+ .align 8
231
+ KeccakP1600_Permute_RoundConstants24:
232
+ .quad 0x0000000000000001
233
+ .quad 0x0000000000008082
234
+ .quad 0x800000000000808a
235
+ .quad 0x8000000080008000
236
+ .quad 0x000000000000808b
237
+ .quad 0x0000000080000001
238
+ .quad 0x8000000080008081
239
+ .quad 0x8000000000008009
240
+ .quad 0x000000000000008a
241
+ .quad 0x0000000000000088
242
+ .quad 0x0000000080008009
243
+ .quad 0x000000008000000a
244
+ KeccakP1600_Permute_RoundConstants12:
245
+ .quad 0x000000008000808b
246
+ .quad 0x800000000000008b
247
+ .quad 0x8000000000008089
248
+ .quad 0x8000000000008003
249
+ .quad 0x8000000000008002
250
+ .quad 0x8000000000000080
251
+ .quad 0x000000000000800a
252
+ .quad 0x800000008000000a
253
+ .quad 0x8000000080008081
254
+ .quad 0x8000000000008080
255
+ .quad 0x0000000080000001
256
+ .quad 0x8000000080008008
257
+ KeccakP1600_Permute_RoundConstants0:
258
+
259
+ //----------------------------------------------------------------------------
260
+ //
261
+ // void KeccakP1600_Initialize(void *state)
262
+ //
263
+ .align 8
264
+ .global KeccakP1600_Initialize
265
+ KeccakP1600_Initialize:
266
+ movi v0.2d, #0
267
+ movi v1.2d, #0
268
+ movi v2.2d, #0
269
+ movi v3.2d, #0
270
+ st4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0], #64 // Clear 8lanes=64 bytes at a time
271
+ st4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0], #64
272
+ st4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0], #64
273
+ st1 { v0.d }[0], [x0], #8
274
+ ret
275
+
276
+
277
+ // ----------------------------------------------------------------------------
278
+ //
279
+ // void KeccakP1600_AddByte(void *state, unsigned char byte, unsigned int offset)
280
+ //
281
+ .align 8
282
+ .global KeccakP1600_AddByte
283
+ KeccakP1600_AddByte:
284
+ ldrb w3, [x0, x2]
285
+ eor w3, w3, w1
286
+ strb w3, [x0, x2]
287
+ ret
288
+
289
+
290
+ // ----------------------------------------------------------------------------
291
+ //
292
+ // void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
293
+ //
294
+ .align 8
295
+ .global KeccakP1600_AddBytes
296
+ KeccakP1600_AddBytes:
297
+ add x0, x0, x2
298
+ subs w4, w3, #1
299
+ b.cc KeccakP1600_AddBytes_Exit // length 0, move along
300
+ KeccakP1600_AddBytes_8LanesLoop: // Go 8 lanes=64 bytes at a time
301
+ subs w3, w3, #64
302
+ b.cc KeccakP1600_AddBytes_Lanes // Jump if length is negative
303
+ ld4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0]
304
+ ld4 { v4.2d, v5.2d, v6.2d, v7.2d }, [x1], #64
305
+ eor v0.16b, v0.16b, v4.16b
306
+ eor v1.16b, v1.16b, v5.16b
307
+ eor v2.16b, v2.16b, v6.16b
308
+ eor v3.16b, v3.16b, v7.16b
309
+ st4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0], #64
310
+ b KeccakP1600_AddBytes_8LanesLoop
311
+ KeccakP1600_AddBytes_Lanes: // If length ever becomes negative, we have to fix it
312
+ add w3, w3, #64
313
+ KeccakP1600_AddBytes_LanesLoop: // Same thing but go 1 lanes=8 bytes at a time
314
+ subs w3, w3, #8
315
+ b.cc KeccakP1600_AddBytes_Bytes
316
+ ld1 { v0.d }[0], [x0]
317
+ ld1 { v4.d }[0], [x1], #8
318
+ eor v0.8b, v0.8b, v4.8b
319
+ st1 { v0.d }[0], [x0], #8
320
+ b KeccakP1600_AddBytes_LanesLoop
321
+ KeccakP1600_AddBytes_Bytes:
322
+ add w3, w3, #8
323
+ KeccakP1600_AddBytes_BytesLoop: // Same thing but go 1 byte at a time
324
+ subs w3, w3, #1
325
+ b.cc KeccakP1600_AddBytes_Exit
326
+ ldrb w4, [x0]
327
+ ldrb w5, [x1], #1
328
+ eor w4, w4, w5
329
+ strb w4, [x0], #1
330
+ b KeccakP1600_AddBytes_BytesLoop
331
+ KeccakP1600_AddBytes_Exit:
332
+ ret
333
+
334
+ // ----------------------------------------------------------------------------
335
+ //
336
+ // void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
337
+ //
338
+ .align 8
339
+ .global KeccakP1600_OverwriteBytes
340
+ KeccakP1600_OverwriteBytes:
341
+ add x0, x0, x2
342
+ subs w4, w3, #1
343
+ b.cc KeccakP1600_OverwriteBytes_Exit
344
+ KeccakP1600_OverwriteBytes_8LanesLoop:
345
+ subs w3, w3, #64
346
+ b.cc KeccakP1600_OverwriteBytes_Lanes
347
+ ld4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x1], #64
348
+ st4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0], #64
349
+ b KeccakP1600_OverwriteBytes_8LanesLoop
350
+ KeccakP1600_OverwriteBytes_Lanes:
351
+ add w3, w3, #64
352
+ KeccakP1600_OverwriteBytes_LanesLoop:
353
+ subs w3, w3, #8
354
+ b.cc KeccakP1600_OverwriteBytes_Bytes
355
+ ld1 { v0.d }[0], [x1], #8
356
+ st1 { v0.d }[0], [x0], #8
357
+ b KeccakP1600_OverwriteBytes_LanesLoop
358
+ KeccakP1600_OverwriteBytes_Bytes:
359
+ add w3, w3, #8
360
+ KeccakP1600_OverwriteBytes_BytesLoop:
361
+ subs w3, w3, #1
362
+ b.cc KeccakP1600_OverwriteBytes_Exit
363
+ ldrb w4, [x1], #1
364
+ strb w4, [x0], #1
365
+ b KeccakP1600_OverwriteBytes_BytesLoop
366
+ KeccakP1600_OverwriteBytes_Exit:
367
+ ret
368
+
369
+
370
+ //----------------------------------------------------------------------------
371
+ //
372
+ // void KeccakP1600_OverwriteWithZeroes(void *state, unsigned int byteCount)
373
+ //
374
+ .align 8
375
+ .global KeccakP1600_OverwriteWithZeroes
376
+ KeccakP1600_OverwriteWithZeroes:
377
+ subs w2, w1, #1
378
+ b.cc KeccakP1600_OverwriteWithZeroes_Exit
379
+ movi v0.2d, #0
380
+ movi v1.2d, #0
381
+ movi v2.2d, #0
382
+ movi v3.2d, #0
383
+ mov w2, #0
384
+ KeccakP1600_OverwriteWithZeroes_8LanesLoop:
385
+ subs w1, w1, #64
386
+ b.cc KeccakP1600_OverwriteWithZeroes_Lanes
387
+ st4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0], #64
388
+ b KeccakP1600_OverwriteWithZeroes_8LanesLoop
389
+ KeccakP1600_OverwriteWithZeroes_Lanes:
390
+ add w1, w1, #64
391
+ KeccakP1600_OverwriteWithZeroes_LanesLoop:
392
+ subs w1, w1, #8
393
+ b.cc KeccakP1600_OverwriteWithZeroes_Bytes
394
+ st1 { v0.d }[0], [x0], #8
395
+ b KeccakP1600_OverwriteWithZeroes_LanesLoop
396
+ KeccakP1600_OverwriteWithZeroes_Bytes:
397
+ add w1, w1, #8
398
+ KeccakP1600_OverwriteWithZeroes_LoopBytes:
399
+ subs w1, w1, #1
400
+ b.cc KeccakP1600_OverwriteWithZeroes_Exit
401
+ strb w2, [x0], #1
402
+ b KeccakP1600_OverwriteWithZeroes_LoopBytes
403
+ KeccakP1600_OverwriteWithZeroes_Exit:
404
+ ret
405
+
406
+
407
+ // ----------------------------------------------------------------------------
408
+ //
409
+ // void KeccakP1600_ExtractBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
410
+ //
411
+ .align 8
412
+ .global KeccakP1600_ExtractBytes
413
+ KeccakP1600_ExtractBytes:
414
+ add x0, x0, x2
415
+ subs w4, w3, #1
416
+ b.cc KeccakP1600_ExtractBytes_Exit
417
+ KeccakP1600_ExtractBytes_8LanesLoop:
418
+ subs w3, w3, #64
419
+ b.cc KeccakP1600_ExtractBytes_Lanes
420
+ ld4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0], #64
421
+ st4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x1], #64
422
+ b KeccakP1600_ExtractBytes_8LanesLoop
423
+ KeccakP1600_ExtractBytes_Lanes:
424
+ add w3, w3, #64
425
+ KeccakP1600_ExtractBytes_LanesLoop:
426
+ subs w3, w3, #8
427
+ b.cc KeccakP1600_ExtractBytes_Bytes
428
+ ld1 { v0.d }[0], [x0], #8
429
+ st1 { v0.d }[0], [x1], #8
430
+ b KeccakP1600_ExtractBytes_LanesLoop
431
+ KeccakP1600_ExtractBytes_Bytes:
432
+ add w3, w3, #8
433
+ KeccakP1600_ExtractBytes_BytesLoop:
434
+ subs w3, w3, #1
435
+ b.cc KeccakP1600_ExtractBytes_Exit
436
+ ldrb w4, [x0], #1
437
+ strb w4, [x1], #1
438
+ b KeccakP1600_ExtractBytes_BytesLoop
439
+ KeccakP1600_ExtractBytes_Exit:
440
+ ret
441
+
442
+
443
+ // ----------------------------------------------------------------------------
444
+ //
445
+ // void KeccakP800_ExtractAndAddBytes(void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
446
+ //
447
+ .align 8
448
+ .global KeccakP1600_ExtractAndAddBytes
449
+ KeccakP1600_ExtractAndAddBytes:
450
+ add x0, x0, x3
451
+ subs w5, w4, #1
452
+ b.cc KeccakP1600_ExtractAndAddBytes_Exit
453
+ KeccakP1600_ExtractAndAddBytes_8LanesLoop:
454
+ subs w4, w4, #64
455
+ b.cc KeccakP1600_ExtractAndAddBytes_Lanes
456
+ ld4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0], #64
457
+ ld4 { v4.2d, v5.2d, v6.2d, v7.2d }, [x1], #64
458
+ eor v0.16b, v0.16b, v4.16b
459
+ eor v1.16b, v1.16b, v5.16b
460
+ eor v2.16b, v2.16b, v6.16b
461
+ eor v3.16b, v3.16b, v7.16b
462
+ st4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x2], #64
463
+ b KeccakP1600_ExtractAndAddBytes_8LanesLoop
464
+ KeccakP1600_ExtractAndAddBytes_Lanes:
465
+ add w4, w4, #64
466
+ KeccakP1600_ExtractAndAddBytes_LanesLoop:
467
+ subs w4, w4, #8
468
+ b.cc KeccakP1600_ExtractAndAddBytes_Bytes
469
+ ld1 { v0.d }[0], [x0], #8
470
+ ld1 { v4.d }[0], [x1], #8
471
+ eor v0.8b, v0.8b, v4.8b
472
+ st1 { v0.d }[0], [x2], #8
473
+ b KeccakP1600_ExtractAndAddBytes_LanesLoop
474
+ KeccakP1600_ExtractAndAddBytes_Bytes:
475
+ add w4, w4, #8
476
+ KeccakP1600_ExtractAndAddBytes_BytesLoop:
477
+ subs w4, w4, #1
478
+ b.cc KeccakP1600_ExtractAndAddBytes_Exit
479
+ ldrb w5, [x0], #1
480
+ ldrb w6, [x1], #1
481
+ eor w5, w5, w6
482
+ strb w5, [x2], #1
483
+ b KeccakP1600_ExtractAndAddBytes_BytesLoop
484
+ KeccakP1600_ExtractAndAddBytes_Exit:
485
+ ret
486
+
487
+ // ----------------------------------------------------------------------------
488
+ //
489
+ // void KeccakP1600_Permute_Nrounds( void *state, unsigned int nrounds )
490
+ //
491
+ .align 8
492
+ .global KeccakP1600_Permute_Nrounds
493
+ KeccakP1600_Permute_Nrounds:
494
+ mov x2, x1
495
+ adr x1, KeccakP1600_Permute_RoundConstants0
496
+ lsl x3, x2, #3
497
+ sub x1, x1, x3
498
+ b KeccakP1600_Permute
499
+
500
+ // ----------------------------------------------------------------------------
501
+ //
502
+ // void KeccakP1600_Permute_12rounds( void *state )
503
+ //
504
+ .align 8
505
+ .global KeccakP1600_Permute_12rounds
506
+ KeccakP1600_Permute_12rounds:
507
+ adr x1, KeccakP1600_Permute_RoundConstants12
508
+ mov x2, #12
509
+ b KeccakP1600_Permute
510
+
511
+
512
+ // ----------------------------------------------------------------------------
513
+ //
514
+ // void KeccakP1600_Permute_24rounds( void *state )
515
+ //
516
+ .align 8
517
+ .global KeccakP1600_Permute_24rounds
518
+ KeccakP1600_Permute_24rounds:
519
+ adr x1, KeccakP1600_Permute_RoundConstants24
520
+ mov x2, #24
521
+ b KeccakP1600_Permute
522
+
523
+ //----------------------------------------------------------------------------
524
+ //
525
+ // void KeccakP1600_Permute( void *state, uint64_t *rc, unsigned int nrounds )
526
+ //
527
+ .align 8
528
+ .global KeccakP1600_Permute
529
+ KeccakP1600_Permute:
530
+ LoadState
531
+ KeccakP1600_Permute_RoundLoop:
532
+ KeccakRound
533
+ subs w2, w2, #1
534
+ bne KeccakP1600_Permute_RoundLoop
535
+ KeccakP1600_Permute_Exit:
536
+ StoreState
537
+ ret