sleeping_kangaroo12 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -67
  3. data/ext/Rakefile +12 -37
  4. data/ext/binding/sleeping_kangaroo12.c +1 -16
  5. data/ext/{xkcp → k12}/Makefile +0 -0
  6. data/ext/k12/Makefile.build +118 -0
  7. data/ext/k12/README.markdown +86 -0
  8. data/ext/k12/lib/ARMv8Asha3/KeccakP-1600-ARMv8Asha3.S +623 -0
  9. data/ext/k12/lib/ARMv8Asha3/KeccakP-1600-SnP.h +65 -0
  10. data/ext/k12/lib/ARMv8Asha3/KeccakP-1600-opt64.c +227 -0
  11. data/ext/{xkcp/lib/low/KeccakP-1600/compact → k12/lib/Inplace32BI}/KeccakP-1600-SnP.h +4 -9
  12. data/ext/{xkcp/lib/low/KeccakP-1600/plain-32bits-inplace → k12/lib/Inplace32BI}/KeccakP-1600-inplace32BI.c +65 -160
  13. data/ext/k12/lib/KangarooTwelve.c +332 -0
  14. data/ext/{xkcp/lib/high/KangarooTwelve → k12/lib}/KangarooTwelve.h +53 -16
  15. data/ext/{xkcp/lib/low/KeccakP-1600/AVX2 → k12/lib/Optimized64}/KeccakP-1600-AVX2.s +122 -558
  16. data/ext/k12/lib/Optimized64/KeccakP-1600-AVX512-plainC.c +241 -0
  17. data/ext/k12/lib/Optimized64/KeccakP-1600-AVX512.s +551 -0
  18. data/ext/k12/lib/Optimized64/KeccakP-1600-SnP.h +74 -0
  19. data/ext/{xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-64.macros → k12/lib/Optimized64/KeccakP-1600-opt64.c} +447 -169
  20. data/ext/k12/lib/Optimized64/KeccakP-1600-runtimeDispatch.c +406 -0
  21. data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-AVX2.c +419 -0
  22. data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-AVX512.c +458 -0
  23. data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-SSSE3.c +438 -0
  24. data/ext/{xkcp/lib/low/KeccakP-1600/plain-64bits → k12/lib/Plain64}/KeccakP-1600-SnP.h +14 -20
  25. data/ext/{xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.h → k12/lib/Plain64/KeccakP-1600-plain64.c} +9 -8
  26. data/ext/{xkcp/lib/common → k12/lib}/align.h +3 -2
  27. data/ext/{xkcp/lib/common → k12/lib}/brg_endian.h +0 -0
  28. data/ext/{xkcp → k12}/support/Build/ExpandProducts.xsl +0 -0
  29. data/ext/{xkcp → k12}/support/Build/ToGlobalMakefile.xsl +0 -0
  30. data/ext/{xkcp → k12}/support/Build/ToOneTarget.xsl +0 -0
  31. data/ext/{xkcp → k12}/support/Build/ToTargetConfigFile.xsl +0 -0
  32. data/ext/{xkcp → k12}/support/Build/ToTargetMakefile.xsl +10 -16
  33. data/ext/{xkcp → k12}/support/Build/ToVCXProj.xsl +0 -0
  34. data/lib/sleeping_kangaroo12/version.rb +1 -1
  35. metadata +33 -276
  36. data/ext/config/xkcp.build +0 -17
  37. data/ext/xkcp/LICENSE +0 -1
  38. data/ext/xkcp/Makefile.build +0 -200
  39. data/ext/xkcp/README.markdown +0 -296
  40. data/ext/xkcp/lib/HighLevel.build +0 -143
  41. data/ext/xkcp/lib/LowLevel.build +0 -757
  42. data/ext/xkcp/lib/high/KangarooTwelve/KangarooTwelve.c +0 -301
  43. data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.c +0 -81
  44. data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.h +0 -125
  45. data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.c +0 -48
  46. data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.h +0 -79
  47. data/ext/xkcp/lib/high/Keccak/KeccakDuplex.c +0 -81
  48. data/ext/xkcp/lib/high/Keccak/KeccakDuplex.h +0 -73
  49. data/ext/xkcp/lib/high/Keccak/KeccakDuplex.inc +0 -195
  50. data/ext/xkcp/lib/high/Keccak/KeccakSponge.c +0 -111
  51. data/ext/xkcp/lib/high/Keccak/KeccakSponge.h +0 -76
  52. data/ext/xkcp/lib/high/Keccak/KeccakSponge.inc +0 -314
  53. data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.c +0 -61
  54. data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.h +0 -67
  55. data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.inc +0 -128
  56. data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.c +0 -93
  57. data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.h +0 -599
  58. data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.inc +0 -573
  59. data/ext/xkcp/lib/high/Ketje/Ketjev2.c +0 -87
  60. data/ext/xkcp/lib/high/Ketje/Ketjev2.h +0 -88
  61. data/ext/xkcp/lib/high/Ketje/Ketjev2.inc +0 -274
  62. data/ext/xkcp/lib/high/Keyak/Keyakv2.c +0 -132
  63. data/ext/xkcp/lib/high/Keyak/Keyakv2.h +0 -217
  64. data/ext/xkcp/lib/high/Keyak/Keyakv2.inc +0 -81
  65. data/ext/xkcp/lib/high/Keyak/Motorist.inc +0 -953
  66. data/ext/xkcp/lib/high/Kravatte/Kravatte.c +0 -533
  67. data/ext/xkcp/lib/high/Kravatte/Kravatte.h +0 -115
  68. data/ext/xkcp/lib/high/Kravatte/KravatteModes.c +0 -557
  69. data/ext/xkcp/lib/high/Kravatte/KravatteModes.h +0 -247
  70. data/ext/xkcp/lib/high/Xoodyak/Cyclist.h +0 -66
  71. data/ext/xkcp/lib/high/Xoodyak/Cyclist.inc +0 -336
  72. data/ext/xkcp/lib/high/Xoodyak/Xoodyak-parameters.h +0 -26
  73. data/ext/xkcp/lib/high/Xoodyak/Xoodyak.c +0 -55
  74. data/ext/xkcp/lib/high/Xoodyak/Xoodyak.h +0 -35
  75. data/ext/xkcp/lib/high/Xoofff/Xoofff.c +0 -634
  76. data/ext/xkcp/lib/high/Xoofff/Xoofff.h +0 -147
  77. data/ext/xkcp/lib/high/Xoofff/XoofffModes.c +0 -483
  78. data/ext/xkcp/lib/high/Xoofff/XoofffModes.h +0 -241
  79. data/ext/xkcp/lib/high/common/Phases.h +0 -25
  80. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-SnP.h +0 -41
  81. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-armcc.s +0 -1666
  82. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-gcc.s +0 -1655
  83. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-armcc.s +0 -1268
  84. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-gcc.s +0 -1264
  85. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-armcc.s +0 -1178
  86. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-gcc.s +0 -1175
  87. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-armcc.s +0 -1338
  88. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-gcc.s +0 -1336
  89. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-armcc.s +0 -1343
  90. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-gcc.s +0 -1339
  91. data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-SnP.h +0 -42
  92. data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-armcc.s +0 -823
  93. data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-gcc.s +0 -831
  94. data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-SnP.h +0 -31
  95. data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-armv8a-neon.s +0 -540
  96. data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-SnP.h +0 -42
  97. data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-compact.s +0 -733
  98. data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-fast.s +0 -1121
  99. data/ext/xkcp/lib/low/KeccakP-1600/AVX2/KeccakP-1600-SnP.h +0 -52
  100. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-AVX512.c +0 -623
  101. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-SnP.h +0 -47
  102. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u12/KeccakP-1600-AVX512-config.h +0 -6
  103. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u6/KeccakP-1600-AVX512-config.h +0 -6
  104. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/ua/KeccakP-1600-AVX512-config.h +0 -6
  105. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-AVX512.s +0 -1031
  106. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-SnP.h +0 -53
  107. data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-SnP.h +0 -44
  108. data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-XOP.c +0 -476
  109. data/ext/xkcp/lib/low/KeccakP-1600/XOP/u6/KeccakP-1600-XOP-config.h +0 -6
  110. data/ext/xkcp/lib/low/KeccakP-1600/XOP/ua/KeccakP-1600-XOP-config.h +0 -6
  111. data/ext/xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-unrolling.macros +0 -305
  112. data/ext/xkcp/lib/low/KeccakP-1600/compact/KeccakP-1600-compact64.c +0 -420
  113. data/ext/xkcp/lib/low/KeccakP-1600/plain-32bits-inplace/KeccakP-1600-SnP.h +0 -43
  114. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/KeccakP-1600-opt64.c +0 -565
  115. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcu6/KeccakP-1600-opt64-config.h +0 -7
  116. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua/KeccakP-1600-opt64-config.h +0 -7
  117. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua-shld/KeccakP-1600-opt64-config.h +0 -8
  118. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/u6/KeccakP-1600-opt64-config.h +0 -6
  119. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/ua/KeccakP-1600-opt64-config.h +0 -6
  120. data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-SnP.h +0 -44
  121. data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference.h +0 -23
  122. data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference32BI.c +0 -625
  123. data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-SnP.h +0 -44
  124. data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.c +0 -440
  125. data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-SnP.h +0 -42
  126. data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas.s +0 -1196
  127. data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas_Apple.s +0 -1124
  128. data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-shld-gas.s +0 -1196
  129. data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-armcc.s +0 -1392
  130. data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-gcc.s +0 -1394
  131. data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-times2-SnP.h +0 -42
  132. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u12/SIMD512-2-config.h +0 -7
  133. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u4/SIMD512-2-config.h +0 -7
  134. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512ufull/SIMD512-2-config.h +0 -7
  135. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SIMD512.c +0 -850
  136. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SnP.h +0 -51
  137. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SIMD128.c +0 -957
  138. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SnP.h +0 -49
  139. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-u2/SIMD128-config.h +0 -8
  140. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-ua/SIMD128-config.h +0 -8
  141. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-u2/SIMD128-config.h +0 -9
  142. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-ua/SIMD128-config.h +0 -9
  143. data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-SnP.h +0 -45
  144. data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-on1.c +0 -37
  145. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SIMD256.c +0 -1321
  146. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SnP.h +0 -55
  147. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u12/SIMD256-config.h +0 -7
  148. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u6/SIMD256-config.h +0 -7
  149. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/ua/SIMD256-config.h +0 -7
  150. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u12/SIMD512-4-config.h +0 -7
  151. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u4/SIMD512-4-config.h +0 -7
  152. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512ufull/SIMD512-4-config.h +0 -7
  153. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SIMD512.c +0 -881
  154. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SnP.h +0 -51
  155. data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-SnP.h +0 -45
  156. data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-on1.c +0 -37
  157. data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-SnP.h +0 -45
  158. data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-on2.c +0 -38
  159. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SIMD512.c +0 -1615
  160. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SnP.h +0 -57
  161. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u12/SIMD512-config.h +0 -7
  162. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u4/SIMD512-config.h +0 -7
  163. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/ua/SIMD512-config.h +0 -7
  164. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-SnP.h +0 -45
  165. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-on1.c +0 -37
  166. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-SnP.h +0 -45
  167. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-on2.c +0 -38
  168. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-SnP.h +0 -45
  169. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-on4.c +0 -38
  170. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-SnP.h +0 -41
  171. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-armcc.s +0 -442
  172. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-gcc.s +0 -446
  173. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-armcc.s +0 -419
  174. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-gcc.s +0 -427
  175. data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-SnP.h +0 -41
  176. data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-avr8-fast.s +0 -647
  177. data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-SnP.h +0 -39
  178. data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-compact.c +0 -190
  179. data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-SnP.h +0 -43
  180. data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.c +0 -412
  181. data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.h +0 -23
  182. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-SnP.h +0 -41
  183. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-armcc.s +0 -454
  184. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-gcc.s +0 -458
  185. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-armcc.s +0 -455
  186. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-gcc.s +0 -458
  187. data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-SnP.h +0 -41
  188. data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-avr8-fast.s +0 -728
  189. data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-SnP.h +0 -43
  190. data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.c +0 -414
  191. data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.h +0 -23
  192. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-SnP.h +0 -42
  193. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-armcc.s +0 -527
  194. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-gcc.s +0 -533
  195. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-armcc.s +0 -528
  196. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-gcc.s +0 -534
  197. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-armcc.s +0 -521
  198. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-gcc.s +0 -527
  199. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-armcc.s +0 -517
  200. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-gcc.s +0 -523
  201. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-armcc.s +0 -550
  202. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-gcc.s +0 -556
  203. data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-SnP.h +0 -32
  204. data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-armv8a-neon.s +0 -432
  205. data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-SnP.h +0 -42
  206. data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-avr8-fast.s +0 -929
  207. data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-SnP.h +0 -40
  208. data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-compact.c +0 -244
  209. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-SnP.h +0 -46
  210. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32-bis.macros +0 -184
  211. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.c +0 -454
  212. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.macros +0 -459
  213. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling-bis.macros +0 -83
  214. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling.macros +0 -88
  215. data/ext/xkcp/lib/low/KeccakP-800/plain/lcu2/KeccakP-800-opt32-config.h +0 -7
  216. data/ext/xkcp/lib/low/KeccakP-800/plain/lcua/KeccakP-800-opt32-config.h +0 -7
  217. data/ext/xkcp/lib/low/KeccakP-800/plain/u2/KeccakP-800-opt32-config.h +0 -7
  218. data/ext/xkcp/lib/low/KeccakP-800/plain/ua/KeccakP-800-opt32-config.h +0 -7
  219. data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-SnP.h +0 -44
  220. data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.c +0 -437
  221. data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.h +0 -23
  222. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/Ket.h +0 -57
  223. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-armcc.s +0 -475
  224. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-gcc.s +0 -480
  225. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-armcc.s +0 -590
  226. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-gcc.s +0 -590
  227. data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.c +0 -126
  228. data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.h +0 -68
  229. data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.inc +0 -174
  230. data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.c +0 -80
  231. data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.h +0 -68
  232. data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.inc +0 -142
  233. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-SnP.h +0 -55
  234. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-armcc.s +0 -1086
  235. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-gcc.s +0 -1092
  236. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-armcc.s +0 -721
  237. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-gcc.s +0 -726
  238. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-armcc.s +0 -723
  239. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-gcc.s +0 -729
  240. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-armcc.s +0 -1164
  241. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-gcc.s +0 -1165
  242. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-armcc.s +0 -562
  243. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-gcc.s +0 -563
  244. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-armcc.s +0 -563
  245. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-gcc.s +0 -565
  246. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-SnP.h +0 -55
  247. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-armcc.s +0 -476
  248. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-gcc.s +0 -485
  249. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-armcc.s +0 -362
  250. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-gcc.s +0 -367
  251. data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-SnP.h +0 -43
  252. data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-avr8-u1.s +0 -1341
  253. data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SIMD512.c +0 -581
  254. data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SnP.h +0 -58
  255. data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodyak-full-block-SIMD512.c +0 -332
  256. data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SIMD128.c +0 -329
  257. data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SnP.h +0 -53
  258. data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodyak-full-block-SIMD128.c +0 -355
  259. data/ext/xkcp/lib/low/Xoodoo/Xoodoo.h +0 -79
  260. data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-SnP.h +0 -56
  261. data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-optimized.c +0 -399
  262. data/ext/xkcp/lib/low/Xoodoo/plain/Xoodyak-full-blocks.c +0 -127
  263. data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-SnP.h +0 -43
  264. data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-reference.c +0 -253
  265. data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SIMD512.c +0 -1044
  266. data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SnP.h +0 -49
  267. data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-SnP.h +0 -45
  268. data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-on1.c +0 -37
  269. data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-ARMv7A.s +0 -1587
  270. data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-SnP.h +0 -48
  271. data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SIMD512.c +0 -1202
  272. data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SnP.h +0 -48
  273. data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SIMD128.c +0 -484
  274. data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SnP.h +0 -44
  275. data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-SnP.h +0 -45
  276. data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-on1.c +0 -37
  277. data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SIMD256.c +0 -939
  278. data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SnP.h +0 -49
  279. data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SIMD512.c +0 -1216
  280. data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SnP.h +0 -48
  281. data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-SnP.h +0 -45
  282. data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-on1.c +0 -37
  283. data/ext/xkcp/lib/low/common/PlSnP-Fallback.inc +0 -290
  284. data/ext/xkcp/lib/low/common/SnP-Relaned.h +0 -141
  285. data/ext/xkcp/support/Kernel-PMU/Kernel-pmu.md +0 -133
  286. data/ext/xkcp/support/Kernel-PMU/Makefile +0 -8
  287. data/ext/xkcp/support/Kernel-PMU/enable_arm_pmu.c +0 -129
  288. data/ext/xkcp/support/Kernel-PMU/load-module +0 -1
  289. data/ext/xkcp/util/KeccakSum/KeccakSum.c +0 -394
  290. data/ext/xkcp/util/KeccakSum/base64.c +0 -86
  291. data/ext/xkcp/util/KeccakSum/base64.h +0 -12
