sleeping_kangaroo12 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +127 -0
- data/ext/Rakefile +73 -0
- data/ext/binding/sleeping_kangaroo12.c +39 -0
- data/ext/config/xkcp.build +17 -0
- data/ext/xkcp/LICENSE +1 -0
- data/ext/xkcp/Makefile +15 -0
- data/ext/xkcp/Makefile.build +200 -0
- data/ext/xkcp/README.markdown +296 -0
- data/ext/xkcp/lib/HighLevel.build +143 -0
- data/ext/xkcp/lib/LowLevel.build +757 -0
- data/ext/xkcp/lib/common/align.h +33 -0
- data/ext/xkcp/lib/common/brg_endian.h +143 -0
- data/ext/xkcp/lib/high/KangarooTwelve/KangarooTwelve.c +301 -0
- data/ext/xkcp/lib/high/KangarooTwelve/KangarooTwelve.h +97 -0
- data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.c +81 -0
- data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.h +125 -0
- data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.c +48 -0
- data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.h +79 -0
- data/ext/xkcp/lib/high/Keccak/KeccakDuplex.c +81 -0
- data/ext/xkcp/lib/high/Keccak/KeccakDuplex.h +73 -0
- data/ext/xkcp/lib/high/Keccak/KeccakDuplex.inc +195 -0
- data/ext/xkcp/lib/high/Keccak/KeccakSponge.c +111 -0
- data/ext/xkcp/lib/high/Keccak/KeccakSponge.h +76 -0
- data/ext/xkcp/lib/high/Keccak/KeccakSponge.inc +314 -0
- data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.c +61 -0
- data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.h +67 -0
- data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.inc +128 -0
- data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.c +93 -0
- data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.h +599 -0
- data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.inc +573 -0
- data/ext/xkcp/lib/high/Ketje/Ketjev2.c +87 -0
- data/ext/xkcp/lib/high/Ketje/Ketjev2.h +88 -0
- data/ext/xkcp/lib/high/Ketje/Ketjev2.inc +274 -0
- data/ext/xkcp/lib/high/Keyak/Keyakv2.c +132 -0
- data/ext/xkcp/lib/high/Keyak/Keyakv2.h +217 -0
- data/ext/xkcp/lib/high/Keyak/Keyakv2.inc +81 -0
- data/ext/xkcp/lib/high/Keyak/Motorist.inc +953 -0
- data/ext/xkcp/lib/high/Kravatte/Kravatte.c +533 -0
- data/ext/xkcp/lib/high/Kravatte/Kravatte.h +115 -0
- data/ext/xkcp/lib/high/Kravatte/KravatteModes.c +557 -0
- data/ext/xkcp/lib/high/Kravatte/KravatteModes.h +247 -0
- data/ext/xkcp/lib/high/Xoodyak/Cyclist.h +66 -0
- data/ext/xkcp/lib/high/Xoodyak/Cyclist.inc +336 -0
- data/ext/xkcp/lib/high/Xoodyak/Xoodyak-parameters.h +26 -0
- data/ext/xkcp/lib/high/Xoodyak/Xoodyak.c +55 -0
- data/ext/xkcp/lib/high/Xoodyak/Xoodyak.h +35 -0
- data/ext/xkcp/lib/high/Xoofff/Xoofff.c +634 -0
- data/ext/xkcp/lib/high/Xoofff/Xoofff.h +147 -0
- data/ext/xkcp/lib/high/Xoofff/XoofffModes.c +483 -0
- data/ext/xkcp/lib/high/Xoofff/XoofffModes.h +241 -0
- data/ext/xkcp/lib/high/common/Phases.h +25 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-SnP.h +41 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-armcc.s +1666 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-gcc.s +1655 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-armcc.s +1268 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-gcc.s +1264 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-armcc.s +1178 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-gcc.s +1175 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-armcc.s +1338 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-gcc.s +1336 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-armcc.s +1343 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-gcc.s +1339 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-SnP.h +42 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-armcc.s +823 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-gcc.s +831 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-SnP.h +31 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-armv8a-neon.s +540 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-SnP.h +42 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-compact.s +733 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-fast.s +1121 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVX2/KeccakP-1600-AVX2.s +1100 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVX2/KeccakP-1600-SnP.h +52 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-AVX512.c +623 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-SnP.h +47 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u12/KeccakP-1600-AVX512-config.h +6 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u6/KeccakP-1600-AVX512-config.h +6 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/ua/KeccakP-1600-AVX512-config.h +6 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-AVX512.s +1031 -0
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-SnP.h +53 -0
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-SnP.h +44 -0
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-XOP.c +476 -0
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/u6/KeccakP-1600-XOP-config.h +6 -0
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/ua/KeccakP-1600-XOP-config.h +6 -0
- data/ext/xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-64.macros +748 -0
- data/ext/xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-unrolling.macros +305 -0
- data/ext/xkcp/lib/low/KeccakP-1600/compact/KeccakP-1600-SnP.h +40 -0
- data/ext/xkcp/lib/low/KeccakP-1600/compact/KeccakP-1600-compact64.c +420 -0
- data/ext/xkcp/lib/low/KeccakP-1600/plain-32bits-inplace/KeccakP-1600-SnP.h +43 -0
- data/ext/xkcp/lib/low/KeccakP-1600/plain-32bits-inplace/KeccakP-1600-inplace32BI.c +1163 -0
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/KeccakP-1600-SnP.h +54 -0
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/KeccakP-1600-opt64.c +565 -0
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcu6/KeccakP-1600-opt64-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua/KeccakP-1600-opt64-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua-shld/KeccakP-1600-opt64-config.h +8 -0
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/u6/KeccakP-1600-opt64-config.h +6 -0
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/ua/KeccakP-1600-opt64-config.h +6 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-SnP.h +44 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference.h +23 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference32BI.c +625 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-SnP.h +44 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.c +440 -0
- data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.h +23 -0
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-SnP.h +42 -0
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas.s +1196 -0
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas_Apple.s +1124 -0
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-shld-gas.s +1196 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-armcc.s +1392 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-gcc.s +1394 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-times2-SnP.h +42 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u12/SIMD512-2-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u4/SIMD512-2-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512ufull/SIMD512-2-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SIMD512.c +850 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SnP.h +51 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SIMD128.c +957 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SnP.h +49 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-u2/SIMD128-config.h +8 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-ua/SIMD128-config.h +8 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-u2/SIMD128-config.h +9 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-ua/SIMD128-config.h +9 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-on1.c +37 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SIMD256.c +1321 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SnP.h +55 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u12/SIMD256-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u6/SIMD256-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/ua/SIMD256-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u12/SIMD512-4-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u4/SIMD512-4-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512ufull/SIMD512-4-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SIMD512.c +881 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SnP.h +51 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-on1.c +37 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-on2.c +38 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SIMD512.c +1615 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SnP.h +57 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u12/SIMD512-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u4/SIMD512-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/ua/SIMD512-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-on1.c +37 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-on2.c +38 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-on4.c +38 -0
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-SnP.h +41 -0
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-armcc.s +442 -0
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-gcc.s +446 -0
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-armcc.s +419 -0
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-gcc.s +427 -0
- data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-SnP.h +41 -0
- data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-avr8-fast.s +647 -0
- data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-SnP.h +39 -0
- data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-compact.c +190 -0
- data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-SnP.h +43 -0
- data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.c +412 -0
- data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.h +23 -0
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-SnP.h +41 -0
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-armcc.s +454 -0
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-gcc.s +458 -0
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-armcc.s +455 -0
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-gcc.s +458 -0
- data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-SnP.h +41 -0
- data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-avr8-fast.s +728 -0
- data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-SnP.h +43 -0
- data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.c +414 -0
- data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.h +23 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-SnP.h +42 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-armcc.s +527 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-gcc.s +533 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-armcc.s +528 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-gcc.s +534 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-armcc.s +521 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-gcc.s +527 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-armcc.s +517 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-gcc.s +523 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-armcc.s +550 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-gcc.s +556 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-SnP.h +32 -0
- data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-armv8a-neon.s +432 -0
- data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-SnP.h +42 -0
- data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-avr8-fast.s +929 -0
- data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-SnP.h +40 -0
- data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-compact.c +244 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-SnP.h +46 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32-bis.macros +184 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.c +454 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.macros +459 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling-bis.macros +83 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling.macros +88 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/lcu2/KeccakP-800-opt32-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/lcua/KeccakP-800-opt32-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/u2/KeccakP-800-opt32-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-800/plain/ua/KeccakP-800-opt32-config.h +7 -0
- data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-SnP.h +44 -0
- data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.c +437 -0
- data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.h +23 -0
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/Ket.h +57 -0
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-armcc.s +475 -0
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-gcc.s +480 -0
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-armcc.s +590 -0
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-gcc.s +590 -0
- data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.c +126 -0
- data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.h +68 -0
- data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.inc +174 -0
- data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.c +80 -0
- data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.h +68 -0
- data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.inc +142 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-SnP.h +55 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-armcc.s +1086 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-gcc.s +1092 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-armcc.s +721 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-gcc.s +726 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-armcc.s +723 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-gcc.s +729 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-armcc.s +1164 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-gcc.s +1165 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-armcc.s +562 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-gcc.s +563 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-armcc.s +563 -0
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-gcc.s +565 -0
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-SnP.h +55 -0
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-armcc.s +476 -0
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-gcc.s +485 -0
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-armcc.s +362 -0
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-gcc.s +367 -0
- data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-SnP.h +43 -0
- data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-avr8-u1.s +1341 -0
- data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SIMD512.c +581 -0
- data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SnP.h +58 -0
- data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodyak-full-block-SIMD512.c +332 -0
- data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SIMD128.c +329 -0
- data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SnP.h +53 -0
- data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodyak-full-block-SIMD128.c +355 -0
- data/ext/xkcp/lib/low/Xoodoo/Xoodoo.h +79 -0
- data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-SnP.h +56 -0
- data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-optimized.c +399 -0
- data/ext/xkcp/lib/low/Xoodoo/plain/Xoodyak-full-blocks.c +127 -0
- data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-SnP.h +43 -0
- data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-reference.c +253 -0
- data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SIMD512.c +1044 -0
- data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SnP.h +49 -0
- data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-SnP.h +45 -0
- data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-on1.c +37 -0
- data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-ARMv7A.s +1587 -0
- data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-SnP.h +48 -0
- data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SIMD512.c +1202 -0
- data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SnP.h +48 -0
- data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SIMD128.c +484 -0
- data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SnP.h +44 -0
- data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-SnP.h +45 -0
- data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-on1.c +37 -0
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SIMD256.c +939 -0
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SnP.h +49 -0
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SIMD512.c +1216 -0
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SnP.h +48 -0
- data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-SnP.h +45 -0
- data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-on1.c +37 -0
- data/ext/xkcp/lib/low/common/PlSnP-Fallback.inc +290 -0
- data/ext/xkcp/lib/low/common/SnP-Relaned.h +141 -0
- data/ext/xkcp/support/Build/ExpandProducts.xsl +79 -0
- data/ext/xkcp/support/Build/ToGlobalMakefile.xsl +206 -0
- data/ext/xkcp/support/Build/ToOneTarget.xsl +89 -0
- data/ext/xkcp/support/Build/ToTargetConfigFile.xsl +37 -0
- data/ext/xkcp/support/Build/ToTargetMakefile.xsl +298 -0
- data/ext/xkcp/support/Build/ToVCXProj.xsl +198 -0
- data/ext/xkcp/support/Kernel-PMU/Kernel-pmu.md +133 -0
- data/ext/xkcp/support/Kernel-PMU/Makefile +8 -0
- data/ext/xkcp/support/Kernel-PMU/enable_arm_pmu.c +129 -0
- data/ext/xkcp/support/Kernel-PMU/load-module +1 -0
- data/ext/xkcp/util/KeccakSum/KeccakSum.c +394 -0
- data/ext/xkcp/util/KeccakSum/base64.c +86 -0
- data/ext/xkcp/util/KeccakSum/base64.h +12 -0
- data/lib/sleeping_kangaroo12/binding.rb +15 -0
- data/lib/sleeping_kangaroo12/build/loader.rb +40 -0
- data/lib/sleeping_kangaroo12/build/platform.rb +37 -0
- data/lib/sleeping_kangaroo12/build.rb +4 -0
- data/lib/sleeping_kangaroo12/digest.rb +103 -0
- data/lib/sleeping_kangaroo12/version.rb +5 -0
- data/lib/sleeping_kangaroo12.rb +7 -0
- metadata +372 -0
@@ -0,0 +1,1044 @@
|
|
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
|
+
}
|