sleeping_kangaroo12 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +27 -0
- data/README.md +48 -53
- data/ext/Rakefile +12 -37
- data/ext/binding/sleeping_kangaroo12.c +1 -16
- data/ext/{xkcp → k12}/Makefile +0 -0
- data/ext/k12/Makefile.build +118 -0
- data/ext/k12/README.markdown +86 -0
- data/ext/k12/lib/ARMv8Asha3/KeccakP-1600-ARMv8Asha3.S +623 -0
- data/ext/k12/lib/ARMv8Asha3/KeccakP-1600-SnP.h +65 -0
- data/ext/k12/lib/ARMv8Asha3/KeccakP-1600-opt64.c +227 -0
- data/ext/{xkcp/lib/low/KeccakP-1600/compact → k12/lib/Inplace32BI}/KeccakP-1600-SnP.h +4 -9
- data/ext/{xkcp/lib/low/KeccakP-1600/plain-32bits-inplace → k12/lib/Inplace32BI}/KeccakP-1600-inplace32BI.c +65 -160
- data/ext/k12/lib/KangarooTwelve.c +332 -0
- data/ext/{xkcp/lib/high/KangarooTwelve → k12/lib}/KangarooTwelve.h +53 -16
- data/ext/{xkcp/lib/low/KeccakP-1600/AVX2 → k12/lib/Optimized64}/KeccakP-1600-AVX2.s +122 -558
- data/ext/k12/lib/Optimized64/KeccakP-1600-AVX512-plainC.c +241 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-AVX512.s +551 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-SnP.h +74 -0
- data/ext/{xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-64.macros → k12/lib/Optimized64/KeccakP-1600-opt64.c} +447 -169
- data/ext/k12/lib/Optimized64/KeccakP-1600-runtimeDispatch.c +406 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-AVX2.c +419 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-AVX512.c +458 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-SSSE3.c +438 -0
- data/ext/{xkcp/lib/low/KeccakP-1600/plain-64bits → k12/lib/Plain64}/KeccakP-1600-SnP.h +14 -20
- data/ext/{xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.h → k12/lib/Plain64/KeccakP-1600-plain64.c} +9 -8
- data/ext/{xkcp/lib/common → k12/lib}/align.h +3 -2
- data/ext/{xkcp/lib/common → k12/lib}/brg_endian.h +0 -0
- data/ext/{xkcp → k12}/support/Build/ExpandProducts.xsl +0 -0
- data/ext/{xkcp → k12}/support/Build/ToGlobalMakefile.xsl +0 -0
- data/ext/{xkcp → k12}/support/Build/ToOneTarget.xsl +0 -0
- data/ext/{xkcp → k12}/support/Build/ToTargetConfigFile.xsl +0 -0
- data/ext/{xkcp → k12}/support/Build/ToTargetMakefile.xsl +10 -16
- data/ext/{xkcp → k12}/support/Build/ToVCXProj.xsl +0 -0
- data/lib/sleeping_kangaroo12/binding.rb +2 -1
- data/lib/sleeping_kangaroo12/build/loader.rb +1 -0
- data/lib/sleeping_kangaroo12/build/platform.rb +1 -0
- data/lib/sleeping_kangaroo12/digest.rb +38 -4
- data/lib/sleeping_kangaroo12/version.rb +1 -1
- metadata +48 -288
- data/ext/config/xkcp.build +0 -17
- data/ext/xkcp/LICENSE +0 -1
- data/ext/xkcp/Makefile.build +0 -200
- data/ext/xkcp/README.markdown +0 -296
- data/ext/xkcp/lib/HighLevel.build +0 -143
- data/ext/xkcp/lib/LowLevel.build +0 -757
- data/ext/xkcp/lib/high/KangarooTwelve/KangarooTwelve.c +0 -301
- data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.c +0 -81
- data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.h +0 -125
- data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.c +0 -48
- data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.h +0 -79
- data/ext/xkcp/lib/high/Keccak/KeccakDuplex.c +0 -81
- data/ext/xkcp/lib/high/Keccak/KeccakDuplex.h +0 -73
- data/ext/xkcp/lib/high/Keccak/KeccakDuplex.inc +0 -195
- data/ext/xkcp/lib/high/Keccak/KeccakSponge.c +0 -111
- data/ext/xkcp/lib/high/Keccak/KeccakSponge.h +0 -76
- data/ext/xkcp/lib/high/Keccak/KeccakSponge.inc +0 -314
- data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.c +0 -61
- data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.h +0 -67
- data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.inc +0 -128
- data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.c +0 -93
- data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.h +0 -599
- data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.inc +0 -573
- data/ext/xkcp/lib/high/Ketje/Ketjev2.c +0 -87
- data/ext/xkcp/lib/high/Ketje/Ketjev2.h +0 -88
- data/ext/xkcp/lib/high/Ketje/Ketjev2.inc +0 -274
- data/ext/xkcp/lib/high/Keyak/Keyakv2.c +0 -132
- data/ext/xkcp/lib/high/Keyak/Keyakv2.h +0 -217
- data/ext/xkcp/lib/high/Keyak/Keyakv2.inc +0 -81
- data/ext/xkcp/lib/high/Keyak/Motorist.inc +0 -953
- data/ext/xkcp/lib/high/Kravatte/Kravatte.c +0 -533
- data/ext/xkcp/lib/high/Kravatte/Kravatte.h +0 -115
- data/ext/xkcp/lib/high/Kravatte/KravatteModes.c +0 -557
- data/ext/xkcp/lib/high/Kravatte/KravatteModes.h +0 -247
- data/ext/xkcp/lib/high/Xoodyak/Cyclist.h +0 -66
- data/ext/xkcp/lib/high/Xoodyak/Cyclist.inc +0 -336
- data/ext/xkcp/lib/high/Xoodyak/Xoodyak-parameters.h +0 -26
- data/ext/xkcp/lib/high/Xoodyak/Xoodyak.c +0 -55
- data/ext/xkcp/lib/high/Xoodyak/Xoodyak.h +0 -35
- data/ext/xkcp/lib/high/Xoofff/Xoofff.c +0 -634
- data/ext/xkcp/lib/high/Xoofff/Xoofff.h +0 -147
- data/ext/xkcp/lib/high/Xoofff/XoofffModes.c +0 -483
- data/ext/xkcp/lib/high/Xoofff/XoofffModes.h +0 -241
- data/ext/xkcp/lib/high/common/Phases.h +0 -25
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-armcc.s +0 -1666
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-gcc.s +0 -1655
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-armcc.s +0 -1268
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-gcc.s +0 -1264
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-armcc.s +0 -1178
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-gcc.s +0 -1175
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-armcc.s +0 -1338
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-gcc.s +0 -1336
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-armcc.s +0 -1343
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-gcc.s +0 -1339
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-armcc.s +0 -823
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-gcc.s +0 -831
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-SnP.h +0 -31
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-armv8a-neon.s +0 -540
- data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-compact.s +0 -733
- data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-fast.s +0 -1121
- data/ext/xkcp/lib/low/KeccakP-1600/AVX2/KeccakP-1600-SnP.h +0 -52
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-AVX512.c +0 -623
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-SnP.h +0 -47
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u12/KeccakP-1600-AVX512-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u6/KeccakP-1600-AVX512-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/ua/KeccakP-1600-AVX512-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-AVX512.s +0 -1031
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-SnP.h +0 -53
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-SnP.h +0 -44
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-XOP.c +0 -476
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/u6/KeccakP-1600-XOP-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/ua/KeccakP-1600-XOP-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-unrolling.macros +0 -305
- data/ext/xkcp/lib/low/KeccakP-1600/compact/KeccakP-1600-compact64.c +0 -420
- data/ext/xkcp/lib/low/KeccakP-1600/plain-32bits-inplace/KeccakP-1600-SnP.h +0 -43
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/KeccakP-1600-opt64.c +0 -565
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcu6/KeccakP-1600-opt64-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua/KeccakP-1600-opt64-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua-shld/KeccakP-1600-opt64-config.h +0 -8
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/u6/KeccakP-1600-opt64-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/ua/KeccakP-1600-opt64-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-SnP.h +0 -44
- data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference.h +0 -23
- data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference32BI.c +0 -625
- data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-SnP.h +0 -44
- data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.c +0 -440
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas.s +0 -1196
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas_Apple.s +0 -1124
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-shld-gas.s +0 -1196
- data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-armcc.s +0 -1392
- data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-gcc.s +0 -1394
- data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-times2-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u12/SIMD512-2-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u4/SIMD512-2-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512ufull/SIMD512-2-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SIMD512.c +0 -850
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SnP.h +0 -51
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SIMD128.c +0 -957
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SnP.h +0 -49
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-u2/SIMD128-config.h +0 -8
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-ua/SIMD128-config.h +0 -8
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-u2/SIMD128-config.h +0 -9
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-ua/SIMD128-config.h +0 -9
- data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-on1.c +0 -37
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SIMD256.c +0 -1321
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SnP.h +0 -55
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u12/SIMD256-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u6/SIMD256-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/ua/SIMD256-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u12/SIMD512-4-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u4/SIMD512-4-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512ufull/SIMD512-4-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SIMD512.c +0 -881
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SnP.h +0 -51
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-on1.c +0 -37
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-on2.c +0 -38
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SIMD512.c +0 -1615
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SnP.h +0 -57
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u12/SIMD512-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u4/SIMD512-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/ua/SIMD512-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-on1.c +0 -37
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-on2.c +0 -38
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-on4.c +0 -38
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-armcc.s +0 -442
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-gcc.s +0 -446
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-armcc.s +0 -419
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-gcc.s +0 -427
- data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-avr8-fast.s +0 -647
- data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-SnP.h +0 -39
- data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-compact.c +0 -190
- data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-SnP.h +0 -43
- data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.c +0 -412
- data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.h +0 -23
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-armcc.s +0 -454
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-gcc.s +0 -458
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-armcc.s +0 -455
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-gcc.s +0 -458
- data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-avr8-fast.s +0 -728
- data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-SnP.h +0 -43
- data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.c +0 -414
- data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.h +0 -23
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-armcc.s +0 -527
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-gcc.s +0 -533
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-armcc.s +0 -528
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-gcc.s +0 -534
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-armcc.s +0 -521
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-gcc.s +0 -527
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-armcc.s +0 -517
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-gcc.s +0 -523
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-armcc.s +0 -550
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-gcc.s +0 -556
- data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-SnP.h +0 -32
- data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-armv8a-neon.s +0 -432
- data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-avr8-fast.s +0 -929
- data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-SnP.h +0 -40
- data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-compact.c +0 -244
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-SnP.h +0 -46
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32-bis.macros +0 -184
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.c +0 -454
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.macros +0 -459
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling-bis.macros +0 -83
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling.macros +0 -88
- data/ext/xkcp/lib/low/KeccakP-800/plain/lcu2/KeccakP-800-opt32-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-800/plain/lcua/KeccakP-800-opt32-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-800/plain/u2/KeccakP-800-opt32-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-800/plain/ua/KeccakP-800-opt32-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-SnP.h +0 -44
- data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.c +0 -437
- data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.h +0 -23
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/Ket.h +0 -57
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-armcc.s +0 -475
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-gcc.s +0 -480
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-armcc.s +0 -590
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-gcc.s +0 -590
- data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.c +0 -126
- data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.h +0 -68
- data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.inc +0 -174
- data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.c +0 -80
- data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.h +0 -68
- data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.inc +0 -142
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-SnP.h +0 -55
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-armcc.s +0 -1086
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-gcc.s +0 -1092
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-armcc.s +0 -721
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-gcc.s +0 -726
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-armcc.s +0 -723
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-gcc.s +0 -729
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-armcc.s +0 -1164
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-gcc.s +0 -1165
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-armcc.s +0 -562
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-gcc.s +0 -563
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-armcc.s +0 -563
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-gcc.s +0 -565
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-SnP.h +0 -55
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-armcc.s +0 -476
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-gcc.s +0 -485
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-armcc.s +0 -362
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-gcc.s +0 -367
- data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-SnP.h +0 -43
- data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-avr8-u1.s +0 -1341
- data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SIMD512.c +0 -581
- data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SnP.h +0 -58
- data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodyak-full-block-SIMD512.c +0 -332
- data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SIMD128.c +0 -329
- data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SnP.h +0 -53
- data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodyak-full-block-SIMD128.c +0 -355
- data/ext/xkcp/lib/low/Xoodoo/Xoodoo.h +0 -79
- data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-SnP.h +0 -56
- data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-optimized.c +0 -399
- data/ext/xkcp/lib/low/Xoodoo/plain/Xoodyak-full-blocks.c +0 -127
- data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-SnP.h +0 -43
- data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-reference.c +0 -253
- data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SIMD512.c +0 -1044
- data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SnP.h +0 -49
- data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-SnP.h +0 -45
- data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-on1.c +0 -37
- data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-ARMv7A.s +0 -1587
- data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-SnP.h +0 -48
- data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SIMD512.c +0 -1202
- data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SnP.h +0 -48
- data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SIMD128.c +0 -484
- data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SnP.h +0 -44
- data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-SnP.h +0 -45
- data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-on1.c +0 -37
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SIMD256.c +0 -939
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SnP.h +0 -49
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SIMD512.c +0 -1216
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SnP.h +0 -48
- data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-SnP.h +0 -45
- data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-on1.c +0 -37
- data/ext/xkcp/lib/low/common/PlSnP-Fallback.inc +0 -290
- data/ext/xkcp/lib/low/common/SnP-Relaned.h +0 -141
- data/ext/xkcp/support/Kernel-PMU/Kernel-pmu.md +0 -133
- data/ext/xkcp/support/Kernel-PMU/Makefile +0 -8
- data/ext/xkcp/support/Kernel-PMU/enable_arm_pmu.c +0 -129
- data/ext/xkcp/support/Kernel-PMU/load-module +0 -1
- data/ext/xkcp/util/KeccakSum/KeccakSum.c +0 -394
- data/ext/xkcp/util/KeccakSum/base64.c +0 -86
- data/ext/xkcp/util/KeccakSum/base64.h +0 -12
@@ -1,1044 +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
|
-
#include <stdio.h>
|
18
|
-
#include <string.h>
|
19
|
-
#include <smmintrin.h>
|
20
|
-
#include <wmmintrin.h>
|
21
|
-
#include <immintrin.h>
|
22
|
-
#include <emmintrin.h>
|
23
|
-
#include "align.h"
|
24
|
-
#include "brg_endian.h"
|
25
|
-
#include "Xoodoo.h"
|
26
|
-
#include "Xoodoo-times16-SnP.h"
|
27
|
-
|
28
|
-
#if (PLATFORM_BYTE_ORDER != IS_LITTLE_ENDIAN)
|
29
|
-
#error Expecting a little-endian platform
|
30
|
-
#endif
|
31
|
-
|
32
|
-
/* #define SIMULATE_AVX512 */
|
33
|
-
|
34
|
-
#define VERBOSE 0
|
35
|
-
|
36
|
-
#if defined(SIMULATE_AVX512)
|
37
|
-
|
38
|
-
typedef struct
|
39
|
-
{
|
40
|
-
uint32_t x[16];
|
41
|
-
} __m512i;
|
42
|
-
|
43
|
-
static void _mm512_mask_store_epi64(void *mem_addr, uint8_t k, __m512i a)
|
44
|
-
{
|
45
|
-
uint64_t *p64 = (uint64_t *)mem_addr;
|
46
|
-
unsigned int i;
|
47
|
-
|
48
|
-
for ( i = 0; i < 8; ++i ) {
|
49
|
-
if ((k & (1 << i)) != 0)
|
50
|
-
p64[i] = (uint64_t)a.x[2*i] | ((uint64_t)a.x[2*i+1] << 32);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
static __m512i _mm512_maskz_load_epi64(uint8_t k, const void *mem_addr)
|
55
|
-
{
|
56
|
-
__m512i r;
|
57
|
-
const uint64_t *p64 = (const uint64_t *)mem_addr;
|
58
|
-
unsigned int i;
|
59
|
-
|
60
|
-
for ( i = 0; i < 8; ++i ) {
|
61
|
-
if ((k & (1 << i)) != 0) {
|
62
|
-
r.x[2*i] = (uint32_t)p64[i];
|
63
|
-
r.x[2*i+1] = (uint32_t)(p64[i] >> 32);
|
64
|
-
}
|
65
|
-
else {
|
66
|
-
r.x[2*i] = 0;
|
67
|
-
r.x[2*i+1] = 0;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
return(r);
|
71
|
-
}
|
72
|
-
|
73
|
-
static void _mm512_storeu_si512(__m512i * mem_addr, __m512i a)
|
74
|
-
{
|
75
|
-
uint32_t *p32 = (uint32_t *)mem_addr;
|
76
|
-
unsigned int i;
|
77
|
-
|
78
|
-
for ( i = 0; i < 16; ++i )
|
79
|
-
p32[i] = a.x[i];
|
80
|
-
}
|
81
|
-
|
82
|
-
#define _mm512_store_si512 _mm512_storeu_si512
|
83
|
-
|
84
|
-
static __m512i _mm512_loadu_si512(const __m512i * mem_addr)
|
85
|
-
{
|
86
|
-
__m512i r;
|
87
|
-
const uint32_t *p32 = (const uint32_t *)mem_addr;
|
88
|
-
unsigned int i;
|
89
|
-
|
90
|
-
for ( i = 0; i < 16; ++i )
|
91
|
-
r.x[i] = p32[i];
|
92
|
-
return(r);
|
93
|
-
}
|
94
|
-
|
95
|
-
#define _mm512_load_si512 _mm512_loadu_si512
|
96
|
-
|
97
|
-
static __m512i _mm512_setzero_si512(void)
|
98
|
-
{
|
99
|
-
__m512i r;
|
100
|
-
unsigned int i;
|
101
|
-
|
102
|
-
for ( i = 0; i < 16; ++i )
|
103
|
-
r.x[i] = 0;
|
104
|
-
return(r);
|
105
|
-
}
|
106
|
-
|
107
|
-
static __m512i _mm512_xor_si512( __m512i a, __m512i b)
|
108
|
-
{
|
109
|
-
__m512i r;
|
110
|
-
unsigned int i;
|
111
|
-
|
112
|
-
for ( i = 0; i < 16; ++i )
|
113
|
-
r.x[i] = a.x[i] ^ b.x[i];
|
114
|
-
return(r);
|
115
|
-
}
|
116
|
-
|
117
|
-
static __m512i _mm512_and_si512( __m512i a, __m512i b)
|
118
|
-
{
|
119
|
-
__m512i r;
|
120
|
-
unsigned int i;
|
121
|
-
|
122
|
-
for ( i = 0; i < 16; ++i )
|
123
|
-
r.x[i] = a.x[i] & b.x[i];
|
124
|
-
return(r);
|
125
|
-
}
|
126
|
-
|
127
|
-
static __m512i _mm512_ternarylogic_epi32(__m512i a, __m512i b, __m512i c, int imm)
|
128
|
-
{
|
129
|
-
|
130
|
-
if (imm == 0x96)
|
131
|
-
return ( _mm512_xor_si512( _mm512_xor_si512( a, b ), c ) );
|
132
|
-
if (imm == 0xD2) {
|
133
|
-
__m512i t;
|
134
|
-
unsigned int i;
|
135
|
-
|
136
|
-
for ( i = 0; i < 16; ++i )
|
137
|
-
t.x[i] = ~b.x[i] & c.x[i];
|
138
|
-
return ( _mm512_xor_si512( a, t ) );
|
139
|
-
}
|
140
|
-
printf( "_mm512_ternarylogic_epi64( a, b, c, %02X) not implemented!\n", imm );
|
141
|
-
exit(1);
|
142
|
-
|
143
|
-
}
|
144
|
-
|
145
|
-
static __m512i _mm512_rol_epi32(__m512i a, int offset)
|
146
|
-
{
|
147
|
-
__m512i r;
|
148
|
-
unsigned int i;
|
149
|
-
|
150
|
-
for ( i = 0; i < 16; ++i )
|
151
|
-
r.x[i] = (a.x[i] << offset) | (a.x[i] >> (32-offset));
|
152
|
-
return(r);
|
153
|
-
}
|
154
|
-
|
155
|
-
static __m512i _mm512_slli_epi32(__m512i a, int offset)
|
156
|
-
{
|
157
|
-
__m512i r;
|
158
|
-
unsigned int i;
|
159
|
-
|
160
|
-
for ( i = 0; i < 16; ++i )
|
161
|
-
r.x[i] = (a.x[i] << offset);
|
162
|
-
return(r);
|
163
|
-
}
|
164
|
-
|
165
|
-
static __m512i _mm512_set1_epi32(uint32_t a)
|
166
|
-
{
|
167
|
-
unsigned int i;
|
168
|
-
__m512i r;
|
169
|
-
|
170
|
-
for ( i = 0; i < 16; ++i )
|
171
|
-
r.x[i] = a;
|
172
|
-
return(r);
|
173
|
-
}
|
174
|
-
|
175
|
-
static __m512i _mm512_i32gather_epi32(__m512i idx, const void *p, int scale)
|
176
|
-
{
|
177
|
-
__m512i r;
|
178
|
-
unsigned int i;
|
179
|
-
for ( i = 0; i < 16; ++i )
|
180
|
-
r.x[i] = *(const uint32_t*)((const char*)p + idx.x[i] * scale);
|
181
|
-
return(r);
|
182
|
-
}
|
183
|
-
|
184
|
-
static void _mm512_i32scatter_epi32( void *p, __m512i idx, __m512i value, int scale)
|
185
|
-
{
|
186
|
-
unsigned int i;
|
187
|
-
for ( i = 0; i < 16; ++i )
|
188
|
-
*(uint32_t*)((char*)p + idx.x[i] * scale) = value.x[i];
|
189
|
-
}
|
190
|
-
|
191
|
-
static void _mm512_mask_i32scatter_epi32( void *p, uint16_t k, __m512i idx, __m512i value, int scale)
|
192
|
-
{
|
193
|
-
unsigned int i;
|
194
|
-
for ( i = 0; i < 16; ++i ) {
|
195
|
-
if ((k & (1 << i)) != 0)
|
196
|
-
*(uint32_t*)((char*)p + idx.x[i] * scale) = value.x[i];
|
197
|
-
}
|
198
|
-
}
|
199
|
-
|
200
|
-
static __m512i _mm512_setr_epi32( int e15, int e14, int e13, int e12, int e11, int e10, int e9, int e8,
|
201
|
-
int e7, int e6, int e5, int e4, int e3, int e2, int ee1, int ee0)
|
202
|
-
{
|
203
|
-
__m512i r;
|
204
|
-
|
205
|
-
r.x[ 0] = e15;
|
206
|
-
r.x[ 1] = e14;
|
207
|
-
r.x[ 2] = e13;
|
208
|
-
r.x[ 3] = e12;
|
209
|
-
r.x[ 4] = e11;
|
210
|
-
r.x[ 5] = e10;
|
211
|
-
r.x[ 6] = e9;
|
212
|
-
r.x[ 7] = e8;
|
213
|
-
r.x[ 8] = e7;
|
214
|
-
r.x[ 9] = e6;
|
215
|
-
r.x[10] = e5;
|
216
|
-
r.x[11] = e4;
|
217
|
-
r.x[12] = e3;
|
218
|
-
r.x[13] = e2;
|
219
|
-
r.x[14] = ee1;
|
220
|
-
r.x[15] = ee0;
|
221
|
-
return(r);
|
222
|
-
}
|
223
|
-
|
224
|
-
static __m512i _mm512_permutex2var_epi32(__m512i a, __m512i idx, __m512i b)
|
225
|
-
{
|
226
|
-
__m512i r;
|
227
|
-
unsigned int i;
|
228
|
-
for ( i = 0; i < 16; ++i )
|
229
|
-
r.x[i] = (idx.x[i] & 0x10) ? b.x[idx.x[i] & 0x0F] : a.x[idx.x[i] & 0x0F];
|
230
|
-
return(r);
|
231
|
-
}
|
232
|
-
|
233
|
-
static __m512i _mm512_permutexvar_epi32(__m512i idx, __m512i a)
|
234
|
-
{
|
235
|
-
__m512i r;
|
236
|
-
unsigned int i;
|
237
|
-
for ( i = 0; i < 16; ++i )
|
238
|
-
r.x[i] = a.x[idx.x[i]];
|
239
|
-
return(r);
|
240
|
-
}
|
241
|
-
|
242
|
-
#endif
|
243
|
-
|
244
|
-
typedef __m128i V128;
|
245
|
-
typedef __m256i V256;
|
246
|
-
typedef __m512i V512;
|
247
|
-
|
248
|
-
#define SnP_laneLengthInBytes 4
|
249
|
-
#define laneIndex(instanceIndex, lanePosition) ((lanePosition)*16 + instanceIndex)
|
250
|
-
|
251
|
-
#define Chi(a,b,c) _mm512_ternarylogic_epi32(a,b,c,0xD2)
|
252
|
-
|
253
|
-
#define CONST16_32(a) _mm512_set1_epi32(a)
|
254
|
-
#define LOAD256u(a) _mm256_loadu_si256((const V256 *)&(a))
|
255
|
-
|
256
|
-
#define LOAD512(a) _mm512_load_si512((const V512 *)&(a))
|
257
|
-
#define LOAD512u(a) _mm512_loadu_si512((const V512 *)&(a))
|
258
|
-
|
259
|
-
#define LOAD_GATHER16_32(idx,p) _mm512_i32gather_epi32(idx, (const void*)(p), 4)
|
260
|
-
#define STORE_SCATTER16_32(idx,a,p) _mm512_i32scatter_epi32((void*)(p), idx, a, 4)
|
261
|
-
|
262
|
-
#define SHUFFLE_LANES_RIGHT(idx, a) _mm512_permutexvar_epi32(idx, a)
|
263
|
-
|
264
|
-
#define ROL32(a, o) _mm512_rol_epi32(a, o)
|
265
|
-
#define SHL32(a, o) _mm512_slli_epi32(a, o)
|
266
|
-
|
267
|
-
#define SET16_32 _mm512_setr_epi32
|
268
|
-
|
269
|
-
#define STORE128(a, b) _mm_store_si128((V128 *)&(a), b)
|
270
|
-
#define STORE128u(a, b) _mm_storeu_si128((V128 *)&(a), b)
|
271
|
-
#define STORE256u(a, b) _mm256_storeu_si256((V256 *)&(a), b)
|
272
|
-
#define STORE512(a, b) _mm512_store_si512((V512 *)&(a), b)
|
273
|
-
#define STORE512u(a, b) _mm512_storeu_si512((V512 *)&(a), b)
|
274
|
-
|
275
|
-
#define AND(a, b) _mm512_and_si512(a, b)
|
276
|
-
#define XOR(a, b) _mm512_xor_si512(a, b)
|
277
|
-
#define XOR3(a,b,c) _mm512_ternarylogic_epi32(a,b,c,0x96)
|
278
|
-
#define XOR256(a, b) _mm256_xor_si256(a, b)
|
279
|
-
#define XOR128(a, b) _mm_xor_si128(a, b)
|
280
|
-
|
281
|
-
|
282
|
-
#ifndef _mm256_storeu2_m128i
|
283
|
-
#define _mm256_storeu2_m128i(hi, lo, a) _mm_storeu_si128((V128*)(lo), _mm256_castsi256_si128(a)), _mm_storeu_si128((V128*)(hi), _mm256_extracti128_si256(a, 1))
|
284
|
-
#endif
|
285
|
-
|
286
|
-
#if (VERBOSE > 0)
|
287
|
-
#define DumpOne(__b,__v,__i) STORE512(__b, __v##__i); \
|
288
|
-
printf("%02u %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", __i, \
|
289
|
-
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15])
|
290
|
-
|
291
|
-
#define Dump(__t,__v) { \
|
292
|
-
uint32_t buf[16]; \
|
293
|
-
printf("%s\n", __t); \
|
294
|
-
DumpOne(buf, __v, 00); \
|
295
|
-
DumpOne(buf, __v, 01); \
|
296
|
-
DumpOne(buf, __v, 02); \
|
297
|
-
DumpOne(buf, __v, 03); \
|
298
|
-
DumpOne(buf, __v, 10); \
|
299
|
-
DumpOne(buf, __v, 11); \
|
300
|
-
DumpOne(buf, __v, 12); \
|
301
|
-
DumpOne(buf, __v, 13); \
|
302
|
-
DumpOne(buf, __v, 20); \
|
303
|
-
DumpOne(buf, __v, 21); \
|
304
|
-
DumpOne(buf, __v, 22); \
|
305
|
-
DumpOne(buf, __v, 23); \
|
306
|
-
}
|
307
|
-
#else
|
308
|
-
#define Dump(__t,__v)
|
309
|
-
#endif
|
310
|
-
|
311
|
-
#if (VERBOSE >= 1)
|
312
|
-
#define Dump1(__t,__v) Dump(__t,__v)
|
313
|
-
#else
|
314
|
-
#define Dump1(__t,__v)
|
315
|
-
#endif
|
316
|
-
|
317
|
-
#if (VERBOSE >= 2)
|
318
|
-
#define Dump2(__t,__v) Dump(__t,__v)
|
319
|
-
#else
|
320
|
-
#define Dump2(__t,__v)
|
321
|
-
#endif
|
322
|
-
|
323
|
-
#if (VERBOSE >= 3)
|
324
|
-
#define Dump3(__t,__v) Dump(__t,__v)
|
325
|
-
#else
|
326
|
-
#define Dump3(__t,__v)
|
327
|
-
#endif
|
328
|
-
|
329
|
-
#if (VERBOSE > 0)
|
330
|
-
#define DUMP32(tt, buf) printf("%s %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", tt, \
|
331
|
-
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15])
|
332
|
-
|
333
|
-
#define DumpLane(__t,__v) { uint32_t buf[16]; \
|
334
|
-
STORE512(buf[0], __v); \
|
335
|
-
printf("%s %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", __t, \
|
336
|
-
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); }
|
337
|
-
|
338
|
-
#else
|
339
|
-
#define DUMP32(__t, buf)
|
340
|
-
#define DumpLane(__t,__v)
|
341
|
-
#endif
|
342
|
-
|
343
|
-
ALIGN(64) static const uint32_t oshuffleR_1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0};
|
344
|
-
ALIGN(64) static const uint32_t oshuffleR_2[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1};
|
345
|
-
ALIGN(64) static const uint32_t oshuffleR_4[] = { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3};
|
346
|
-
|
347
|
-
ALIGN(64) static const uint32_t oAllLow12_0[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16+ 0, 16+ 1, 16+ 2, 16+ 3 };
|
348
|
-
ALIGN(64) static const uint32_t oAllLow11_0[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 16+ 0, 16+ 1, 16+ 2, 16+ 3, 16+ 4 };
|
349
|
-
ALIGN(64) static const uint32_t oAllLow10_0[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16+ 0, 16+ 1, 16+ 2, 16+ 3, 16+ 4, 16+ 5 };
|
350
|
-
|
351
|
-
ALIGN(64) static const uint32_t oAllFrom1_7[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16+ 7 };
|
352
|
-
ALIGN(64) static const uint32_t oAllFrom1_10[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16+10 };
|
353
|
-
ALIGN(64) static const uint32_t oAllFrom1_13[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16+13 };
|
354
|
-
|
355
|
-
ALIGN(64) static const uint32_t oAllFrom1_5[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16+ 5 };
|
356
|
-
ALIGN(64) static const uint32_t oAllFrom1_8[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16+ 8 };
|
357
|
-
ALIGN(64) static const uint32_t oAllFrom1_11[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16+11 };
|
358
|
-
ALIGN(64) static const uint32_t oAllFrom1_14[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16+14 };
|
359
|
-
|
360
|
-
ALIGN(64) static const uint32_t oAllFrom3_4[] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16+ 4, 16+ 5, 16+ 6 };
|
361
|
-
ALIGN(64) static const uint32_t oAllFrom6_4[] = { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16+ 4, 16+ 5, 16+ 6, 16+ 7, 16+ 8, 16+ 9};
|
362
|
-
ALIGN(64) static const uint32_t oAllFrom9_4[] = { 9, 10, 11, 12, 13, 14, 15, 16+ 4, 16+ 5, 16+ 6, 16+ 7, 16+ 8, 16+ 9, 16+10, 16+11, 16+12};
|
363
|
-
|
364
|
-
ALIGN(64) static const uint32_t oLow256[] = { 0, 1, 2, 3, 4, 5, 6, 7, 16+ 0, 16+ 1, 16+ 2, 16+ 3, 16+ 4, 16+ 5, 16+ 6, 16+ 7 };
|
365
|
-
ALIGN(64) static const uint32_t oHigh256[] = { 8, 9, 10, 11, 12, 13, 14, 15, 16+ 8, 16+ 9, 16+10, 16+11, 16+12, 16+13, 16+14, 16+15 };
|
366
|
-
|
367
|
-
ALIGN(64) static const uint32_t oLow128[] = { 0, 1, 2, 3, 16+ 0, 16+ 1, 16+ 2, 16+ 3, 8, 9, 10, 11, 16+ 8, 16+ 9, 16+10, 16+11 };
|
368
|
-
ALIGN(64) static const uint32_t oHigh128[] = { 4, 5, 6, 7, 16+ 4, 16+ 5, 16+ 6, 16+ 7, 12, 13, 14, 15, 16+12, 16+13, 16+14, 16+15 };
|
369
|
-
|
370
|
-
ALIGN(64) static const uint32_t oLow64[] = { 0, 1, 4, 5, 16+ 0, 16+ 1, 16+ 4, 16+ 5, 8, 9, 12, 13, 16+ 8, 16+ 9, 16+12, 16+13 };
|
371
|
-
ALIGN(64) static const uint32_t oHigh64[] = { 2, 3, 6, 7, 16+ 2, 16+ 3, 16+ 6, 16+ 7, 10, 11, 14, 15, 16+10, 16+11, 16+14, 16+15 };
|
372
|
-
|
373
|
-
ALIGN(64) static const uint32_t oLow32[] = { 0, 4, 2, 6, 8, 12, 10, 14, 16+ 0, 16+ 2, 16+ 8, 16+10, 0, 0, 0, 0 };
|
374
|
-
ALIGN(64) static const uint32_t oHigh32[] = { 1, 5, 3, 7, 9, 13, 11, 15, 16+ 1, 16+ 3, 16+ 9, 16+11, 0, 0, 0, 0 };
|
375
|
-
|
376
|
-
|
377
|
-
ALIGN(64) static const uint32_t oGatherScatterOffsets[] = { 0*12, 1*12, 2*12, 3*12, 4*12, 5*12, 6*12, 7*12, 8*12, 9*12, 10*12, 11*12, 12*12, 13*12, 14*12, 15*12 };
|
378
|
-
ALIGN(64) static const uint32_t oGatherScatterOffsetsRoll[] = { 0, 0, 0, 0, 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11 }; /* First 4 are dummies */
|
379
|
-
|
380
|
-
void Xoodootimes16_InitializeAll(void *states)
|
381
|
-
{
|
382
|
-
memset(states, 0, Xoodootimes16_statesSizeInBytes);
|
383
|
-
}
|
384
|
-
|
385
|
-
void Xoodootimes16_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length)
|
386
|
-
{
|
387
|
-
unsigned int sizeLeft = length;
|
388
|
-
unsigned int lanePosition = offset/SnP_laneLengthInBytes;
|
389
|
-
unsigned int offsetInLane = offset%SnP_laneLengthInBytes;
|
390
|
-
const unsigned char *curData = data;
|
391
|
-
uint32_t *statesAsLanes = (uint32_t *)states;
|
392
|
-
|
393
|
-
if ((sizeLeft > 0) && (offsetInLane != 0)) {
|
394
|
-
unsigned int bytesInLane = SnP_laneLengthInBytes - offsetInLane;
|
395
|
-
uint32_t lane = 0;
|
396
|
-
if (bytesInLane > sizeLeft)
|
397
|
-
bytesInLane = sizeLeft;
|
398
|
-
memcpy((unsigned char*)&lane + offsetInLane, curData, bytesInLane);
|
399
|
-
statesAsLanes[laneIndex(instanceIndex, lanePosition)] ^= lane;
|
400
|
-
sizeLeft -= bytesInLane;
|
401
|
-
lanePosition++;
|
402
|
-
curData += bytesInLane;
|
403
|
-
}
|
404
|
-
|
405
|
-
while(sizeLeft >= SnP_laneLengthInBytes) {
|
406
|
-
uint32_t lane = *((const uint32_t*)curData);
|
407
|
-
statesAsLanes[laneIndex(instanceIndex, lanePosition)] ^= lane;
|
408
|
-
sizeLeft -= SnP_laneLengthInBytes;
|
409
|
-
lanePosition++;
|
410
|
-
curData += SnP_laneLengthInBytes;
|
411
|
-
}
|
412
|
-
|
413
|
-
if (sizeLeft > 0) {
|
414
|
-
uint32_t lane = 0;
|
415
|
-
memcpy(&lane, curData, sizeLeft);
|
416
|
-
statesAsLanes[laneIndex(instanceIndex, lanePosition)] ^= lane;
|
417
|
-
}
|
418
|
-
}
|
419
|
-
|
420
|
-
void Xoodootimes16_AddLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
|
421
|
-
{
|
422
|
-
V512 *stateAsLanes = (V512 *)states;
|
423
|
-
unsigned int i;
|
424
|
-
const uint32_t *data32 = (const uint32_t *)data;
|
425
|
-
V512 offsets = SET16_32( 0*laneOffset, 1*laneOffset, 2*laneOffset, 3*laneOffset, 4*laneOffset, 5*laneOffset, 6*laneOffset, 7*laneOffset,
|
426
|
-
8*laneOffset, 9*laneOffset, 10*laneOffset, 11*laneOffset, 12*laneOffset, 13*laneOffset, 14*laneOffset, 15*laneOffset);
|
427
|
-
|
428
|
-
#define Xor_In( argIndex ) stateAsLanes[argIndex] = XOR(stateAsLanes[argIndex], LOAD_GATHER16_32(offsets, &data32[argIndex]))
|
429
|
-
|
430
|
-
if ( laneCount == 12 ) {
|
431
|
-
Xor_In( 0 );
|
432
|
-
Xor_In( 1 );
|
433
|
-
Xor_In( 2 );
|
434
|
-
Xor_In( 3 );
|
435
|
-
Xor_In( 4 );
|
436
|
-
Xor_In( 5 );
|
437
|
-
Xor_In( 6 );
|
438
|
-
Xor_In( 7 );
|
439
|
-
Xor_In( 8 );
|
440
|
-
Xor_In( 9 );
|
441
|
-
Xor_In( 10 );
|
442
|
-
Xor_In( 11 );
|
443
|
-
}
|
444
|
-
else {
|
445
|
-
for(i=0; i<laneCount; i++)
|
446
|
-
Xor_In( i );
|
447
|
-
}
|
448
|
-
#undef Xor_In
|
449
|
-
}
|
450
|
-
|
451
|
-
void Xoodootimes16_OverwriteBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length)
|
452
|
-
{
|
453
|
-
unsigned int sizeLeft = length;
|
454
|
-
unsigned int lanePosition = offset/SnP_laneLengthInBytes;
|
455
|
-
unsigned int offsetInLane = offset%SnP_laneLengthInBytes;
|
456
|
-
const unsigned char *curData = data;
|
457
|
-
uint32_t *statesAsLanes = (uint32_t *)states;
|
458
|
-
|
459
|
-
if ((sizeLeft > 0) && (offsetInLane != 0)) {
|
460
|
-
unsigned int bytesInLane = SnP_laneLengthInBytes - offsetInLane;
|
461
|
-
if (bytesInLane > sizeLeft)
|
462
|
-
bytesInLane = sizeLeft;
|
463
|
-
memcpy( ((unsigned char *)&statesAsLanes[laneIndex(instanceIndex, lanePosition)]) + offsetInLane, curData, bytesInLane);
|
464
|
-
sizeLeft -= bytesInLane;
|
465
|
-
lanePosition++;
|
466
|
-
curData += bytesInLane;
|
467
|
-
}
|
468
|
-
|
469
|
-
while(sizeLeft >= SnP_laneLengthInBytes) {
|
470
|
-
uint32_t lane = *((const uint32_t*)curData);
|
471
|
-
statesAsLanes[laneIndex(instanceIndex, lanePosition)] = lane;
|
472
|
-
sizeLeft -= SnP_laneLengthInBytes;
|
473
|
-
lanePosition++;
|
474
|
-
curData += SnP_laneLengthInBytes;
|
475
|
-
}
|
476
|
-
|
477
|
-
if (sizeLeft > 0) {
|
478
|
-
memcpy(&statesAsLanes[laneIndex(instanceIndex, lanePosition)], curData, sizeLeft);
|
479
|
-
}
|
480
|
-
}
|
481
|
-
|
482
|
-
void Xoodootimes16_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
|
483
|
-
{
|
484
|
-
V512 *stateAsLanes = (V512 *)states;
|
485
|
-
unsigned int i;
|
486
|
-
const uint32_t *data32 = (const uint32_t *)data;
|
487
|
-
V512 offsets = SET16_32( 0*laneOffset, 1*laneOffset, 2*laneOffset, 3*laneOffset, 4*laneOffset, 5*laneOffset, 6*laneOffset, 7*laneOffset,
|
488
|
-
8*laneOffset, 9*laneOffset, 10*laneOffset, 11*laneOffset, 12*laneOffset, 13*laneOffset, 14*laneOffset, 15*laneOffset);
|
489
|
-
|
490
|
-
#define OverWr( argIndex ) stateAsLanes[argIndex] = LOAD_GATHER16_32(offsets, &data32[argIndex])
|
491
|
-
|
492
|
-
if ( laneCount == 12 ) {
|
493
|
-
OverWr( 0 );
|
494
|
-
OverWr( 1 );
|
495
|
-
OverWr( 2 );
|
496
|
-
OverWr( 3 );
|
497
|
-
OverWr( 4 );
|
498
|
-
OverWr( 5 );
|
499
|
-
OverWr( 6 );
|
500
|
-
OverWr( 7 );
|
501
|
-
OverWr( 8 );
|
502
|
-
OverWr( 9 );
|
503
|
-
OverWr( 10 );
|
504
|
-
OverWr( 11 );
|
505
|
-
}
|
506
|
-
else {
|
507
|
-
for(i=0; i<laneCount; i++)
|
508
|
-
OverWr( i );
|
509
|
-
}
|
510
|
-
#undef OverWr
|
511
|
-
}
|
512
|
-
|
513
|
-
void Xoodootimes16_OverwriteWithZeroes(void *states, unsigned int instanceIndex, unsigned int byteCount)
|
514
|
-
{
|
515
|
-
unsigned int sizeLeft = byteCount;
|
516
|
-
unsigned int lanePosition = 0;
|
517
|
-
uint32_t *statesAsLanes = (uint32_t *)states;
|
518
|
-
|
519
|
-
while(sizeLeft >= SnP_laneLengthInBytes) {
|
520
|
-
statesAsLanes[laneIndex(instanceIndex, lanePosition)] = 0;
|
521
|
-
sizeLeft -= SnP_laneLengthInBytes;
|
522
|
-
lanePosition++;
|
523
|
-
}
|
524
|
-
|
525
|
-
if (sizeLeft > 0) {
|
526
|
-
memset(&statesAsLanes[laneIndex(instanceIndex, lanePosition)], 0, sizeLeft);
|
527
|
-
}
|
528
|
-
}
|
529
|
-
|
530
|
-
void Xoodootimes16_ExtractBytes(const void *states, unsigned int instanceIndex, unsigned char *data, unsigned int offset, unsigned int length)
|
531
|
-
{
|
532
|
-
unsigned int sizeLeft = length;
|
533
|
-
unsigned int lanePosition = offset/SnP_laneLengthInBytes;
|
534
|
-
unsigned int offsetInLane = offset%SnP_laneLengthInBytes;
|
535
|
-
unsigned char *curData = data;
|
536
|
-
const uint32_t *statesAsLanes = (const uint32_t *)states;
|
537
|
-
|
538
|
-
if ((sizeLeft > 0) && (offsetInLane != 0)) {
|
539
|
-
unsigned int bytesInLane = SnP_laneLengthInBytes - offsetInLane;
|
540
|
-
if (bytesInLane > sizeLeft)
|
541
|
-
bytesInLane = sizeLeft;
|
542
|
-
memcpy( curData, ((unsigned char *)&statesAsLanes[laneIndex(instanceIndex, lanePosition)]) + offsetInLane, bytesInLane);
|
543
|
-
sizeLeft -= bytesInLane;
|
544
|
-
lanePosition++;
|
545
|
-
curData += bytesInLane;
|
546
|
-
}
|
547
|
-
|
548
|
-
while(sizeLeft >= SnP_laneLengthInBytes) {
|
549
|
-
*(uint32_t*)curData = statesAsLanes[laneIndex(instanceIndex, lanePosition)];
|
550
|
-
sizeLeft -= SnP_laneLengthInBytes;
|
551
|
-
lanePosition++;
|
552
|
-
curData += SnP_laneLengthInBytes;
|
553
|
-
}
|
554
|
-
|
555
|
-
if (sizeLeft > 0) {
|
556
|
-
memcpy( curData, &statesAsLanes[laneIndex(instanceIndex, lanePosition)], sizeLeft);
|
557
|
-
}
|
558
|
-
}
|
559
|
-
|
560
|
-
void Xoodootimes16_ExtractLanesAll(const void *states, unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
|
561
|
-
{
|
562
|
-
const V512 *stateAsLanes = (const V512 *)states;
|
563
|
-
unsigned int i;
|
564
|
-
uint32_t *data32 = (uint32_t *)data;
|
565
|
-
V512 offsets = SET16_32( 0*laneOffset, 1*laneOffset, 2*laneOffset, 3*laneOffset, 4*laneOffset, 5*laneOffset, 6*laneOffset, 7*laneOffset,
|
566
|
-
8*laneOffset, 9*laneOffset, 10*laneOffset, 11*laneOffset, 12*laneOffset, 13*laneOffset, 14*laneOffset, 15*laneOffset);
|
567
|
-
|
568
|
-
#define Extr( argIndex ) STORE_SCATTER16_32(offsets, stateAsLanes[argIndex], &data32[argIndex])
|
569
|
-
|
570
|
-
if ( laneCount == 12 ) {
|
571
|
-
Extr( 0 );
|
572
|
-
Extr( 1 );
|
573
|
-
Extr( 2 );
|
574
|
-
Extr( 3 );
|
575
|
-
Extr( 4 );
|
576
|
-
Extr( 5 );
|
577
|
-
Extr( 6 );
|
578
|
-
Extr( 7 );
|
579
|
-
Extr( 8 );
|
580
|
-
Extr( 9 );
|
581
|
-
Extr( 10 );
|
582
|
-
Extr( 11 );
|
583
|
-
}
|
584
|
-
else {
|
585
|
-
for(i=0; i<laneCount; i++)
|
586
|
-
Extr( i );
|
587
|
-
}
|
588
|
-
#undef Extr
|
589
|
-
}
|
590
|
-
|
591
|
-
void Xoodootimes16_ExtractAndAddBytes(const void *states, unsigned int instanceIndex, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
|
592
|
-
{
|
593
|
-
unsigned int sizeLeft = length;
|
594
|
-
unsigned int lanePosition = offset/SnP_laneLengthInBytes;
|
595
|
-
unsigned int offsetInLane = offset%SnP_laneLengthInBytes;
|
596
|
-
const unsigned char *curInput = input;
|
597
|
-
unsigned char *curOutput = output;
|
598
|
-
const uint32_t *statesAsLanes = (const uint32_t *)states;
|
599
|
-
|
600
|
-
if ((sizeLeft > 0) && (offsetInLane != 0)) {
|
601
|
-
unsigned int bytesInLane = SnP_laneLengthInBytes - offsetInLane;
|
602
|
-
uint32_t lane = statesAsLanes[laneIndex(instanceIndex, lanePosition)] >> (8 * offsetInLane);
|
603
|
-
if (bytesInLane > sizeLeft)
|
604
|
-
bytesInLane = sizeLeft;
|
605
|
-
sizeLeft -= bytesInLane;
|
606
|
-
do {
|
607
|
-
*(curOutput++) = *(curInput++) ^ (unsigned char)lane;
|
608
|
-
lane >>= 8;
|
609
|
-
} while ( --bytesInLane != 0);
|
610
|
-
lanePosition++;
|
611
|
-
}
|
612
|
-
|
613
|
-
while(sizeLeft >= SnP_laneLengthInBytes) {
|
614
|
-
*((uint32_t*)curOutput) = *((uint32_t*)curInput) ^ statesAsLanes[laneIndex(instanceIndex, lanePosition)];
|
615
|
-
sizeLeft -= SnP_laneLengthInBytes;
|
616
|
-
lanePosition++;
|
617
|
-
curInput += SnP_laneLengthInBytes;
|
618
|
-
curOutput += SnP_laneLengthInBytes;
|
619
|
-
}
|
620
|
-
|
621
|
-
if (sizeLeft != 0) {
|
622
|
-
uint32_t lane = statesAsLanes[laneIndex(instanceIndex, lanePosition)];
|
623
|
-
do {
|
624
|
-
*(curOutput++) = *(curInput++) ^ (unsigned char)lane;
|
625
|
-
lane >>= 8;
|
626
|
-
} while ( --sizeLeft != 0);
|
627
|
-
}
|
628
|
-
}
|
629
|
-
|
630
|
-
void Xoodootimes16_ExtractAndAddLanesAll(const void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset)
|
631
|
-
{
|
632
|
-
const V512 *stateAsLanes = (const V512 *)states;
|
633
|
-
unsigned int i;
|
634
|
-
const uint32_t *datai32 = (const uint32_t *)input;
|
635
|
-
uint32_t *datao32 = (uint32_t *)output;
|
636
|
-
V512 offsets = SET16_32( 0*laneOffset, 1*laneOffset, 2*laneOffset, 3*laneOffset, 4*laneOffset, 5*laneOffset, 6*laneOffset, 7*laneOffset,
|
637
|
-
8*laneOffset, 9*laneOffset, 10*laneOffset, 11*laneOffset, 12*laneOffset, 13*laneOffset, 14*laneOffset, 15*laneOffset);
|
638
|
-
|
639
|
-
#define ExtrXor( argIndex ) STORE_SCATTER16_32(offsets, XOR( stateAsLanes[argIndex], LOAD_GATHER16_32(offsets, &datai32[argIndex])), &datao32[argIndex])
|
640
|
-
|
641
|
-
if ( laneCount == 12 ) {
|
642
|
-
ExtrXor( 0 );
|
643
|
-
ExtrXor( 1 );
|
644
|
-
ExtrXor( 2 );
|
645
|
-
ExtrXor( 3 );
|
646
|
-
ExtrXor( 4 );
|
647
|
-
ExtrXor( 5 );
|
648
|
-
ExtrXor( 6 );
|
649
|
-
ExtrXor( 7 );
|
650
|
-
ExtrXor( 8 );
|
651
|
-
ExtrXor( 9 );
|
652
|
-
ExtrXor( 10 );
|
653
|
-
ExtrXor( 11 );
|
654
|
-
}
|
655
|
-
else {
|
656
|
-
for(i=0; i<laneCount; i++)
|
657
|
-
ExtrXor( i );
|
658
|
-
}
|
659
|
-
#undef ExtrXor
|
660
|
-
}
|
661
|
-
|
662
|
-
#define DeclareVars V512 a00, a01, a02, a03; \
|
663
|
-
V512 a10, a11, a12, a13; \
|
664
|
-
V512 a20, a21, a22, a23; \
|
665
|
-
V512 v1, v2;
|
666
|
-
|
667
|
-
#define State2Vars2 a00 = states[0], a01 = states[1], a02 = states[ 2], a03 = states[ 3]; \
|
668
|
-
a12 = states[4], a13 = states[5], a10 = states[ 6], a11 = states[ 7]; \
|
669
|
-
a20 = states[8], a21 = states[9], a22 = states[10], a23 = states[11]
|
670
|
-
|
671
|
-
#define State2Vars a00 = states[0], a01 = states[1], a02 = states[ 2], a03 = states[ 3]; \
|
672
|
-
a10 = states[4], a11 = states[5], a12 = states[ 6], a13 = states[ 7]; \
|
673
|
-
a20 = states[8], a21 = states[9], a22 = states[10], a23 = states[11]
|
674
|
-
|
675
|
-
#define Vars2State states[0] = a00, states[1] = a01, states[ 2] = a02, states[ 3] = a03; \
|
676
|
-
states[4] = a10, states[5] = a11, states[ 6] = a12, states[ 7] = a13; \
|
677
|
-
states[8] = a20, states[9] = a21, states[10] = a22, states[11] = a23
|
678
|
-
|
679
|
-
#define Round(a10i, a11i, a12i, a13i, a10w, a11w, a12w, a13w, a20i, a21i, a22i, a23i, __rc) \
|
680
|
-
\
|
681
|
-
/* Theta: Column Parity Mixer */ \
|
682
|
-
/* Iota: round constants */ \
|
683
|
-
v1 = XOR3( a03, a13i, a23i ); \
|
684
|
-
v2 = XOR3( a00, a10i, a20i ); \
|
685
|
-
v1 = XOR( ROL32(v1, 5), ROL32(v1, 14) ); \
|
686
|
-
a00 = XOR3( a00, v1, CONST16_32(__rc) ); /* Iota */ \
|
687
|
-
a10i = XOR( a10i, v1 ); \
|
688
|
-
a20i = XOR( a20i, v1 ); \
|
689
|
-
v1 = XOR3( a01, a11i, a21i ); \
|
690
|
-
v2 = XOR( ROL32(v2, 5), ROL32(v2, 14) ); \
|
691
|
-
a01 = XOR( a01, v2 ); \
|
692
|
-
a11i = XOR( a11i, v2 ); \
|
693
|
-
a21i = XOR( a21i, v2 ); \
|
694
|
-
v2 = XOR3( a02, a12i, a22i ); \
|
695
|
-
v1 = XOR( ROL32(v1, 5), ROL32(v1, 14) ); \
|
696
|
-
a02 = XOR( a02, v1 ); \
|
697
|
-
a12i = XOR( a12i, v1 ); \
|
698
|
-
a22i = XOR( a22i, v1 ); \
|
699
|
-
v2 = XOR( ROL32(v2, 5), ROL32(v2, 14) ); \
|
700
|
-
a03 = XOR( a03, v2 ); \
|
701
|
-
a13i = XOR( a13i, v2 ); \
|
702
|
-
a23i = XOR( a23i, v2 ); \
|
703
|
-
Dump3("Theta",a); \
|
704
|
-
\
|
705
|
-
/* Rho-west: Plane shift */ \
|
706
|
-
a20i = ROL32(a20i, 11); \
|
707
|
-
a21i = ROL32(a21i, 11); \
|
708
|
-
a22i = ROL32(a22i, 11); \
|
709
|
-
a23i = ROL32(a23i, 11); \
|
710
|
-
Dump3("Rho-west",a); \
|
711
|
-
\
|
712
|
-
/* Chi: non linear step, on colums */ \
|
713
|
-
a00 = Chi(a00, a10w, a20i); \
|
714
|
-
a01 = Chi(a01, a11w, a21i); \
|
715
|
-
a02 = Chi(a02, a12w, a22i); \
|
716
|
-
a03 = Chi(a03, a13w, a23i); \
|
717
|
-
a10w = Chi(a10w, a20i, a00); \
|
718
|
-
a11w = Chi(a11w, a21i, a01); \
|
719
|
-
a12w = Chi(a12w, a22i, a02); \
|
720
|
-
a13w = Chi(a13w, a23i, a03); \
|
721
|
-
a20i = Chi(a20i, a00, a10w); \
|
722
|
-
a21i = Chi(a21i, a01, a11w); \
|
723
|
-
a22i = Chi(a22i, a02, a12w); \
|
724
|
-
a23i = Chi(a23i, a03, a13w); \
|
725
|
-
Dump3("Chi",a); \
|
726
|
-
\
|
727
|
-
/* Rho-east: Plane shift */ \
|
728
|
-
a10w = ROL32(a10w, 1); \
|
729
|
-
a11w = ROL32(a11w, 1); \
|
730
|
-
a12w = ROL32(a12w, 1); \
|
731
|
-
a13w = ROL32(a13w, 1); \
|
732
|
-
a20i = ROL32(a20i, 8); \
|
733
|
-
a21i = ROL32(a21i, 8); \
|
734
|
-
a22i = ROL32(a22i, 8); \
|
735
|
-
a23i = ROL32(a23i, 8); \
|
736
|
-
Dump3("Rho-east",a)
|
737
|
-
|
738
|
-
void Xoodootimes16_PermuteAll_6rounds(void *argstates)
|
739
|
-
{
|
740
|
-
V512 * states = (V512 *)argstates;
|
741
|
-
DeclareVars;
|
742
|
-
|
743
|
-
State2Vars2;
|
744
|
-
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc6 );
|
745
|
-
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc5 );
|
746
|
-
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc4 );
|
747
|
-
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc3 );
|
748
|
-
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc2 );
|
749
|
-
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc1 );
|
750
|
-
Dump2("Permutation\n", a);
|
751
|
-
Vars2State;
|
752
|
-
}
|
753
|
-
|
754
|
-
void Xoodootimes16_PermuteAll_12rounds(void *argstates)
|
755
|
-
{
|
756
|
-
V512 * states = (V512 *)argstates;
|
757
|
-
DeclareVars;
|
758
|
-
|
759
|
-
State2Vars;
|
760
|
-
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc12 );
|
761
|
-
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc11 );
|
762
|
-
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc10 );
|
763
|
-
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc9 );
|
764
|
-
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc8 );
|
765
|
-
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc7 );
|
766
|
-
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc6 );
|
767
|
-
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc5 );
|
768
|
-
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc4 );
|
769
|
-
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc3 );
|
770
|
-
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc2 );
|
771
|
-
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc1 );
|
772
|
-
Dump2("Permutation\n", a);
|
773
|
-
Vars2State;
|
774
|
-
}
|
775
|
-
|
776
|
-
void Xooffftimes16_AddIs(unsigned char *output, const unsigned char *input, size_t bitLen)
|
777
|
-
{
|
778
|
-
size_t byteLen = bitLen / 8;
|
779
|
-
V512 lanes1, lanes2, lanes3, lanes4;
|
780
|
-
V256 lanesA, lanesB;
|
781
|
-
|
782
|
-
while ( byteLen >= 128 ) {
|
783
|
-
lanes1 = LOAD512u(input[ 0]);
|
784
|
-
lanes2 = LOAD512u(input[64]);
|
785
|
-
lanes3 = LOAD512u(output[ 0]);
|
786
|
-
lanes4 = LOAD512u(output[64]);
|
787
|
-
lanes1 = XOR(lanes1, lanes3);
|
788
|
-
lanes2 = XOR(lanes2, lanes4);
|
789
|
-
STORE512u(output[ 0], lanes1);
|
790
|
-
STORE512u(output[64], lanes2);
|
791
|
-
input += 128;
|
792
|
-
output += 128;
|
793
|
-
byteLen -= 128;
|
794
|
-
}
|
795
|
-
while ( byteLen >= 32 ) {
|
796
|
-
lanesA = LOAD256u(input[0]);
|
797
|
-
lanesB = LOAD256u(output[0]);
|
798
|
-
input += 32;
|
799
|
-
lanesA = XOR256(lanesA, lanesB);
|
800
|
-
byteLen -= 32;
|
801
|
-
STORE256u(output[0], lanesA);
|
802
|
-
output += 32;
|
803
|
-
}
|
804
|
-
while ( byteLen >= 8 ) {
|
805
|
-
*((uint64_t*)output) ^= *((uint64_t*)input);
|
806
|
-
input += 8;
|
807
|
-
output += 8;
|
808
|
-
byteLen -= 8;
|
809
|
-
}
|
810
|
-
while ( byteLen-- != 0 ) {
|
811
|
-
*output++ ^= *input++;
|
812
|
-
}
|
813
|
-
|
814
|
-
bitLen &= 7;
|
815
|
-
if (bitLen != 0)
|
816
|
-
{
|
817
|
-
*output ^= *input;
|
818
|
-
*output &= (1 << bitLen) - 1;
|
819
|
-
}
|
820
|
-
}
|
821
|
-
|
822
|
-
size_t Xooffftimes16_CompressFastLoop(unsigned char *k, unsigned char *x, const unsigned char *input, size_t length)
|
823
|
-
{
|
824
|
-
DeclareVars;
|
825
|
-
uint32_t *k32 = (uint32_t*)k;
|
826
|
-
uint32_t *x32 = (uint32_t*)x;
|
827
|
-
uint32_t *i32 = (uint32_t*)input;
|
828
|
-
size_t initialLength;
|
829
|
-
V512 rCGKDHLEIcgkdhlei;
|
830
|
-
V512 offsets;
|
831
|
-
V512 x00, x01, x02, x03, x10, x11, x12, x13, x20, x21, x22, x23;
|
832
|
-
|
833
|
-
DUMP32("k32",k32);
|
834
|
-
rCGKDHLEIcgkdhlei = LOAD_GATHER16_32(*(const V512*)oGatherScatterOffsetsRoll, k32);
|
835
|
-
offsets = *(V512*)oGatherScatterOffsets;
|
836
|
-
|
837
|
-
x00 = _mm512_setzero_si512();
|
838
|
-
x01 = _mm512_setzero_si512();
|
839
|
-
x02 = _mm512_setzero_si512();
|
840
|
-
x03 = _mm512_setzero_si512();
|
841
|
-
x10 = _mm512_setzero_si512();
|
842
|
-
x11 = _mm512_setzero_si512();
|
843
|
-
x12 = _mm512_setzero_si512();
|
844
|
-
x13 = _mm512_setzero_si512();
|
845
|
-
x20 = _mm512_setzero_si512();
|
846
|
-
x21 = _mm512_setzero_si512();
|
847
|
-
x22 = _mm512_setzero_si512();
|
848
|
-
x23 = _mm512_setzero_si512();
|
849
|
-
initialLength = length;
|
850
|
-
do {
|
851
|
-
/* a10 - a12 and a11 - a13 are swapped */
|
852
|
-
a00 = SHUFFLE_LANES_RIGHT(*(const V512*)oshuffleR_4, rCGKDHLEIcgkdhlei);
|
853
|
-
a12 = SHUFFLE_LANES_RIGHT(*(const V512*)oshuffleR_1, a00);
|
854
|
-
rCGKDHLEIcgkdhlei = XOR3(a00, SHL32(a00, 13), ROL32(a12, 3)); /* only lanes 0 - A are ok */
|
855
|
-
|
856
|
-
a00 = _mm512_permutex2var_epi32(a00, *(const V512*)oAllLow12_0, rCGKDHLEIcgkdhlei);
|
857
|
-
a12 = _mm512_permutex2var_epi32(a12, *(const V512*)oAllLow11_0, rCGKDHLEIcgkdhlei);
|
858
|
-
rCGKDHLEIcgkdhlei = XOR3(a00, SHL32(a00, 13), ROL32(a12, 3)); /* All lanes are ok */
|
859
|
-
DumpLane("rCGKD", rCGKDHLEIcgkdhlei);
|
860
|
-
|
861
|
-
a01 = _mm512_permutex2var_epi32(a00, *(const V512*)oAllFrom3_4, rCGKDHLEIcgkdhlei);
|
862
|
-
a02 = _mm512_permutex2var_epi32(a00, *(const V512*)oAllFrom6_4, rCGKDHLEIcgkdhlei);
|
863
|
-
a03 = _mm512_permutex2var_epi32(a00, *(const V512*)oAllFrom9_4, rCGKDHLEIcgkdhlei);
|
864
|
-
|
865
|
-
a13 = _mm512_permutex2var_epi32(a01, *(const V512*)oAllFrom1_7, rCGKDHLEIcgkdhlei);
|
866
|
-
a10 = _mm512_permutex2var_epi32(a02, *(const V512*)oAllFrom1_10, rCGKDHLEIcgkdhlei);
|
867
|
-
a11 = _mm512_permutex2var_epi32(a03, *(const V512*)oAllFrom1_13, rCGKDHLEIcgkdhlei);
|
868
|
-
|
869
|
-
a20 = _mm512_permutex2var_epi32(a12, *(const V512*)oAllFrom1_5, rCGKDHLEIcgkdhlei);
|
870
|
-
a21 = _mm512_permutex2var_epi32(a13, *(const V512*)oAllFrom1_8, rCGKDHLEIcgkdhlei);
|
871
|
-
a22 = _mm512_permutex2var_epi32(a10, *(const V512*)oAllFrom1_11, rCGKDHLEIcgkdhlei);
|
872
|
-
a23 = _mm512_permutex2var_epi32(a11, *(const V512*)oAllFrom1_14, rCGKDHLEIcgkdhlei);
|
873
|
-
Dump("Roll-c", a);
|
874
|
-
|
875
|
-
a00 = XOR( a00, LOAD_GATHER16_32(offsets, i32+0));
|
876
|
-
a01 = XOR( a01, LOAD_GATHER16_32(offsets, i32+1));
|
877
|
-
a02 = XOR( a02, LOAD_GATHER16_32(offsets, i32+2));
|
878
|
-
a03 = XOR( a03, LOAD_GATHER16_32(offsets, i32+3));
|
879
|
-
a12 = XOR( a12, LOAD_GATHER16_32(offsets, i32+4));
|
880
|
-
a13 = XOR( a13, LOAD_GATHER16_32(offsets, i32+5));
|
881
|
-
a10 = XOR( a10, LOAD_GATHER16_32(offsets, i32+6));
|
882
|
-
a11 = XOR( a11, LOAD_GATHER16_32(offsets, i32+7));
|
883
|
-
a20 = XOR( a20, LOAD_GATHER16_32(offsets, i32+8));
|
884
|
-
a21 = XOR( a21, LOAD_GATHER16_32(offsets, i32+9));
|
885
|
-
a22 = XOR( a22, LOAD_GATHER16_32(offsets, i32+10));
|
886
|
-
a23 = XOR( a23, LOAD_GATHER16_32(offsets, i32+11));
|
887
|
-
Dump("Input Xoodoo (after add)", a);
|
888
|
-
|
889
|
-
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc6 );
|
890
|
-
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc5 );
|
891
|
-
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc4 );
|
892
|
-
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc3 );
|
893
|
-
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc2 );
|
894
|
-
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc1 );
|
895
|
-
Dump("Output Xoodoo", a);
|
896
|
-
|
897
|
-
x00 = XOR(x00, a00);
|
898
|
-
x01 = XOR(x01, a01);
|
899
|
-
x02 = XOR(x02, a02);
|
900
|
-
x03 = XOR(x03, a03);
|
901
|
-
x10 = XOR(x10, a10);
|
902
|
-
x11 = XOR(x11, a11);
|
903
|
-
x12 = XOR(x12, a12);
|
904
|
-
x13 = XOR(x13, a13);
|
905
|
-
x20 = XOR(x20, a20);
|
906
|
-
x21 = XOR(x21, a21);
|
907
|
-
x22 = XOR(x22, a22);
|
908
|
-
x23 = XOR(x23, a23);
|
909
|
-
Dump("Accu x", x);
|
910
|
-
|
911
|
-
i32 += NLANES*16;
|
912
|
-
length -= NLANES*4*16;
|
913
|
-
}
|
914
|
-
while (length >= (NLANES*4*16));
|
915
|
-
|
916
|
-
/* Reduce from lanes 16 to 8 */
|
917
|
-
v1 = *(V512*)oLow256;
|
918
|
-
v2 = *(V512*)oHigh256;
|
919
|
-
x00 = XOR(_mm512_permutex2var_epi32(x00, v1, x10), _mm512_permutex2var_epi32(x00, v2, x10));
|
920
|
-
x01 = XOR(_mm512_permutex2var_epi32(x01, v1, x11), _mm512_permutex2var_epi32(x01, v2, x11));
|
921
|
-
x02 = XOR(_mm512_permutex2var_epi32(x02, v1, x12), _mm512_permutex2var_epi32(x02, v2, x12));
|
922
|
-
x03 = XOR(_mm512_permutex2var_epi32(x03, v1, x13), _mm512_permutex2var_epi32(x03, v2, x13));
|
923
|
-
x20 = XOR(_mm512_permutex2var_epi32(x20, v1, x22), _mm512_permutex2var_epi32(x20, v2, x22));
|
924
|
-
x21 = XOR(_mm512_permutex2var_epi32(x21, v1, x23), _mm512_permutex2var_epi32(x21, v2, x23));
|
925
|
-
|
926
|
-
/* Reduce from 8 lanes to 4 */
|
927
|
-
v1 = *( V512*)oLow128;
|
928
|
-
v2 = *( V512*)oHigh128;
|
929
|
-
x00 = XOR(_mm512_permutex2var_epi32(x00, v1, x02), _mm512_permutex2var_epi32(x00, v2, x02));
|
930
|
-
x01 = XOR(_mm512_permutex2var_epi32(x01, v1, x03), _mm512_permutex2var_epi32(x01, v2, x03));
|
931
|
-
x20 = XOR(_mm512_permutex2var_epi32(x20, v1, x21), _mm512_permutex2var_epi32(x20, v2, x21));
|
932
|
-
|
933
|
-
/* Reduce from 4 lanes to 2 */
|
934
|
-
v1 = *(V512*)oLow64;
|
935
|
-
v2 = *(V512*)oHigh64;
|
936
|
-
x00 = XOR(_mm512_permutex2var_epi32(x00, v1, x01), _mm512_permutex2var_epi32(x00, v2, x01));
|
937
|
-
x20 = XOR(_mm512_permutex2var_epi32(x20, v1, x20), _mm512_permutex2var_epi32(x20, v2, x20));
|
938
|
-
|
939
|
-
/* Reduce from 2 lanes to 1 */
|
940
|
-
x00 = XOR(_mm512_permutex2var_epi32(x00, *(V512*)oLow32, x20), _mm512_permutex2var_epi32(x00, *(V512*)oHigh32, x20));
|
941
|
-
|
942
|
-
/* load xAccu, xor and store 12 lanes */
|
943
|
-
x01 = _mm512_maskz_load_epi64(0x3F, x32);
|
944
|
-
x00 = XOR(x00, x01);
|
945
|
-
_mm512_mask_store_epi64(x32, 0x3F, x00);
|
946
|
-
DUMP32( "x32", x32);
|
947
|
-
|
948
|
-
/* Save new k */
|
949
|
-
_mm512_mask_i32scatter_epi32(k32, 0xFFF0, *(const V512*)oGatherScatterOffsetsRoll, rCGKDHLEIcgkdhlei, 4);
|
950
|
-
DUMP32( "k32", k32);
|
951
|
-
|
952
|
-
return initialLength - length;
|
953
|
-
}
|
954
|
-
|
955
|
-
size_t Xooffftimes16_ExpandFastLoop(unsigned char *yAccu, const unsigned char *kRoll, unsigned char *output, size_t length)
|
956
|
-
{
|
957
|
-
DeclareVars;
|
958
|
-
uint32_t *k32 = (uint32_t*)kRoll;
|
959
|
-
uint32_t *y32 = (uint32_t*)yAccu;
|
960
|
-
uint32_t *o32 = (uint32_t*)output;
|
961
|
-
size_t initialLength;
|
962
|
-
V512 rCGKDHLEIcgkdhlei;
|
963
|
-
V512 offsets;
|
964
|
-
|
965
|
-
rCGKDHLEIcgkdhlei = LOAD_GATHER16_32(*(const V512*)oGatherScatterOffsetsRoll, y32);
|
966
|
-
offsets = *(const V512*)oGatherScatterOffsets;
|
967
|
-
|
968
|
-
initialLength = length;
|
969
|
-
do {
|
970
|
-
/* a10 - a12 and a11 - a13 are swapped */
|
971
|
-
a00 = SHUFFLE_LANES_RIGHT(*(const V512*)oshuffleR_4, rCGKDHLEIcgkdhlei);
|
972
|
-
a12 = SHUFFLE_LANES_RIGHT(*(const V512*)oshuffleR_1, a00); /* */
|
973
|
-
a20 = SHUFFLE_LANES_RIGHT(*(const V512*)oshuffleR_2, a00); /* */
|
974
|
-
a23 = AND(a20, a12); /* a23 used as temporary var */
|
975
|
-
rCGKDHLEIcgkdhlei = XOR3(ROL32(a00, 5), ROL32(a12, 13), a23); /* Only lanes 0 - 9 are ok */
|
976
|
-
rCGKDHLEIcgkdhlei = XOR(rCGKDHLEIcgkdhlei, CONST16_32(7));
|
977
|
-
|
978
|
-
a00 = _mm512_permutex2var_epi32(a00, *(const V512*)oAllLow12_0, rCGKDHLEIcgkdhlei);
|
979
|
-
a12 = _mm512_permutex2var_epi32(a12, *(const V512*)oAllLow11_0, rCGKDHLEIcgkdhlei);
|
980
|
-
a20 = _mm512_permutex2var_epi32(a20, *(const V512*)oAllLow10_0, rCGKDHLEIcgkdhlei);
|
981
|
-
a23 = AND(a20, a12); /* a23 used as temporary var */
|
982
|
-
rCGKDHLEIcgkdhlei = XOR3(ROL32(a00, 5), ROL32(a12, 13), a23); /* All lanes are ok */
|
983
|
-
rCGKDHLEIcgkdhlei = XOR(rCGKDHLEIcgkdhlei, CONST16_32(7));
|
984
|
-
|
985
|
-
a01 = _mm512_permutex2var_epi32(a00, *(const V512*)oAllFrom3_4, rCGKDHLEIcgkdhlei);
|
986
|
-
a02 = _mm512_permutex2var_epi32(a00, *(const V512*)oAllFrom6_4, rCGKDHLEIcgkdhlei);
|
987
|
-
a03 = _mm512_permutex2var_epi32(a00, *(const V512*)oAllFrom9_4, rCGKDHLEIcgkdhlei);
|
988
|
-
|
989
|
-
a13 = _mm512_permutex2var_epi32(a01, *(const V512*)oAllFrom1_7, rCGKDHLEIcgkdhlei); /* */
|
990
|
-
a10 = _mm512_permutex2var_epi32(a02, *(const V512*)oAllFrom1_10, rCGKDHLEIcgkdhlei); /* */
|
991
|
-
a11 = _mm512_permutex2var_epi32(a03, *(const V512*)oAllFrom1_13, rCGKDHLEIcgkdhlei); /* */
|
992
|
-
|
993
|
-
a21 = _mm512_permutex2var_epi32(a13, *(const V512*)oAllFrom1_8, rCGKDHLEIcgkdhlei); /* */
|
994
|
-
a22 = _mm512_permutex2var_epi32(a10, *(const V512*)oAllFrom1_11, rCGKDHLEIcgkdhlei); /* */
|
995
|
-
a23 = _mm512_permutex2var_epi32(a11, *(const V512*)oAllFrom1_14, rCGKDHLEIcgkdhlei); /* */
|
996
|
-
Dump("Roll-e", a);
|
997
|
-
|
998
|
-
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc6 );
|
999
|
-
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc5 );
|
1000
|
-
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc4 );
|
1001
|
-
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc3 );
|
1002
|
-
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc2 );
|
1003
|
-
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc1 );
|
1004
|
-
Dump("Xoodoo(y)", a);
|
1005
|
-
|
1006
|
-
a00 = XOR(a00, CONST16_32(k32[0]));
|
1007
|
-
a01 = XOR(a01, CONST16_32(k32[1]));
|
1008
|
-
a02 = XOR(a02, CONST16_32(k32[2]));
|
1009
|
-
a03 = XOR(a03, CONST16_32(k32[3]));
|
1010
|
-
a10 = XOR(a10, CONST16_32(k32[4]));
|
1011
|
-
a11 = XOR(a11, CONST16_32(k32[5]));
|
1012
|
-
a12 = XOR(a12, CONST16_32(k32[6]));
|
1013
|
-
a13 = XOR(a13, CONST16_32(k32[7]));
|
1014
|
-
a20 = XOR(a20, CONST16_32(k32[8]));
|
1015
|
-
a21 = XOR(a21, CONST16_32(k32[9]));
|
1016
|
-
a22 = XOR(a22, CONST16_32(k32[10]));
|
1017
|
-
a23 = XOR(a23, CONST16_32(k32[11]));
|
1018
|
-
Dump("Xoodoo(y) + kRoll", a);
|
1019
|
-
|
1020
|
-
/* Extract */
|
1021
|
-
STORE_SCATTER16_32(offsets, a00, o32+0);
|
1022
|
-
STORE_SCATTER16_32(offsets, a01, o32+1);
|
1023
|
-
STORE_SCATTER16_32(offsets, a02, o32+2);
|
1024
|
-
STORE_SCATTER16_32(offsets, a03, o32+3);
|
1025
|
-
STORE_SCATTER16_32(offsets, a10, o32+4);
|
1026
|
-
STORE_SCATTER16_32(offsets, a11, o32+5);
|
1027
|
-
STORE_SCATTER16_32(offsets, a12, o32+6);
|
1028
|
-
STORE_SCATTER16_32(offsets, a13, o32+7);
|
1029
|
-
STORE_SCATTER16_32(offsets, a20, o32+8);
|
1030
|
-
STORE_SCATTER16_32(offsets, a21, o32+9);
|
1031
|
-
STORE_SCATTER16_32(offsets, a22, o32+10);
|
1032
|
-
STORE_SCATTER16_32(offsets, a23, o32+11);
|
1033
|
-
|
1034
|
-
o32 += NLANES*16;
|
1035
|
-
length -= NLANES*4*16;
|
1036
|
-
}
|
1037
|
-
while (length >= (NLANES*4*16));
|
1038
|
-
|
1039
|
-
/* Save new y */
|
1040
|
-
_mm512_mask_i32scatter_epi32(y32, 0xFFF0, *(const V512*)oGatherScatterOffsetsRoll, rCGKDHLEIcgkdhlei, 4);
|
1041
|
-
DUMP32( "y32", y32);
|
1042
|
-
|
1043
|
-
return initialLength - length;
|
1044
|
-
}
|