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