@@ -1,581 +0,0 @@
1
- /*
2
- The eXtended Keccak Code Package (XKCP)
3
- https://github.com/XKCP/XKCP
4
-
5
- The Xoodoo permutation, designed by Joan Daemen, Seth Hoffert, Gilles Van Assche and Ronny Van Keer.
6
-
7
- Implementation by Ronny Van Keer, hereby denoted as "the implementer".
8
-
9
- For more information, feedback or questions, please refer to the Keccak Team website:
10
- https://keccak.team/
11
-
12
- To the extent possible under law, the implementer has waived all copyright
13
- and related or neighboring rights to the source code in this file.
14
- http://creativecommons.org/publicdomain/zero/1.0/
15
- */
16
-
17
- #define VERBOSE 0
18
- /* #define SIMULATE_AVX512 */
19
-
20
- #include <stdio.h>
21
- #include <string.h>
22
- #include <smmintrin.h>
23
- #include <wmmintrin.h>
24
- #include <immintrin.h>
25
- #include <emmintrin.h>
26
- #include "align.h"
27
- #include "brg_endian.h"
28
- #include "Xoodoo.h"
29
-
30
- #if (PLATFORM_BYTE_ORDER != IS_LITTLE_ENDIAN)
31
- #error Expecting a little-endian platform
32
- #endif
33
-
34
- #if defined(SIMULATE_AVX512)
35
-
36
- typedef union
37
- {
38
- uint32_t x[4];
39
- __m128i s;
40
- } s__m128i;
41
-
42
- static __m128i _mm_permutex2var_epi32(__m128i a, __m128i idx, __m128i b)
43
- {
44
- s__m128i r;
45
- s__m128i iidx, aa, bb;
46
- unsigned int i;
47
-
48
- iidx.s = idx;
49
- aa.s = a;
50
- bb.s = b;
51
- for ( i = 0; i < 4; ++i )
52
- r.x[i] = (iidx.x[i] & 4) ? bb.x[iidx.x[i] & 3] : aa.x[iidx.x[i] & 3];
53
- return(r.s);
54
- }
55
-
56
- static __m128i _mm_rol_epi32(__m128i a, int offset)
57
- {
58
- s__m128i r;
59
- s__m128i aa;
60
- unsigned int i;
61
-
62
- aa.s = a;
63
- for ( i = 0; i < 4; ++i )
64
- r.x[i] = (aa.x[i] << offset) | (aa.x[i] >> (32-offset));
65
- return(r.s);
66
- }
67
-
68
- static __m128i _mm_ternarylogic_epi32(__m128i a, __m128i b, __m128i c, int imm)
69
- {
70
-
71
- if (imm == 0x96)
72
- return ( _mm_xor_si128( _mm_xor_si128( a, b ), c ) );
73
- if (imm == 0xD2) {
74
- s__m128i t;
75
- s__m128i bb;
76
- s__m128i cc;
77
- unsigned int i;
78
-
79
- bb.s = b;
80
- cc.s = c;
81
- for ( i = 0; i < 4; ++i )
82
- t.x[i] = ~bb.x[i] & cc.x[i];
83
- return ( _mm_xor_si128( a, t.s ) );
84
- }
85
- printf( "_mm_ternarylogic_epi32( a, b, c, %02X) not implemented!\n", imm );
86
- exit(1);
87
- }
88
-
89
- typedef struct
90
- {
91
- uint32_t x[16];
92
- } __m512i;
93
-
94
- static __m512i _mm512_loadu_si512(const __m512i * mem_addr)
95
- {
96
- __m512i r;
97
- const uint32_t *p32 = (const uint32_t *)mem_addr;
98
- unsigned int i;
99
-
100
- for ( i = 0; i < 16; ++i )
101
- r.x[i] = p32[i];
102
- return(r);
103
- }
104
-
105
- static void _mm512_storeu_si512(__m512i * mem_addr, __m512i a)
106
- {
107
- uint32_t *p32 = (uint32_t *)mem_addr;
108
- unsigned int i;
109
-
110
- for ( i = 0; i < 16; ++i )
111
- p32[i] = a.x[i];
112
- }
113
-
114
- static __m512i _mm512_xor_si512( __m512i a, __m512i b)
115
- {
116
- __m512i r;
117
- unsigned int i;
118
-
119
- for ( i = 0; i < 16; ++i )
120
- r.x[i] = a.x[i] ^ b.x[i];
121
- return(r);
122
- }
123
-
124
- #endif
125
-
126
- #if (VERBOSE > 0)
127
- #define Dump(__t) Vars2State; \
128
- printf(__t "\n"); \
129
- printf("a00 %08x, a01 %08x, a02 %08x, a03 %08x\n", state[0+0], state[0+1], state[0+2], state[0+3] ); \
130
- printf("a10 %08x, a11 %08x, a12 %08x, a13 %08x\n", state[4+0], state[4+1], state[4+2], state[4+3] ); \
131
- printf("a20 %08x, a21 %08x, a22 %08x, a23 %08x\n\n", state[8+0], state[8+1], state[8+2], state[8+3] );
132
-
133
- #define DumpLanes(__t, l0, l1, l2) { \
134
- uint32_t buf[4]; \
135
- printf(__t "\n"); \
136
- STORE128u(buf[0], l0); printf("%08x %08x %08x %08x\n", buf[0], buf[1], buf[2], buf[3] ); \
137
- STORE128u(buf[0], l1); printf("%08x %08x %08x %08x\n", buf[0], buf[1], buf[2], buf[3] ); \
138
- STORE128u(buf[0], l2); printf("%08x %08x %08x %08x\n\n", buf[0], buf[1], buf[2], buf[3] ); }
139
- #else
140
- #define Dump(__t)
141
- #define DumpLanes(__t, l0, l1, l2)
142
- #endif
143
-
144
- #if (VERBOSE >= 1)
145
- #define Dump1(__t) Dump(__t)
146
- #else
147
- #define Dump1(__t)
148
- #endif
149
-
150
- #if (VERBOSE >= 2)
151
- #define Dump2(__t) Dump(__t)
152
- #else
153
- #define Dump2(__t)
154
- #endif
155
-
156
- #if (VERBOSE >= 3)
157
- #define Dump3(__t) Dump(__t)
158
- #else
159
- #define Dump3(__t)
160
- #endif
161
-
162
-
163
- /* ---------------------------------------------------------------- */
164
-
165
- void Xoodoo_Initialize(void *state)
166
- {
167
- memset(state, 0, NLANES*sizeof(tXoodooLane));
168
- }
169
-
170
- /* ---------------------------------------------------------------- */
171
-
172
- void Xoodoo_AddBytes(void *argState, const unsigned char *data, unsigned int offset, unsigned int length)
173
- {
174
- #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
175
- unsigned int sizeLeft = length;
176
- unsigned int lanePosition = offset/4;
177
- unsigned int offsetInLane = offset%4;
178
- const unsigned char *curData = data;
179
- uint32_t *state = (uint32_t*)argState;
180
-
181
- state += lanePosition;
182
- if ((sizeLeft > 0) && (offsetInLane != 0)) {
183
- unsigned int bytesInLane = 4 - offsetInLane;
184
- uint32_t lane = 0;
185
- if (bytesInLane > sizeLeft)
186
- bytesInLane = sizeLeft;
187
- memcpy((unsigned char*)&lane + offsetInLane, curData, bytesInLane);
188
- *state++ ^= lane;
189
- sizeLeft -= bytesInLane;
190
- curData += bytesInLane;
191
- }
192
-
193
- while(sizeLeft >= 4) {
194
- *state++ ^= READ32_UNALIGNED( curData );
195
- sizeLeft -= 4;
196
- curData += 4;
197
- }
198
-
199
- if (sizeLeft > 0) {
200
- uint32_t lane = 0;
201
- memcpy(&lane, curData, sizeLeft);
202
- *state ^= lane;
203
- }
204
- #else
205
- #error "Not yet implemented"
206
- #endif
207
- }
208
-
209
- /* ---------------------------------------------------------------- */
210
-
211
- void Xoodoo_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
212
- {
213
- #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
214
- memcpy((unsigned char*)state+offset, data, length);
215
- #else
216
- #error "Not yet implemented"
217
- #endif
218
- }
219
-
220
- /* ---------------------------------------------------------------- */
221
-
222
- void Xoodoo_OverwriteWithZeroes(void *state, unsigned int byteCount)
223
- {
224
- #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
225
- memset(state, 0, byteCount);
226
- #else
227
- #error "Not yet implemented"
228
- #endif
229
- }
230
-
231
- /* ---------------------------------------------------------------- */
232
-
233
- void Xoodoo_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length)
234
- {
235
- #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
236
- memcpy(data, (unsigned char*)state+offset, length);
237
- #else
238
- #error "Not yet implemented"
239
- #endif
240
- }
241
-
242
- /* ---------------------------------------------------------------- */
243
-
244
- void Xoodoo_ExtractAndAddBytes(const void *argState, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
245
- {
246
- #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
247
- unsigned int sizeLeft = length;
248
- unsigned int lanePosition = offset/4;
249
- unsigned int offsetInLane = offset%4;
250
- const unsigned char *curInput = input;
251
- unsigned char *curOutput = output;
252
- const uint32_t *state = (const uint32_t*)argState;
253
-
254
- state += lanePosition;
255
- if ((sizeLeft > 0) && (offsetInLane != 0)) {
256
- unsigned int bytesInLane = 4 - offsetInLane;
257
- uint32_t lane = *state++ >> (offsetInLane * 8);
258
- if (bytesInLane > sizeLeft)
259
- bytesInLane = sizeLeft;
260
- sizeLeft -= bytesInLane;
261
- do {
262
- *curOutput++ = (*curInput++) ^ (unsigned char)lane;
263
- lane >>= 8;
264
- }
265
- while ( --bytesInLane != 0);
266
- }
267
-
268
- while(sizeLeft >= 4) {
269
- WRITE32_UNALIGNED( curOutput, READ32_UNALIGNED( curInput ) ^ *state++ );
270
- sizeLeft -= 4;
271
- curInput += 4;
272
- curOutput += 4;
273
- }
274
-
275
- if (sizeLeft > 0) {
276
- uint32_t lane = *state;
277
- do {
278
- *curOutput++ = (*curInput++) ^ (unsigned char)lane;
279
- lane >>= 8;
280
- }
281
- while ( --sizeLeft != 0 );
282
- }
283
- #else
284
- #error "Not yet implemented"
285
- #endif
286
- }
287
-
288
- /* ---------------------------------------------------------------- */
289
-
290
- typedef __m128i V128;
291
- typedef __m256i V256;
292
- typedef __m512i V512;
293
-
294
- ALIGN(16) static const uint8_t maskRhoEast2[16] = {
295
- 11, 8, 9, 10,
296
- 15, 12, 13, 14,
297
- 3, 0, 1, 2,
298
- 7, 4, 5, 6,
299
- };
300
-
301
- #define CONST128(a) _mm_load_si128((const V128 *)&(a))
302
- #define LOAD128(a) _mm_load_si128((const V128 *)&(a))
303
- #define LOAD128u(a) _mm_loadu_si128((const V128 *)&(a))
304
- #define LOAD4_32(a,b,c,d) _mm_setr_epi32(a,b,c,d)
305
- #define ROL32(a, o) _mm_rol_epi32(a, o)
306
- #define SHL32(a, o) _mm_slli_epi32(a, o)
307
- #define STORE128(a, b) _mm_store_si128((V128 *)&(a), b)
308
- #define STORE128u(a, b) _mm_storeu_si128((V128 *)&(a), b)
309
- #define AND(a, b) _mm_and_si128(a, b)
310
- #define XOR(a, b) _mm_xor_si128(a, b)
311
- #define XOR3(a,b,c) _mm_ternarylogic_epi32(a,b,c,0x96)
312
- #define Chi(a,b,c) _mm_ternarylogic_epi32(a,b,c,0xD2)
313
-
314
- #define LOAD256u(a) _mm256_loadu_si256((const V256 *)&(a))
315
- #define STORE256u(a, b) _mm256_storeu_si256((V256 *)&(a), b)
316
- #define XOR256(a, b) _mm256_xor_si256(a, b)
317
-
318
- #define LOAD512u(a) _mm512_loadu_si512((const V512 *)&(a))
319
- #define STORE512u(a, b) _mm512_storeu_si512((V512 *)&(a), b)
320
- #define XOR512(a, b) _mm512_xor_si512(a, b)
321
-
322
- #define DeclareVars V128 a0, a1, a2, p, e, rhoEast2 = CONST128(maskRhoEast2);
323
- #define State2Vars a0 = LOAD128(state[0]), a1 = LOAD128(state[4]), a2 = LOAD128(state[8]);
324
- #define Vars2State STORE128(state[0], a0), STORE128(state[4], a1), STORE128(state[8], a2);
325
-
326
- #define Round(__rc) \
327
- /* Theta: Column Parity Mixer */ \
328
- p = XOR3( a0, a1, a2 ); \
329
- p = _mm_shuffle_epi32( p, 0x93); \
330
- e = ROL32( p, 5 ); \
331
- p = ROL32( p, 14 ); \
332
- a0 = XOR3( a0, e, p); \
333
- a1 = XOR3( a1, e, p); \
334
- a2 = XOR3( a2, e, p); \
335
- Dump3("Theta"); \
336
- \
337
- /* Rho-west: Plane shift */ \
338
- a1 = _mm_shuffle_epi32( a1, 0x93); \
339
- a2 = ROL32(a2, 11); \
340
- Dump3("Rho-west"); \
341
- \
342
- /* Iota: round constants */ \
343
- a0 = XOR(a0, _mm_set_epi32(0, 0, 0, (__rc))); \
344
- Dump3("Iota"); \
345
- \
346
- /* Chi: non linear step, on colums */ \
347
- a0 = Chi(a0, a1, a2); \
348
- a1 = Chi(a1, a2, a0); \
349
- a2 = Chi(a2, a0, a1); \
350
- Dump3("Chi"); \
351
- \
352
- /* Rho-east: Plane shift */ \
353
- a1 = ROL32(a1, 1); \
354
- a2 = _mm_shuffle_epi8( a2, rhoEast2); \
355
- Dump3("Rho-east")
356
-
357
- static const uint32_t RC[MAXROUNDS] = {
358
- _rc12,
359
- _rc11,
360
- _rc10,
361
- _rc9,
362
- _rc8,
363
- _rc7,
364
- _rc6,
365
- _rc5,
366
- _rc4,
367
- _rc3,
368
- _rc2,
369
- _rc1
370
- };
371
-
372
- void Xoodoo_Permute_Nrounds( uint32_t * state, uint32_t nr )
373
- {
374
- DeclareVars;
375
- uint32_t i;
376
-
377
- State2Vars;
378
- for (i = MAXROUNDS - nr; i < MAXROUNDS; ++i ) {
379
- Round(RC[i]);
380
- Dump2("Round");
381
- }
382
- Dump1("Permutation");
383
- Vars2State;
384
- }
385
-
386
- void Xoodoo_Permute_6rounds( uint32_t * state)
387
- {
388
- DeclareVars;
389
-
390
- State2Vars;
391
- Round(_rc6);
392
- Round(_rc5);
393
- Round(_rc4);
394
- Round(_rc3);
395
- Round(_rc2);
396
- Round(_rc1);
397
- Dump2("Permutation");
398
- Vars2State;
399
- }
400
-
401
- void Xoodoo_Permute_12rounds( uint32_t * state)
402
- {
403
- DeclareVars;
404
-
405
- State2Vars;
406
- Round(_rc12);
407
- Round(_rc11);
408
- Round(_rc10);
409
- Round(_rc9);
410
- Round(_rc8);
411
- Round(_rc7);
412
- Round(_rc6);
413
- Round(_rc5);
414
- Round(_rc4);
415
- Round(_rc3);
416
- Round(_rc2);
417
- Round(_rc1);
418
- Dump2("Permutation");
419
- Vars2State;
420
- }
421
-
422
- void Xoofff_AddIs(unsigned char *output, const unsigned char *input, size_t bitLen)
423
- {
424
- size_t byteLen = bitLen / 8;
425
- V512 lanes1, lanes2, lanes3, lanes4;
426
- V256 lanesA, lanesB;
427
-
428
- while ( byteLen >= 128 ) {
429
- lanes1 = LOAD512u(input[ 0]);
430
- lanes2 = LOAD512u(input[64]);
431
- lanes3 = LOAD512u(output[ 0]);
432
- lanes4 = LOAD512u(output[64]);
433
- lanes1 = XOR512(lanes1, lanes3);
434
- lanes2 = XOR512(lanes2, lanes4);
435
- STORE512u(output[ 0], lanes1);
436
- STORE512u(output[64], lanes2);
437
- input += 128;
438
- output += 128;
439
- byteLen -= 128;
440
- }
441
- while ( byteLen >= 32 ) {
442
- lanesA = LOAD256u(input[0]);
443
- lanesB = LOAD256u(output[0]);
444
- input += 32;
445
- lanesA = XOR256(lanesA, lanesB);
446
- byteLen -= 32;
447
- STORE256u(output[0], lanesA);
448
- output += 32;
449
- }
450
- while ( byteLen >= 8 ) {
451
- *((uint64_t*)output) ^= *((uint64_t*)input);
452
- input += 8;
453
- output += 8;
454
- byteLen -= 8;
455
- }
456
- while ( byteLen-- != 0 ) {
457
- *output++ ^= *input++;
458
- }
459
-
460
- bitLen &= 7;
461
- if (bitLen != 0)
462
- {
463
- *output ^= *input;
464
- *output &= (1 << bitLen) - 1;
465
- }
466
-
467
- }
468
-
469
- size_t Xoofff_CompressFastLoop(unsigned char *kRoll, unsigned char *xAccu, const unsigned char *input, size_t length)
470
- {
471
- DeclareVars;
472
- V128 r0, r1, r2;
473
- V128 x0, x1, x2;
474
- V128 rr = LOAD4_32(1, 2, 3, 4+0);
475
- size_t initialLength = length;
476
-
477
- r0 = LOAD128(kRoll[0]);
478
- r1 = LOAD128(kRoll[4*4]);
479
- r2 = LOAD128(kRoll[8*4]);
480
-
481
- x0 = LOAD128(xAccu[0]);
482
- x1 = LOAD128(xAccu[4*4]);
483
- x2 = LOAD128(xAccu[8*4]);
484
-
485
- do {
486
- a0 = XOR( r0, LOAD128u(input[0]));
487
- a1 = XOR( r1, LOAD128u(input[4*4]));
488
- a2 = XOR( r2, LOAD128u(input[8*4]));
489
-
490
- DumpLanes("iperm", a0, a1, a2);
491
- Round(_rc6);
492
- Round(_rc5);
493
- Round(_rc4);
494
- Round(_rc3);
495
- Round(_rc2);
496
- Round(_rc1);
497
- DumpLanes("operm", a0, a1, a2);
498
-
499
- x0 = XOR(x0, a0);
500
- x1 = XOR(x1, a1);
501
- x2 = XOR(x2, a2);
502
- DumpLanes("xAccu", x0, x1, x2);
503
-
504
- /* roll-c */
505
- p = XOR3( r0, SHL32(r0, 13), ROL32(r1, 3));
506
- p = _mm_permutex2var_epi32(r0, rr, p);
507
- r0 = r1;
508
- r1 = r2;
509
- r2 = p;
510
- DumpLanes("rollc", r0, r1, r2);
511
-
512
- input += NLANES*4;
513
- length -= NLANES*4;
514
- }
515
- while (length >= (NLANES*4));
516
-
517
- STORE128(kRoll[0], r0);
518
- STORE128(kRoll[4*4], r1);
519
- STORE128(kRoll[8*4], r2);
520
-
521
- STORE128(xAccu[0], x0);
522
- STORE128(xAccu[4*4], x1);
523
- STORE128(xAccu[8*4], x2);
524
-
525
- return initialLength - length;
526
- }
527
-
528
- size_t Xoofff_ExpandFastLoop(unsigned char *yAccu, const unsigned char *kRoll, unsigned char *output, size_t length)
529
- {
530
- DeclareVars;
531
- V128 r0, r1, r2;
532
- V128 k0, k1, k2;
533
- V128 rr = LOAD4_32(1, 2, 3, 4+0);
534
- V128 c7 = LOAD4_32(7, 0, 0, 0);
535
- size_t initialLength = length;
536
-
537
- r0 = LOAD128(yAccu[0]);
538
- r1 = LOAD128(yAccu[4*4]);
539
- r2 = LOAD128(yAccu[8*4]);
540
-
541
- k0 = LOAD128(kRoll[0]);
542
- k1 = LOAD128(kRoll[4*4]);
543
- k2 = LOAD128(kRoll[8*4]);
544
-
545
- do {
546
- a0 = r0;
547
- a1 = r1;
548
- a2 = r2;
549
-
550
- DumpLanes("iperm", a0, a1, a2);
551
- Round(_rc6);
552
- Round(_rc5);
553
- Round(_rc4);
554
- Round(_rc3);
555
- Round(_rc2);
556
- Round(_rc1);
557
- DumpLanes("operm", a0, a1, a2);
558
-
559
- STORE128u(output[0], XOR(k0, a0));
560
- STORE128u(output[4*4], XOR(k1, a1));
561
- STORE128u(output[8*4], XOR(k2, a2));
562
-
563
- /* roll-e */
564
- p = XOR3( ROL32(r0, 5), ROL32(r1, 13), AND(r2, r1));
565
- p = XOR( p, c7);
566
- p = _mm_permutex2var_epi32(r0, rr, p);
567
- r0 = r1;
568
- r1 = r2;
569
- r2 = p;
570
- DumpLanes("rolle", r0, r1, r2);
571
-
572
- output += NLANES*4;
573
- length -= NLANES*4;
574
- } while (length >= (NLANES*4));
575
-
576
- STORE128(yAccu[0], r0);
577
- STORE128(yAccu[4*4], r1);
578
- STORE128(yAccu[8*4], r2);
579
-
580
- return initialLength - length;
581
- }
@@ -1,58 +0,0 @@
1
- /*
2
- The eXtended Keccak Code Package (XKCP)
3
- https://github.com/XKCP/XKCP
4
-
5
- The Xoodoo permutation, designed by Joan Daemen, Seth Hoffert, Gilles Van Assche and Ronny Van Keer.
6
-
7
- Implementation by Ronny Van Keer, hereby denoted as "the implementer".
8
-
9
- For more information, feedback or questions, please refer to the Keccak Team website:
10
- https://keccak.team/
11
-
12
- To the extent possible under law, the implementer has waived all copyright
13
- and related or neighboring rights to the source code in this file.
14
- http://creativecommons.org/publicdomain/zero/1.0/
15
- */
16
-
17
- #ifndef _Xoodoo_SnP_h_
18
- #define _Xoodoo_SnP_h_
19
-
20
- #include <stddef.h>
21
- #include <stdint.h>
22
-
23
- /** For the documentation, see SnP-documentation.h.
24
- */
25
-
26
- #define Xoodoo_implementation "SIMD-512 optimized implementation"
27
- #define Xoodoo_stateSizeInBytes (3*4*4)
28
- #define Xoodoo_stateAlignment 64
29
- #define Xoodoo_HasNround
30
-
31
- /* void Xoodoo_StaticInitialize( void ); */
32
- #define Xoodoo_StaticInitialize()
33
- void Xoodoo_Initialize(void *state);
34
- /* void Xoodoo_AddByte(void *state, uint8_t data, unsigned int offset); */
35
- #define Xoodoo_AddByte(argS, argData, argOffset) ((uint8_t*)argS)[argOffset] ^= (argData)
36
- void Xoodoo_AddBytes(void *state, const uint8_t *data, unsigned int offset, unsigned int length);
37
- void Xoodoo_OverwriteBytes(void *state, const uint8_t *data, unsigned int offset, unsigned int length);
38
- void Xoodoo_OverwriteWithZeroes(void *state, unsigned int byteCount);
39
- void Xoodoo_Permute_Nrounds(void *state, unsigned int nrounds);
40
- void Xoodoo_Permute_6rounds(void *state);
41
- void Xoodoo_Permute_12rounds(void *state);
42
- void Xoodoo_ExtractBytes(const void *state, uint8_t *data, unsigned int offset, unsigned int length);
43
- void Xoodoo_ExtractAndAddBytes(const void *state, const uint8_t *input, uint8_t *output, unsigned int offset, unsigned int length);
44
-
45
- #define Xoodoo_FastXoofff_supported
46
- void Xoofff_AddIs(unsigned char *output, const unsigned char *input, size_t bitLen);
47
- size_t Xoofff_CompressFastLoop(unsigned char *kRoll, unsigned char *xAccu, const unsigned char *input, size_t length);
48
- size_t Xoofff_ExpandFastLoop(unsigned char *yAccu, const unsigned char *kRoll, unsigned char *output, size_t length);
49
-
50
- #define CyclistFullBlocks_supported
51
- size_t Xoodyak_AbsorbKeyedFullBlocks(void *state, const uint8_t *X, size_t XLen);
52
- size_t Xoodyak_AbsorbHashFullBlocks(void *state, const uint8_t *X, size_t XLen);
53
- size_t Xoodyak_SqueezeHashFullBlocks(void *state, uint8_t *Y, size_t YLen);
54
- size_t Xoodyak_SqueezeKeyedFullBlocks(void *state, uint8_t *Y, size_t YLen);
55
- size_t Xoodyak_EncryptFullBlocks(void *state, const uint8_t *I, uint8_t *O, size_t IOLen);
56
- size_t Xoodyak_DecryptFullBlocks(void *state, const uint8_t *I, uint8_t *O, size_t IOLen);
57
-
58
- #endif