sleeping_kangaroo12 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The eXtended Keccak Code Package (XKCP)
|
|
3
|
+
https://github.com/XKCP/XKCP
|
|
4
|
+
|
|
5
|
+
The Xoodoo permutation, designed by Joan Daemen, Seth Hoffert, Gilles Van Assche and Ronny Van Keer.
|
|
6
|
+
|
|
7
|
+
Implementation by Ronny Van Keer, hereby denoted as "the implementer".
|
|
8
|
+
|
|
9
|
+
For more information, feedback or questions, please refer to the Keccak Team website:
|
|
10
|
+
https://keccak.team/
|
|
11
|
+
|
|
12
|
+
To the extent possible under law, the implementer has waived all copyright
|
|
13
|
+
and related or neighboring rights to the source code in this file.
|
|
14
|
+
http://creativecommons.org/publicdomain/zero/1.0/
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#ifndef _Xoodoo_times4_SnP_h_
|
|
18
|
+
#define _Xoodoo_times4_SnP_h_
|
|
19
|
+
|
|
20
|
+
/** For the documentation, see PlSnP-documentation.h.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
#define Xoodootimes4_implementation "512-bit SIMD (AVX-512) implementation"
|
|
24
|
+
#define Xoodootimes4_statesSizeInBytes (4*3*4*4)
|
|
25
|
+
#define Xoodootimes4_statesAlignment 64
|
|
26
|
+
|
|
27
|
+
#define Xoodootimes4_StaticInitialize()
|
|
28
|
+
void Xoodootimes4_InitializeAll(void *states);
|
|
29
|
+
#define Xoodootimes4_AddByte(states, instanceIndex, byte, offset) \
|
|
30
|
+
((unsigned char*)(states))[(instanceIndex)*4 + ((offset)/4)*4*4 + (offset)%4] ^= (byte)
|
|
31
|
+
void Xoodootimes4_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
|
|
32
|
+
void Xoodootimes4_AddLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
|
|
33
|
+
void Xoodootimes4_OverwriteBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
|
|
34
|
+
void Xoodootimes4_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
|
|
35
|
+
void Xoodootimes4_OverwriteWithZeroes(void *states, unsigned int instanceIndex, unsigned int byteCount);
|
|
36
|
+
void Xoodootimes4_PermuteAll_6rounds(void *states);
|
|
37
|
+
void Xoodootimes4_PermuteAll_12rounds(void *states);
|
|
38
|
+
void Xoodootimes4_ExtractBytes(const void *states, unsigned int instanceIndex, unsigned char *data, unsigned int offset, unsigned int length);
|
|
39
|
+
void Xoodootimes4_ExtractLanesAll(const void *states, unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
|
|
40
|
+
void Xoodootimes4_ExtractAndAddBytes(const void *states, unsigned int instanceIndex, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
|
|
41
|
+
void Xoodootimes4_ExtractAndAddLanesAll(const void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset);
|
|
42
|
+
|
|
43
|
+
#define Xoodootimes4_FastXoofff_supported
|
|
44
|
+
void Xooffftimes4_AddIs(unsigned char *output, const unsigned char *input, size_t bitLen);
|
|
45
|
+
size_t Xooffftimes4_CompressFastLoop(unsigned char *k, unsigned char *x, const unsigned char *input, size_t length);
|
|
46
|
+
size_t Xooffftimes4_ExpandFastLoop(unsigned char *yAccu, const unsigned char *kRoll, unsigned char *output, size_t length);
|
|
47
|
+
|
|
48
|
+
#endif
|
|
@@ -0,0 +1,484 @@
|
|
|
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 <emmintrin.h>
|
|
21
|
+
#include "align.h"
|
|
22
|
+
#include "brg_endian.h"
|
|
23
|
+
#include "Xoodoo.h"
|
|
24
|
+
#include "Xoodoo-times4-SnP.h"
|
|
25
|
+
|
|
26
|
+
#if (PLATFORM_BYTE_ORDER != IS_LITTLE_ENDIAN)
|
|
27
|
+
#error Expecting a little-endian platform
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
#define VERBOSE 0
|
|
31
|
+
|
|
32
|
+
typedef __m128i V128;
|
|
33
|
+
|
|
34
|
+
#define SnP_laneLengthInBytes 4
|
|
35
|
+
#define laneIndex(instanceIndex, lanePosition) ((lanePosition)*4 + instanceIndex)
|
|
36
|
+
|
|
37
|
+
#define ANDnu128(a, b) _mm_andnot_si128(a, b)
|
|
38
|
+
#define LOAD128(a) _mm_load_si128((const V128 *)&(a))
|
|
39
|
+
#define LOAD4_32(a,b,c,d) _mm_setr_epi32(a,b,c,d)
|
|
40
|
+
#if defined(Waffel_useXOP)
|
|
41
|
+
#define ROL32in128(a, o) _mm_roti_epi32(a, o)
|
|
42
|
+
// #define ROL32in128_8(a) ROL32in128(a, 8)
|
|
43
|
+
#else
|
|
44
|
+
#define ROL32in128(a, o) _mm_or_si128(_mm_slli_epi32(a, o), _mm_srli_epi32(a, 32-(o)))
|
|
45
|
+
// #define ROL32in128_8(a) _mm_shuffle_epi8(a, CONST128(rho8))
|
|
46
|
+
//static const uint64_t rho8[2] = {0x0605040302010007, 0x0E0D0C0B0A09080F};
|
|
47
|
+
#endif
|
|
48
|
+
#define STORE128(a, b) _mm_store_si128((V128 *)&(a), b)
|
|
49
|
+
#define STORE4_32(r, a, b, c, d) a = _mm_extract_epi32(r, 0), b = _mm_extract_epi32(r, 1), c = _mm_extract_epi32(r, 2), d = _mm_extract_epi32(r, 3)
|
|
50
|
+
#define XOR128(a, b) _mm_xor_si128(a, b)
|
|
51
|
+
#define XOReq128(a, b) a = XOR128(a, b)
|
|
52
|
+
|
|
53
|
+
#if (VERBOSE > 0)
|
|
54
|
+
#define Dump(__t) printf(__t "\n"); \
|
|
55
|
+
Vars2State; \
|
|
56
|
+
printf("a00 %08x, a01 %08x, a02 %08x, a03 %08x\n", states[4*(0+0)], states[4*(0+1)], states[4*(0+2)], states[4*(0+3)] ); \
|
|
57
|
+
printf("a10 %08x, a11 %08x, a12 %08x, a13 %08x\n", states[4*(4+0)], states[4*(4+1)], states[4*(4+2)], states[4*(4+3)] ); \
|
|
58
|
+
printf("a20 %08x, a21 %08x, a22 %08x, a23 %08x\n\n", states[4*(8+0)], states[4*(8+1)], states[4*(8+2)], states[4*(8+3)] );
|
|
59
|
+
#else
|
|
60
|
+
#define Dump(__t)
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
#if (VERBOSE >= 1)
|
|
64
|
+
#define Dump1(__t) Dump(__t)
|
|
65
|
+
#else
|
|
66
|
+
#define Dump1(__t)
|
|
67
|
+
#endif
|
|
68
|
+
|
|
69
|
+
#if (VERBOSE >= 2)
|
|
70
|
+
#define Dump2(__t) Dump(__t)
|
|
71
|
+
#else
|
|
72
|
+
#define Dump2(__t)
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
#if (VERBOSE >= 3)
|
|
76
|
+
#define Dump3(__t) Dump(__t)
|
|
77
|
+
#else
|
|
78
|
+
#define Dump3(__t)
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
void Xoodootimes4_InitializeAll(void *states)
|
|
82
|
+
{
|
|
83
|
+
memset(states, 0, Xoodootimes4_statesSizeInBytes);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
void Xoodootimes4_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length)
|
|
87
|
+
{
|
|
88
|
+
unsigned int sizeLeft = length;
|
|
89
|
+
unsigned int lanePosition = offset/SnP_laneLengthInBytes;
|
|
90
|
+
unsigned int offsetInLane = offset%SnP_laneLengthInBytes;
|
|
91
|
+
const unsigned char *curData = data;
|
|
92
|
+
uint32_t *statesAsLanes = (uint32_t *)states;
|
|
93
|
+
|
|
94
|
+
if ((sizeLeft > 0) && (offsetInLane != 0)) {
|
|
95
|
+
unsigned int bytesInLane = SnP_laneLengthInBytes - offsetInLane;
|
|
96
|
+
uint32_t lane = 0;
|
|
97
|
+
if (bytesInLane > sizeLeft)
|
|
98
|
+
bytesInLane = sizeLeft;
|
|
99
|
+
memcpy((unsigned char*)&lane + offsetInLane, curData, bytesInLane);
|
|
100
|
+
statesAsLanes[laneIndex(instanceIndex, lanePosition)] ^= lane;
|
|
101
|
+
sizeLeft -= bytesInLane;
|
|
102
|
+
lanePosition++;
|
|
103
|
+
curData += bytesInLane;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
while(sizeLeft >= SnP_laneLengthInBytes) {
|
|
107
|
+
uint32_t lane = *((const uint32_t*)curData);
|
|
108
|
+
statesAsLanes[laneIndex(instanceIndex, lanePosition)] ^= lane;
|
|
109
|
+
sizeLeft -= SnP_laneLengthInBytes;
|
|
110
|
+
lanePosition++;
|
|
111
|
+
curData += SnP_laneLengthInBytes;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (sizeLeft > 0) {
|
|
115
|
+
uint32_t lane = 0;
|
|
116
|
+
memcpy(&lane, curData, sizeLeft);
|
|
117
|
+
statesAsLanes[laneIndex(instanceIndex, lanePosition)] ^= lane;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
void Xoodootimes4_AddLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
|
|
122
|
+
{
|
|
123
|
+
V128 *stateAsLanes = (V128 *)states;
|
|
124
|
+
unsigned int i;
|
|
125
|
+
const uint32_t *curData0 = (const uint32_t *)(data+0*laneOffset*SnP_laneLengthInBytes);
|
|
126
|
+
const uint32_t *curData1 = (const uint32_t *)(data+1*laneOffset*SnP_laneLengthInBytes);
|
|
127
|
+
const uint32_t *curData2 = (const uint32_t *)(data+2*laneOffset*SnP_laneLengthInBytes);
|
|
128
|
+
const uint32_t *curData3 = (const uint32_t *)(data+3*laneOffset*SnP_laneLengthInBytes);
|
|
129
|
+
#define XOR_In( argIndex ) XOReq128( stateAsLanes[argIndex], LOAD4_32(curData0[argIndex], curData1[argIndex], curData2[argIndex], curData3[argIndex]))
|
|
130
|
+
if ( laneCount == 12 ) {
|
|
131
|
+
XOR_In( 0 );
|
|
132
|
+
XOR_In( 1 );
|
|
133
|
+
XOR_In( 2 );
|
|
134
|
+
XOR_In( 3 );
|
|
135
|
+
XOR_In( 4 );
|
|
136
|
+
XOR_In( 5 );
|
|
137
|
+
XOR_In( 6 );
|
|
138
|
+
XOR_In( 7 );
|
|
139
|
+
XOR_In( 8 );
|
|
140
|
+
XOR_In( 9 );
|
|
141
|
+
XOR_In( 10 );
|
|
142
|
+
XOR_In( 11 );
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
for(i=0; i<laneCount; i++)
|
|
146
|
+
XOR_In( i );
|
|
147
|
+
}
|
|
148
|
+
#undef XOR_In
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
void Xoodootimes4_OverwriteBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length)
|
|
152
|
+
{
|
|
153
|
+
unsigned int sizeLeft = length;
|
|
154
|
+
unsigned int lanePosition = offset/SnP_laneLengthInBytes;
|
|
155
|
+
unsigned int offsetInLane = offset%SnP_laneLengthInBytes;
|
|
156
|
+
const unsigned char *curData = data;
|
|
157
|
+
uint32_t *statesAsLanes = (uint32_t *)states;
|
|
158
|
+
|
|
159
|
+
if ((sizeLeft > 0) && (offsetInLane != 0)) {
|
|
160
|
+
unsigned int bytesInLane = SnP_laneLengthInBytes - offsetInLane;
|
|
161
|
+
if (bytesInLane > sizeLeft)
|
|
162
|
+
bytesInLane = sizeLeft;
|
|
163
|
+
memcpy( ((unsigned char *)&statesAsLanes[laneIndex(instanceIndex, lanePosition)]) + offsetInLane, curData, bytesInLane);
|
|
164
|
+
sizeLeft -= bytesInLane;
|
|
165
|
+
lanePosition++;
|
|
166
|
+
curData += bytesInLane;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
while(sizeLeft >= SnP_laneLengthInBytes) {
|
|
170
|
+
uint32_t lane = *((const uint32_t*)curData);
|
|
171
|
+
statesAsLanes[laneIndex(instanceIndex, lanePosition)] = lane;
|
|
172
|
+
sizeLeft -= SnP_laneLengthInBytes;
|
|
173
|
+
lanePosition++;
|
|
174
|
+
curData += SnP_laneLengthInBytes;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (sizeLeft > 0) {
|
|
178
|
+
memcpy(&statesAsLanes[laneIndex(instanceIndex, lanePosition)], curData, sizeLeft);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
void Xoodootimes4_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
|
|
183
|
+
{
|
|
184
|
+
V128 *stateAsLanes = (V128 *)states;
|
|
185
|
+
unsigned int i;
|
|
186
|
+
const uint32_t *curData0 = (const uint32_t *)(data+0*laneOffset*SnP_laneLengthInBytes);
|
|
187
|
+
const uint32_t *curData1 = (const uint32_t *)(data+1*laneOffset*SnP_laneLengthInBytes);
|
|
188
|
+
const uint32_t *curData2 = (const uint32_t *)(data+2*laneOffset*SnP_laneLengthInBytes);
|
|
189
|
+
const uint32_t *curData3 = (const uint32_t *)(data+3*laneOffset*SnP_laneLengthInBytes);
|
|
190
|
+
#define OverWr( argIndex ) STORE128(stateAsLanes[argIndex], LOAD4_32(curData0[argIndex], curData1[argIndex], curData2[argIndex], curData3[argIndex]))
|
|
191
|
+
if ( laneCount == 12 ) {
|
|
192
|
+
OverWr( 0 );
|
|
193
|
+
OverWr( 1 );
|
|
194
|
+
OverWr( 2 );
|
|
195
|
+
OverWr( 3 );
|
|
196
|
+
OverWr( 4 );
|
|
197
|
+
OverWr( 5 );
|
|
198
|
+
OverWr( 6 );
|
|
199
|
+
OverWr( 7 );
|
|
200
|
+
OverWr( 8 );
|
|
201
|
+
OverWr( 9 );
|
|
202
|
+
OverWr( 10 );
|
|
203
|
+
OverWr( 11 );
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
for(i=0; i<laneCount; i++)
|
|
207
|
+
OverWr( i );
|
|
208
|
+
}
|
|
209
|
+
#undef OverWr
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
void Xoodootimes4_OverwriteWithZeroes(void *states, unsigned int instanceIndex, unsigned int byteCount)
|
|
213
|
+
{
|
|
214
|
+
unsigned int sizeLeft = byteCount;
|
|
215
|
+
unsigned int lanePosition = 0;
|
|
216
|
+
uint32_t *statesAsLanes = (uint32_t *)states;
|
|
217
|
+
|
|
218
|
+
while(sizeLeft >= SnP_laneLengthInBytes) {
|
|
219
|
+
statesAsLanes[laneIndex(instanceIndex, lanePosition)] = 0;
|
|
220
|
+
sizeLeft -= SnP_laneLengthInBytes;
|
|
221
|
+
lanePosition++;
|
|
222
|
+
}
|
|
223
|
+
if (sizeLeft > 0) {
|
|
224
|
+
memset(&statesAsLanes[laneIndex(instanceIndex, lanePosition)], 0, sizeLeft);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
void Xoodootimes4_ExtractBytes(const void *states, unsigned int instanceIndex, unsigned char *data, unsigned int offset, unsigned int length)
|
|
229
|
+
{
|
|
230
|
+
unsigned int sizeLeft = length;
|
|
231
|
+
unsigned int lanePosition = offset/SnP_laneLengthInBytes;
|
|
232
|
+
unsigned int offsetInLane = offset%SnP_laneLengthInBytes;
|
|
233
|
+
unsigned char *curData = data;
|
|
234
|
+
const uint32_t *statesAsLanes = (const uint32_t *)states;
|
|
235
|
+
|
|
236
|
+
if ((sizeLeft > 0) && (offsetInLane != 0)) {
|
|
237
|
+
unsigned int bytesInLane = SnP_laneLengthInBytes - offsetInLane;
|
|
238
|
+
if (bytesInLane > sizeLeft)
|
|
239
|
+
bytesInLane = sizeLeft;
|
|
240
|
+
memcpy( curData, ((unsigned char *)&statesAsLanes[laneIndex(instanceIndex, lanePosition)]) + offsetInLane, bytesInLane);
|
|
241
|
+
sizeLeft -= bytesInLane;
|
|
242
|
+
lanePosition++;
|
|
243
|
+
curData += bytesInLane;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
while(sizeLeft >= SnP_laneLengthInBytes) {
|
|
247
|
+
*(uint32_t*)curData = statesAsLanes[laneIndex(instanceIndex, lanePosition)];
|
|
248
|
+
sizeLeft -= SnP_laneLengthInBytes;
|
|
249
|
+
lanePosition++;
|
|
250
|
+
curData += SnP_laneLengthInBytes;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (sizeLeft > 0) {
|
|
254
|
+
memcpy( curData, &statesAsLanes[laneIndex(instanceIndex, lanePosition)], sizeLeft);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
void Xoodootimes4_ExtractLanesAll(const void *states, unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
|
|
259
|
+
{
|
|
260
|
+
const V128 *stateAsLanes = (const V128 *)states;
|
|
261
|
+
V128 lanes;
|
|
262
|
+
unsigned int i;
|
|
263
|
+
uint32_t *curData0 = (uint32_t *)(data+0*laneOffset*SnP_laneLengthInBytes);
|
|
264
|
+
uint32_t *curData1 = (uint32_t *)(data+1*laneOffset*SnP_laneLengthInBytes);
|
|
265
|
+
uint32_t *curData2 = (uint32_t *)(data+2*laneOffset*SnP_laneLengthInBytes);
|
|
266
|
+
uint32_t *curData3 = (uint32_t *)(data+3*laneOffset*SnP_laneLengthInBytes);
|
|
267
|
+
|
|
268
|
+
#define Extr( argIndex ) lanes = LOAD128( stateAsLanes[argIndex] ), \
|
|
269
|
+
STORE4_32(lanes, curData0[argIndex], curData1[argIndex], curData2[argIndex], curData3[argIndex])
|
|
270
|
+
|
|
271
|
+
if ( laneCount == 12 ) {
|
|
272
|
+
Extr( 0 );
|
|
273
|
+
Extr( 1 );
|
|
274
|
+
Extr( 2 );
|
|
275
|
+
Extr( 3 );
|
|
276
|
+
Extr( 4 );
|
|
277
|
+
Extr( 5 );
|
|
278
|
+
Extr( 6 );
|
|
279
|
+
Extr( 7 );
|
|
280
|
+
Extr( 8 );
|
|
281
|
+
Extr( 9 );
|
|
282
|
+
Extr( 10 );
|
|
283
|
+
Extr( 11 );
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
for(i=0; i<laneCount; i++)
|
|
287
|
+
Extr( i );
|
|
288
|
+
}
|
|
289
|
+
#undef Extr
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
void Xoodootimes4_ExtractAndAddBytes(const void *states, unsigned int instanceIndex, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
|
|
293
|
+
{
|
|
294
|
+
unsigned int sizeLeft = length;
|
|
295
|
+
unsigned int lanePosition = offset/SnP_laneLengthInBytes;
|
|
296
|
+
unsigned int offsetInLane = offset%SnP_laneLengthInBytes;
|
|
297
|
+
const unsigned char *curInput = input;
|
|
298
|
+
unsigned char *curOutput = output;
|
|
299
|
+
const uint32_t *statesAsLanes = (const uint32_t *)states;
|
|
300
|
+
|
|
301
|
+
if ((sizeLeft > 0) && (offsetInLane != 0)) {
|
|
302
|
+
unsigned int bytesInLane = SnP_laneLengthInBytes - offsetInLane;
|
|
303
|
+
uint32_t lane = statesAsLanes[laneIndex(instanceIndex, lanePosition)] >> (8 * offsetInLane);
|
|
304
|
+
if (bytesInLane > sizeLeft)
|
|
305
|
+
bytesInLane = sizeLeft;
|
|
306
|
+
sizeLeft -= bytesInLane;
|
|
307
|
+
do {
|
|
308
|
+
*(curOutput++) = *(curInput++) ^ (unsigned char)lane;
|
|
309
|
+
lane >>= 8;
|
|
310
|
+
} while ( --bytesInLane != 0);
|
|
311
|
+
lanePosition++;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
while(sizeLeft >= SnP_laneLengthInBytes) {
|
|
315
|
+
*((uint32_t*)curOutput) = *((uint32_t*)curInput) ^ statesAsLanes[laneIndex(instanceIndex, lanePosition)];
|
|
316
|
+
sizeLeft -= SnP_laneLengthInBytes;
|
|
317
|
+
lanePosition++;
|
|
318
|
+
curInput += SnP_laneLengthInBytes;
|
|
319
|
+
curOutput += SnP_laneLengthInBytes;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (sizeLeft != 0) {
|
|
323
|
+
uint32_t lane = statesAsLanes[laneIndex(instanceIndex, lanePosition)];
|
|
324
|
+
do {
|
|
325
|
+
*(curOutput++) = *(curInput++) ^ (unsigned char)lane;
|
|
326
|
+
lane >>= 8;
|
|
327
|
+
} while ( --sizeLeft != 0);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
void Xoodootimes4_ExtractAndAddLanesAll(const void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset)
|
|
332
|
+
{
|
|
333
|
+
const uint32_t *stateAsLanes = (const uint32_t *)states;
|
|
334
|
+
unsigned int i;
|
|
335
|
+
const uint32_t *curInput0 = (const uint32_t *)(input+0*laneOffset*SnP_laneLengthInBytes);
|
|
336
|
+
const uint32_t *curInput1 = (const uint32_t *)(input+1*laneOffset*SnP_laneLengthInBytes);
|
|
337
|
+
const uint32_t *curInput2 = (const uint32_t *)(input+2*laneOffset*SnP_laneLengthInBytes);
|
|
338
|
+
const uint32_t *curInput3 = (const uint32_t *)(input+3*laneOffset*SnP_laneLengthInBytes);
|
|
339
|
+
uint32_t *curOutput0 = (uint32_t *)(output+0*laneOffset*SnP_laneLengthInBytes);
|
|
340
|
+
uint32_t *curOutput1 = (uint32_t *)(output+1*laneOffset*SnP_laneLengthInBytes);
|
|
341
|
+
uint32_t *curOutput2 = (uint32_t *)(output+2*laneOffset*SnP_laneLengthInBytes);
|
|
342
|
+
uint32_t *curOutput3 = (uint32_t *)(output+3*laneOffset*SnP_laneLengthInBytes);
|
|
343
|
+
|
|
344
|
+
#define ExtrXOR( argIndex ) curOutput0[argIndex] = curInput0[argIndex] ^ stateAsLanes[4*(argIndex)+0], curOutput1[argIndex] = curInput1[argIndex] ^ stateAsLanes[4*(argIndex)+1], \
|
|
345
|
+
curOutput2[argIndex] = curInput2[argIndex] ^ stateAsLanes[4*(argIndex)+2], curOutput3[argIndex] = curInput3[argIndex] ^ stateAsLanes[4*(argIndex)+3]
|
|
346
|
+
|
|
347
|
+
if ( laneCount == 12 ) {
|
|
348
|
+
ExtrXOR( 0 );
|
|
349
|
+
ExtrXOR( 1 );
|
|
350
|
+
ExtrXOR( 2 );
|
|
351
|
+
ExtrXOR( 3 );
|
|
352
|
+
ExtrXOR( 4 );
|
|
353
|
+
ExtrXOR( 5 );
|
|
354
|
+
ExtrXOR( 6 );
|
|
355
|
+
ExtrXOR( 7 );
|
|
356
|
+
ExtrXOR( 8 );
|
|
357
|
+
ExtrXOR( 9 );
|
|
358
|
+
ExtrXOR( 10 );
|
|
359
|
+
ExtrXOR( 11 );
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
for(i=0; i<laneCount; i++)
|
|
363
|
+
ExtrXOR( i );
|
|
364
|
+
}
|
|
365
|
+
#undef ExtrXOR
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
#define DeclareVars V128 a00, a01, a02, a03; \
|
|
369
|
+
V128 a10, a11, a12, a13; \
|
|
370
|
+
V128 a20, a21, a22, a23; \
|
|
371
|
+
V128 v1, v2
|
|
372
|
+
|
|
373
|
+
#define State2Vars a00 = LOAD128(states[4*(0+0)]), a01 = LOAD128(states[4*(0+1)]), a02 = LOAD128(states[4*(0+2)]), a03 = LOAD128(states[4*(0+3)]); \
|
|
374
|
+
a10 = LOAD128(states[4*(4+0)]), a11 = LOAD128(states[4*(4+1)]), a12 = LOAD128(states[4*(4+2)]), a13 = LOAD128(states[4*(4+3)]); \
|
|
375
|
+
a20 = LOAD128(states[4*(8+0)]), a21 = LOAD128(states[4*(8+1)]), a22 = LOAD128(states[4*(8+2)]), a23 = LOAD128(states[4*(8+3)])
|
|
376
|
+
|
|
377
|
+
#define State2Vars2 a00 = LOAD128(states[4*(0+0)]), a01 = LOAD128(states[4*(0+1)]), a02 = LOAD128(states[4*(0+2)]), a03 = LOAD128(states[4*(0+3)]); \
|
|
378
|
+
a12 = LOAD128(states[4*(4+0)]), a13 = LOAD128(states[4*(4+1)]), a10 = LOAD128(states[4*(4+2)]), a11 = LOAD128(states[4*(4+3)]); \
|
|
379
|
+
a20 = LOAD128(states[4*(8+0)]), a21 = LOAD128(states[4*(8+1)]), a22 = LOAD128(states[4*(8+2)]), a23 = LOAD128(states[4*(8+3)])
|
|
380
|
+
|
|
381
|
+
#define Vars2State STORE128(states[4*(0+0)], a00), STORE128(states[4*(0+1)], a01), STORE128(states[4*(0+2)], a02), STORE128(states[4*(0+3)], a03); \
|
|
382
|
+
STORE128(states[4*(4+0)], a10), STORE128(states[4*(4+1)], a11), STORE128(states[4*(4+2)], a12), STORE128(states[4*(4+3)], a13); \
|
|
383
|
+
STORE128(states[4*(8+0)], a20), STORE128(states[4*(8+1)], a21), STORE128(states[4*(8+2)], a22), STORE128(states[4*(8+3)], a23)
|
|
384
|
+
|
|
385
|
+
#define Round(a10i, a11i, a12i, a13i, a10w, a11w, a12w, a13w, a20i, a21i, a22i, a23i, __rc) \
|
|
386
|
+
\
|
|
387
|
+
/* Theta: Column Parity Mixer */ \
|
|
388
|
+
v1 = XOR128( a03, XOR128( a13i, a23i ) ); \
|
|
389
|
+
v2 = XOR128( a00, XOR128( a10i, a20i ) ); \
|
|
390
|
+
v1 = XOR128( ROL32in128(v1, 5), ROL32in128(v1, 14) ); \
|
|
391
|
+
a00 = XOR128( a00, v1 ); \
|
|
392
|
+
a10i = XOR128( a10i, v1 ); \
|
|
393
|
+
a20i = XOR128( a20i, v1 ); \
|
|
394
|
+
v1 = XOR128( a01, XOR128( a11i, a21i ) ); \
|
|
395
|
+
v2 = XOR128( ROL32in128(v2, 5), ROL32in128(v2, 14) ); \
|
|
396
|
+
a01 = XOR128( a01, v2 ); \
|
|
397
|
+
a11i = XOR128( a11i, v2 ); \
|
|
398
|
+
a21i = XOR128( a21i, v2 ); \
|
|
399
|
+
v2 = XOR128( a02, XOR128( a12i, a22i ) ); \
|
|
400
|
+
v1 = XOR128( ROL32in128(v1, 5), ROL32in128(v1, 14) ); \
|
|
401
|
+
a02 = XOR128( a02, v1 ); \
|
|
402
|
+
a12i = XOR128( a12i, v1 ); \
|
|
403
|
+
a22i = XOR128( a22i, v1 ); \
|
|
404
|
+
v2 = XOR128( ROL32in128(v2, 5), ROL32in128(v2, 14) ); \
|
|
405
|
+
a03 = XOR128( a03, v2 ); \
|
|
406
|
+
a13i = XOR128( a13i, v2 ); \
|
|
407
|
+
a23i = XOR128( a23i, v2 ); \
|
|
408
|
+
Dump3("Theta"); \
|
|
409
|
+
\
|
|
410
|
+
/* Rho-west: Plane shift */ \
|
|
411
|
+
a20i = ROL32in128(a20i, 11); \
|
|
412
|
+
a21i = ROL32in128(a21i, 11); \
|
|
413
|
+
a22i = ROL32in128(a22i, 11); \
|
|
414
|
+
a23i = ROL32in128(a23i, 11); \
|
|
415
|
+
Dump3("Rho-west"); \
|
|
416
|
+
\
|
|
417
|
+
/* Iota: round constants */ \
|
|
418
|
+
a00 = XOR128( a00, _mm_set1_epi32( __rc ) ); \
|
|
419
|
+
Dump3("Iota"); \
|
|
420
|
+
\
|
|
421
|
+
/* Chi: non linear step, on colums */ \
|
|
422
|
+
a00 = XOR128( a00, ANDnu128( a10w, a20i ) ); \
|
|
423
|
+
a01 = XOR128( a01, ANDnu128( a11w, a21i ) ); \
|
|
424
|
+
a02 = XOR128( a02, ANDnu128( a12w, a22i ) ); \
|
|
425
|
+
a03 = XOR128( a03, ANDnu128( a13w, a23i ) ); \
|
|
426
|
+
a10w = XOR128( a10w, ANDnu128( a20i, a00 ) ); \
|
|
427
|
+
a11w = XOR128( a11w, ANDnu128( a21i, a01 ) ); \
|
|
428
|
+
a12w = XOR128( a12w, ANDnu128( a22i, a02 ) ); \
|
|
429
|
+
a13w = XOR128( a13w, ANDnu128( a23i, a03 ) ); \
|
|
430
|
+
a20i = XOR128( a20i, ANDnu128( a00, a10w ) ); \
|
|
431
|
+
a21i = XOR128( a21i, ANDnu128( a01, a11w ) ); \
|
|
432
|
+
a22i = XOR128( a22i, ANDnu128( a02, a12w ) ); \
|
|
433
|
+
a23i = XOR128( a23i, ANDnu128( a03, a13w ) ); \
|
|
434
|
+
Dump3("Chi"); \
|
|
435
|
+
\
|
|
436
|
+
/* Rho-east: Plane shift */ \
|
|
437
|
+
a10w = ROL32in128(a10w, 1); \
|
|
438
|
+
a11w = ROL32in128(a11w, 1); \
|
|
439
|
+
a12w = ROL32in128(a12w, 1); \
|
|
440
|
+
a13w = ROL32in128(a13w, 1); \
|
|
441
|
+
/* todo!! optimization for ROTL multiple of 8 */ \
|
|
442
|
+
a20i = ROL32in128(a20i, 8); \
|
|
443
|
+
a21i = ROL32in128(a21i, 8); \
|
|
444
|
+
a22i = ROL32in128(a22i, 8); \
|
|
445
|
+
a23i = ROL32in128(a23i, 8); \
|
|
446
|
+
Dump3("Rho-east");
|
|
447
|
+
|
|
448
|
+
void Xoodootimes4_PermuteAll_6rounds(void *argStates)
|
|
449
|
+
{
|
|
450
|
+
uint32_t *states = (uint32_t*)argStates;
|
|
451
|
+
DeclareVars;
|
|
452
|
+
|
|
453
|
+
State2Vars2;
|
|
454
|
+
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc6 );
|
|
455
|
+
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc5 );
|
|
456
|
+
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc4 );
|
|
457
|
+
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc3 );
|
|
458
|
+
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc2 );
|
|
459
|
+
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc1 );
|
|
460
|
+
Dump1("Permutation\n");
|
|
461
|
+
Vars2State;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
void Xoodootimes4_PermuteAll_12rounds(void *argStates)
|
|
465
|
+
{
|
|
466
|
+
uint32_t *states = (uint32_t*)argStates;
|
|
467
|
+
DeclareVars;
|
|
468
|
+
|
|
469
|
+
State2Vars;
|
|
470
|
+
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc12 );
|
|
471
|
+
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc11 );
|
|
472
|
+
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc10 );
|
|
473
|
+
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc9 );
|
|
474
|
+
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc8 );
|
|
475
|
+
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc7 );
|
|
476
|
+
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc6 );
|
|
477
|
+
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc5 );
|
|
478
|
+
Round( a10, a11, a12, a13, a13, a10, a11, a12, a20, a21, a22, a23, _rc4 );
|
|
479
|
+
Round( a13, a10, a11, a12, a12, a13, a10, a11, a22, a23, a20, a21, _rc3 );
|
|
480
|
+
Round( a12, a13, a10, a11, a11, a12, a13, a10, a20, a21, a22, a23, _rc2 );
|
|
481
|
+
Round( a11, a12, a13, a10, a10, a11, a12, a13, a22, a23, a20, a21, _rc1 );
|
|
482
|
+
Dump1("Permutation\n");
|
|
483
|
+
Vars2State;
|
|
484
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The eXtended Keccak Code Package (XKCP)
|
|
3
|
+
https://github.com/XKCP/XKCP
|
|
4
|
+
|
|
5
|
+
The Xoodoo permutation, designed by Joan Daemen, Seth Hoffert, Gilles Van Assche and Ronny Van Keer.
|
|
6
|
+
|
|
7
|
+
Implementation by Ronny Van Keer, hereby denoted as "the implementer".
|
|
8
|
+
|
|
9
|
+
For more information, feedback or questions, please refer to the Keccak Team website:
|
|
10
|
+
https://keccak.team/
|
|
11
|
+
|
|
12
|
+
To the extent possible under law, the implementer has waived all copyright
|
|
13
|
+
and related or neighboring rights to the source code in this file.
|
|
14
|
+
http://creativecommons.org/publicdomain/zero/1.0/
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#ifndef _Xoodoo_times4_SnP_h_
|
|
18
|
+
#define _Xoodoo_times4_SnP_h_
|
|
19
|
+
|
|
20
|
+
/** For the documentation, see PlSnP-documentation.h.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
#define Xoodootimes4_implementation "128-bit SIMD implementation"
|
|
24
|
+
#define Xoodootimes4_statesSizeInBytes (4*3*4*4)
|
|
25
|
+
#define Xoodootimes4_statesAlignment 16
|
|
26
|
+
|
|
27
|
+
#define Xoodootimes4_StaticInitialize()
|
|
28
|
+
void Xoodootimes4_InitializeAll(void *states);
|
|
29
|
+
#define Xoodootimes4_AddByte(states, instanceIndex, byte, offset) \
|
|
30
|
+
((unsigned char*)(states))[(instanceIndex)*4 + ((offset)/4)*4*4 + (offset)%4] ^= (byte)
|
|
31
|
+
void Xoodootimes4_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
|
|
32
|
+
void Xoodootimes4_AddLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
|
|
33
|
+
void Xoodootimes4_OverwriteBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
|
|
34
|
+
void Xoodootimes4_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
|
|
35
|
+
void Xoodootimes4_OverwriteWithZeroes(void *states, unsigned int instanceIndex, unsigned int byteCount);
|
|
36
|
+
//void Xoodootimes4_PermuteAll_Nrounds(void *states, unsigned int nr);
|
|
37
|
+
void Xoodootimes4_PermuteAll_6rounds(void *states);
|
|
38
|
+
void Xoodootimes4_PermuteAll_12rounds(void *states);
|
|
39
|
+
void Xoodootimes4_ExtractBytes(const void *states, unsigned int instanceIndex, unsigned char *data, unsigned int offset, unsigned int length);
|
|
40
|
+
void Xoodootimes4_ExtractLanesAll(const void *states, unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
|
|
41
|
+
void Xoodootimes4_ExtractAndAddBytes(const void *states, unsigned int instanceIndex, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
|
|
42
|
+
void Xoodootimes4_ExtractAndAddLanesAll(const void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset);
|
|
43
|
+
|
|
44
|
+
#endif
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The eXtended Keccak Code Package (XKCP)
|
|
3
|
+
https://github.com/XKCP/XKCP
|
|
4
|
+
|
|
5
|
+
The Xoodoo permutation, designed by Joan Daemen, Seth Hoffert, Gilles Van Assche and Ronny Van Keer.
|
|
6
|
+
|
|
7
|
+
Implementation by Ronny Van Keer, hereby denoted as "the implementer".
|
|
8
|
+
|
|
9
|
+
For more information, feedback or questions, please refer to the Keccak Team website:
|
|
10
|
+
https://keccak.team/
|
|
11
|
+
|
|
12
|
+
To the extent possible under law, the implementer has waived all copyright
|
|
13
|
+
and related or neighboring rights to the source code in this file.
|
|
14
|
+
http://creativecommons.org/publicdomain/zero/1.0/
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#ifndef _Xoodoo_times4_SnP_h_
|
|
18
|
+
#define _Xoodoo_times4_SnP_h_
|
|
19
|
+
|
|
20
|
+
#include "Xoodoo-SnP.h"
|
|
21
|
+
|
|
22
|
+
/** For the documentation, see PlSnP-documentation.h.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
#define Xoodootimes4_implementation "fallback on serial implementation (" Xoodoo_implementation ")"
|
|
26
|
+
#define Xoodootimes4_statesSizeInBytes (((Xoodoo_stateSizeInBytes+(Xoodoo_stateAlignment-1))/Xoodoo_stateAlignment)*Xoodoo_stateAlignment*4)
|
|
27
|
+
#define Xoodootimes4_statesAlignment Xoodoo_stateAlignment
|
|
28
|
+
#define Xoodootimes4_isFallback
|
|
29
|
+
|
|
30
|
+
void Xoodootimes4_StaticInitialize(void);
|
|
31
|
+
void Xoodootimes4_InitializeAll(void *states);
|
|
32
|
+
void Xoodootimes4_AddByte(void *states, unsigned int instanceIndex, unsigned char data, unsigned int offset);
|
|
33
|
+
void Xoodootimes4_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
|
|
34
|
+
void Xoodootimes4_AddLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
|
|
35
|
+
void Xoodootimes4_OverwriteBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
|
|
36
|
+
void Xoodootimes4_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
|
|
37
|
+
void Xoodootimes4_OverwriteWithZeroes(void *states, unsigned int instanceIndex, unsigned int byteCount);
|
|
38
|
+
void Xoodootimes4_PermuteAll_6rounds(void *states);
|
|
39
|
+
void Xoodootimes4_PermuteAll_12rounds(void *states);
|
|
40
|
+
void Xoodootimes4_ExtractBytes(const void *states, unsigned int instanceIndex, unsigned char *data, unsigned int offset, unsigned int length);
|
|
41
|
+
void Xoodootimes4_ExtractLanesAll(const void *states, unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
|
|
42
|
+
void Xoodootimes4_ExtractAndAddBytes(const void *states, unsigned int instanceIndex, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
|
|
43
|
+
void Xoodootimes4_ExtractAndAddLanesAll(const void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset);
|
|
44
|
+
|
|
45
|
+
#endif
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
|
|
18
|
+
This file implements Xoodoo×4 in a PlSnP-compatible way.
|
|
19
|
+
Please refer to PlSnP-documentation.h for more details.
|
|
20
|
+
|
|
21
|
+
This implementation comes with Xoodoo-times4-SnP.h in the same folder.
|
|
22
|
+
Please refer to LowLevel.build for the exact list of other files it must be combined with.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
#include "Xoodoo-SnP.h"
|
|
26
|
+
|
|
27
|
+
#define prefix Xoodootimes4
|
|
28
|
+
#define PlSnP_baseParallelism 1
|
|
29
|
+
#define PlSnP_targetParallelism 4
|
|
30
|
+
#define SnP_laneLengthInBytes 4
|
|
31
|
+
#define SnP Xoodoo
|
|
32
|
+
#define SnP_Permute Xoodoo_Permute_6rounds
|
|
33
|
+
#define SnP_Permute_12rounds Xoodoo_Permute_12rounds
|
|
34
|
+
#define PlSnP_PermuteAll Xoodootimes4_PermuteAll_6rounds
|
|
35
|
+
#define PlSnP_PermuteAll_12rounds Xoodootimes4_PermuteAll_12rounds
|
|
36
|
+
|
|
37
|
+
#include "PlSnP-Fallback.inc"
|