sleeping_kangaroo12 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +27 -0
- data/README.md +48 -53
- data/ext/Rakefile +12 -37
- data/ext/binding/sleeping_kangaroo12.c +1 -16
- data/ext/{xkcp → k12}/Makefile +0 -0
- data/ext/k12/Makefile.build +118 -0
- data/ext/k12/README.markdown +86 -0
- data/ext/k12/lib/ARMv8Asha3/KeccakP-1600-ARMv8Asha3.S +623 -0
- data/ext/k12/lib/ARMv8Asha3/KeccakP-1600-SnP.h +65 -0
- data/ext/k12/lib/ARMv8Asha3/KeccakP-1600-opt64.c +227 -0
- data/ext/{xkcp/lib/low/KeccakP-1600/compact → k12/lib/Inplace32BI}/KeccakP-1600-SnP.h +4 -9
- data/ext/{xkcp/lib/low/KeccakP-1600/plain-32bits-inplace → k12/lib/Inplace32BI}/KeccakP-1600-inplace32BI.c +65 -160
- data/ext/k12/lib/KangarooTwelve.c +332 -0
- data/ext/{xkcp/lib/high/KangarooTwelve → k12/lib}/KangarooTwelve.h +53 -16
- data/ext/{xkcp/lib/low/KeccakP-1600/AVX2 → k12/lib/Optimized64}/KeccakP-1600-AVX2.s +122 -558
- data/ext/k12/lib/Optimized64/KeccakP-1600-AVX512-plainC.c +241 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-AVX512.s +551 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-SnP.h +74 -0
- data/ext/{xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-64.macros → k12/lib/Optimized64/KeccakP-1600-opt64.c} +447 -169
- data/ext/k12/lib/Optimized64/KeccakP-1600-runtimeDispatch.c +406 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-AVX2.c +419 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-AVX512.c +458 -0
- data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-SSSE3.c +438 -0
- data/ext/{xkcp/lib/low/KeccakP-1600/plain-64bits → k12/lib/Plain64}/KeccakP-1600-SnP.h +14 -20
- data/ext/{xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.h → k12/lib/Plain64/KeccakP-1600-plain64.c} +9 -8
- data/ext/{xkcp/lib/common → k12/lib}/align.h +3 -2
- data/ext/{xkcp/lib/common → k12/lib}/brg_endian.h +0 -0
- data/ext/{xkcp → k12}/support/Build/ExpandProducts.xsl +0 -0
- data/ext/{xkcp → k12}/support/Build/ToGlobalMakefile.xsl +0 -0
- data/ext/{xkcp → k12}/support/Build/ToOneTarget.xsl +0 -0
- data/ext/{xkcp → k12}/support/Build/ToTargetConfigFile.xsl +0 -0
- data/ext/{xkcp → k12}/support/Build/ToTargetMakefile.xsl +10 -16
- data/ext/{xkcp → k12}/support/Build/ToVCXProj.xsl +0 -0
- data/lib/sleeping_kangaroo12/binding.rb +2 -1
- data/lib/sleeping_kangaroo12/build/loader.rb +1 -0
- data/lib/sleeping_kangaroo12/build/platform.rb +1 -0
- data/lib/sleeping_kangaroo12/digest.rb +38 -4
- data/lib/sleeping_kangaroo12/version.rb +1 -1
- metadata +48 -288
- data/ext/config/xkcp.build +0 -17
- data/ext/xkcp/LICENSE +0 -1
- data/ext/xkcp/Makefile.build +0 -200
- data/ext/xkcp/README.markdown +0 -296
- data/ext/xkcp/lib/HighLevel.build +0 -143
- data/ext/xkcp/lib/LowLevel.build +0 -757
- data/ext/xkcp/lib/high/KangarooTwelve/KangarooTwelve.c +0 -301
- data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.c +0 -81
- data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.h +0 -125
- data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.c +0 -48
- data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.h +0 -79
- data/ext/xkcp/lib/high/Keccak/KeccakDuplex.c +0 -81
- data/ext/xkcp/lib/high/Keccak/KeccakDuplex.h +0 -73
- data/ext/xkcp/lib/high/Keccak/KeccakDuplex.inc +0 -195
- data/ext/xkcp/lib/high/Keccak/KeccakSponge.c +0 -111
- data/ext/xkcp/lib/high/Keccak/KeccakSponge.h +0 -76
- data/ext/xkcp/lib/high/Keccak/KeccakSponge.inc +0 -314
- data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.c +0 -61
- data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.h +0 -67
- data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.inc +0 -128
- data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.c +0 -93
- data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.h +0 -599
- data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.inc +0 -573
- data/ext/xkcp/lib/high/Ketje/Ketjev2.c +0 -87
- data/ext/xkcp/lib/high/Ketje/Ketjev2.h +0 -88
- data/ext/xkcp/lib/high/Ketje/Ketjev2.inc +0 -274
- data/ext/xkcp/lib/high/Keyak/Keyakv2.c +0 -132
- data/ext/xkcp/lib/high/Keyak/Keyakv2.h +0 -217
- data/ext/xkcp/lib/high/Keyak/Keyakv2.inc +0 -81
- data/ext/xkcp/lib/high/Keyak/Motorist.inc +0 -953
- data/ext/xkcp/lib/high/Kravatte/Kravatte.c +0 -533
- data/ext/xkcp/lib/high/Kravatte/Kravatte.h +0 -115
- data/ext/xkcp/lib/high/Kravatte/KravatteModes.c +0 -557
- data/ext/xkcp/lib/high/Kravatte/KravatteModes.h +0 -247
- data/ext/xkcp/lib/high/Xoodyak/Cyclist.h +0 -66
- data/ext/xkcp/lib/high/Xoodyak/Cyclist.inc +0 -336
- data/ext/xkcp/lib/high/Xoodyak/Xoodyak-parameters.h +0 -26
- data/ext/xkcp/lib/high/Xoodyak/Xoodyak.c +0 -55
- data/ext/xkcp/lib/high/Xoodyak/Xoodyak.h +0 -35
- data/ext/xkcp/lib/high/Xoofff/Xoofff.c +0 -634
- data/ext/xkcp/lib/high/Xoofff/Xoofff.h +0 -147
- data/ext/xkcp/lib/high/Xoofff/XoofffModes.c +0 -483
- data/ext/xkcp/lib/high/Xoofff/XoofffModes.h +0 -241
- data/ext/xkcp/lib/high/common/Phases.h +0 -25
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-armcc.s +0 -1666
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-gcc.s +0 -1655
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-armcc.s +0 -1268
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-gcc.s +0 -1264
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-armcc.s +0 -1178
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-gcc.s +0 -1175
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-armcc.s +0 -1338
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-gcc.s +0 -1336
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-armcc.s +0 -1343
- data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-gcc.s +0 -1339
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-armcc.s +0 -823
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-gcc.s +0 -831
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-SnP.h +0 -31
- data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-armv8a-neon.s +0 -540
- data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-compact.s +0 -733
- data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-fast.s +0 -1121
- data/ext/xkcp/lib/low/KeccakP-1600/AVX2/KeccakP-1600-SnP.h +0 -52
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-AVX512.c +0 -623
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-SnP.h +0 -47
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u12/KeccakP-1600-AVX512-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u6/KeccakP-1600-AVX512-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/ua/KeccakP-1600-AVX512-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-AVX512.s +0 -1031
- data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-SnP.h +0 -53
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-SnP.h +0 -44
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-XOP.c +0 -476
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/u6/KeccakP-1600-XOP-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/XOP/ua/KeccakP-1600-XOP-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-unrolling.macros +0 -305
- data/ext/xkcp/lib/low/KeccakP-1600/compact/KeccakP-1600-compact64.c +0 -420
- data/ext/xkcp/lib/low/KeccakP-1600/plain-32bits-inplace/KeccakP-1600-SnP.h +0 -43
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/KeccakP-1600-opt64.c +0 -565
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcu6/KeccakP-1600-opt64-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua/KeccakP-1600-opt64-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua-shld/KeccakP-1600-opt64-config.h +0 -8
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/u6/KeccakP-1600-opt64-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/ua/KeccakP-1600-opt64-config.h +0 -6
- data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-SnP.h +0 -44
- data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference.h +0 -23
- data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference32BI.c +0 -625
- data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-SnP.h +0 -44
- data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.c +0 -440
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas.s +0 -1196
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas_Apple.s +0 -1124
- data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-shld-gas.s +0 -1196
- data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-armcc.s +0 -1392
- data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-gcc.s +0 -1394
- data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-times2-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u12/SIMD512-2-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u4/SIMD512-2-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512ufull/SIMD512-2-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SIMD512.c +0 -850
- data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SnP.h +0 -51
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SIMD128.c +0 -957
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SnP.h +0 -49
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-u2/SIMD128-config.h +0 -8
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-ua/SIMD128-config.h +0 -8
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-u2/SIMD128-config.h +0 -9
- data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-ua/SIMD128-config.h +0 -9
- data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-on1.c +0 -37
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SIMD256.c +0 -1321
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SnP.h +0 -55
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u12/SIMD256-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u6/SIMD256-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/ua/SIMD256-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u12/SIMD512-4-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u4/SIMD512-4-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512ufull/SIMD512-4-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SIMD512.c +0 -881
- data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SnP.h +0 -51
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-on1.c +0 -37
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-on2.c +0 -38
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SIMD512.c +0 -1615
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SnP.h +0 -57
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u12/SIMD512-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u4/SIMD512-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/ua/SIMD512-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-on1.c +0 -37
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-on2.c +0 -38
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-SnP.h +0 -45
- data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-on4.c +0 -38
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-armcc.s +0 -442
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-gcc.s +0 -446
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-armcc.s +0 -419
- data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-gcc.s +0 -427
- data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-avr8-fast.s +0 -647
- data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-SnP.h +0 -39
- data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-compact.c +0 -190
- data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-SnP.h +0 -43
- data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.c +0 -412
- data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.h +0 -23
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-armcc.s +0 -454
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-gcc.s +0 -458
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-armcc.s +0 -455
- data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-gcc.s +0 -458
- data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-SnP.h +0 -41
- data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-avr8-fast.s +0 -728
- data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-SnP.h +0 -43
- data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.c +0 -414
- data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.h +0 -23
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-armcc.s +0 -527
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-gcc.s +0 -533
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-armcc.s +0 -528
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-gcc.s +0 -534
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-armcc.s +0 -521
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-gcc.s +0 -527
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-armcc.s +0 -517
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-gcc.s +0 -523
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-armcc.s +0 -550
- data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-gcc.s +0 -556
- data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-SnP.h +0 -32
- data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-armv8a-neon.s +0 -432
- data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-SnP.h +0 -42
- data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-avr8-fast.s +0 -929
- data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-SnP.h +0 -40
- data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-compact.c +0 -244
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-SnP.h +0 -46
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32-bis.macros +0 -184
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.c +0 -454
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.macros +0 -459
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling-bis.macros +0 -83
- data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling.macros +0 -88
- data/ext/xkcp/lib/low/KeccakP-800/plain/lcu2/KeccakP-800-opt32-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-800/plain/lcua/KeccakP-800-opt32-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-800/plain/u2/KeccakP-800-opt32-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-800/plain/ua/KeccakP-800-opt32-config.h +0 -7
- data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-SnP.h +0 -44
- data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.c +0 -437
- data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.h +0 -23
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/Ket.h +0 -57
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-armcc.s +0 -475
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-gcc.s +0 -480
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-armcc.s +0 -590
- data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-gcc.s +0 -590
- data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.c +0 -126
- data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.h +0 -68
- data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.inc +0 -174
- data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.c +0 -80
- data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.h +0 -68
- data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.inc +0 -142
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-SnP.h +0 -55
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-armcc.s +0 -1086
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-gcc.s +0 -1092
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-armcc.s +0 -721
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-gcc.s +0 -726
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-armcc.s +0 -723
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-gcc.s +0 -729
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-armcc.s +0 -1164
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-gcc.s +0 -1165
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-armcc.s +0 -562
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-gcc.s +0 -563
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-armcc.s +0 -563
- data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-gcc.s +0 -565
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-SnP.h +0 -55
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-armcc.s +0 -476
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-gcc.s +0 -485
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-armcc.s +0 -362
- data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-gcc.s +0 -367
- data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-SnP.h +0 -43
- data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-avr8-u1.s +0 -1341
- data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SIMD512.c +0 -581
- data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SnP.h +0 -58
- data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodyak-full-block-SIMD512.c +0 -332
- data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SIMD128.c +0 -329
- data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SnP.h +0 -53
- data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodyak-full-block-SIMD128.c +0 -355
- data/ext/xkcp/lib/low/Xoodoo/Xoodoo.h +0 -79
- data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-SnP.h +0 -56
- data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-optimized.c +0 -399
- data/ext/xkcp/lib/low/Xoodoo/plain/Xoodyak-full-blocks.c +0 -127
- data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-SnP.h +0 -43
- data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-reference.c +0 -253
- data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SIMD512.c +0 -1044
- data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SnP.h +0 -49
- data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-SnP.h +0 -45
- data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-on1.c +0 -37
- data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-ARMv7A.s +0 -1587
- data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-SnP.h +0 -48
- data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SIMD512.c +0 -1202
- data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SnP.h +0 -48
- data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SIMD128.c +0 -484
- data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SnP.h +0 -44
- data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-SnP.h +0 -45
- data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-on1.c +0 -37
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SIMD256.c +0 -939
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SnP.h +0 -49
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SIMD512.c +0 -1216
- data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SnP.h +0 -48
- data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-SnP.h +0 -45
- data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-on1.c +0 -37
- data/ext/xkcp/lib/low/common/PlSnP-Fallback.inc +0 -290
- data/ext/xkcp/lib/low/common/SnP-Relaned.h +0 -141
- data/ext/xkcp/support/Kernel-PMU/Kernel-pmu.md +0 -133
- data/ext/xkcp/support/Kernel-PMU/Makefile +0 -8
- data/ext/xkcp/support/Kernel-PMU/enable_arm_pmu.c +0 -129
- data/ext/xkcp/support/Kernel-PMU/load-module +0 -1
- data/ext/xkcp/util/KeccakSum/KeccakSum.c +0 -394
- data/ext/xkcp/util/KeccakSum/base64.c +0 -86
- data/ext/xkcp/util/KeccakSum/base64.h +0 -12
@@ -1,565 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
The eXtended Keccak Code Package (XKCP)
|
3
|
-
https://github.com/XKCP/XKCP
|
4
|
-
|
5
|
-
The Keccak-p permutations, designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.
|
6
|
-
|
7
|
-
Implementation by Gilles Van Assche and 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 Keccak-p[1600] in a SnP-compatible way.
|
19
|
-
Please refer to SnP-documentation.h for more details.
|
20
|
-
|
21
|
-
This implementation comes with KeccakP-1600-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 <stdint.h>
|
26
|
-
#include <string.h>
|
27
|
-
#include <stdlib.h>
|
28
|
-
#include "brg_endian.h"
|
29
|
-
#include "KeccakP-1600-opt64-config.h"
|
30
|
-
|
31
|
-
#if defined(KeccakP1600_useLaneComplementing)
|
32
|
-
#define UseBebigokimisa
|
33
|
-
#endif
|
34
|
-
|
35
|
-
#if defined(_MSC_VER)
|
36
|
-
#define ROL64(a, offset) _rotl64(a, offset)
|
37
|
-
#elif defined(KeccakP1600_useSHLD)
|
38
|
-
#define ROL64(x,N) ({ \
|
39
|
-
register uint64_t __out; \
|
40
|
-
register uint64_t __in = x; \
|
41
|
-
__asm__ ("shld %2,%0,%0" : "=r"(__out) : "0"(__in), "i"(N)); \
|
42
|
-
__out; \
|
43
|
-
})
|
44
|
-
#else
|
45
|
-
#define ROL64(a, offset) ((((uint64_t)a) << offset) ^ (((uint64_t)a) >> (64-offset)))
|
46
|
-
#endif
|
47
|
-
|
48
|
-
#include "KeccakP-1600-64.macros"
|
49
|
-
#ifdef KeccakP1600_fullUnrolling
|
50
|
-
#define FullUnrolling
|
51
|
-
#else
|
52
|
-
#define Unrolling KeccakP1600_unrolling
|
53
|
-
#endif
|
54
|
-
#include "KeccakP-1600-unrolling.macros"
|
55
|
-
#include "SnP-Relaned.h"
|
56
|
-
|
57
|
-
static const uint64_t KeccakF1600RoundConstants[24] = {
|
58
|
-
0x0000000000000001ULL,
|
59
|
-
0x0000000000008082ULL,
|
60
|
-
0x800000000000808aULL,
|
61
|
-
0x8000000080008000ULL,
|
62
|
-
0x000000000000808bULL,
|
63
|
-
0x0000000080000001ULL,
|
64
|
-
0x8000000080008081ULL,
|
65
|
-
0x8000000000008009ULL,
|
66
|
-
0x000000000000008aULL,
|
67
|
-
0x0000000000000088ULL,
|
68
|
-
0x0000000080008009ULL,
|
69
|
-
0x000000008000000aULL,
|
70
|
-
0x000000008000808bULL,
|
71
|
-
0x800000000000008bULL,
|
72
|
-
0x8000000000008089ULL,
|
73
|
-
0x8000000000008003ULL,
|
74
|
-
0x8000000000008002ULL,
|
75
|
-
0x8000000000000080ULL,
|
76
|
-
0x000000000000800aULL,
|
77
|
-
0x800000008000000aULL,
|
78
|
-
0x8000000080008081ULL,
|
79
|
-
0x8000000000008080ULL,
|
80
|
-
0x0000000080000001ULL,
|
81
|
-
0x8000000080008008ULL };
|
82
|
-
|
83
|
-
/* ---------------------------------------------------------------- */
|
84
|
-
|
85
|
-
void KeccakP1600_Initialize(void *state)
|
86
|
-
{
|
87
|
-
memset(state, 0, 200);
|
88
|
-
#ifdef KeccakP1600_useLaneComplementing
|
89
|
-
((uint64_t*)state)[ 1] = ~(uint64_t)0;
|
90
|
-
((uint64_t*)state)[ 2] = ~(uint64_t)0;
|
91
|
-
((uint64_t*)state)[ 8] = ~(uint64_t)0;
|
92
|
-
((uint64_t*)state)[12] = ~(uint64_t)0;
|
93
|
-
((uint64_t*)state)[17] = ~(uint64_t)0;
|
94
|
-
((uint64_t*)state)[20] = ~(uint64_t)0;
|
95
|
-
#endif
|
96
|
-
}
|
97
|
-
|
98
|
-
/* ---------------------------------------------------------------- */
|
99
|
-
|
100
|
-
void KeccakP1600_AddBytesInLane(void *state, unsigned int lanePosition, const unsigned char *data, unsigned int offset, unsigned int length)
|
101
|
-
{
|
102
|
-
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
103
|
-
uint64_t lane;
|
104
|
-
if (length == 0)
|
105
|
-
return;
|
106
|
-
if (length == 1)
|
107
|
-
lane = data[0];
|
108
|
-
else {
|
109
|
-
lane = 0;
|
110
|
-
memcpy(&lane, data, length);
|
111
|
-
}
|
112
|
-
lane <<= offset*8;
|
113
|
-
#else
|
114
|
-
uint64_t lane = 0;
|
115
|
-
unsigned int i;
|
116
|
-
for(i=0; i<length; i++)
|
117
|
-
lane |= ((uint64_t)data[i]) << ((i+offset)*8);
|
118
|
-
#endif
|
119
|
-
((uint64_t*)state)[lanePosition] ^= lane;
|
120
|
-
}
|
121
|
-
|
122
|
-
/* ---------------------------------------------------------------- */
|
123
|
-
|
124
|
-
void KeccakP1600_AddLanes(void *state, const unsigned char *data, unsigned int laneCount)
|
125
|
-
{
|
126
|
-
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
127
|
-
unsigned int i = 0;
|
128
|
-
#ifdef NO_MISALIGNED_ACCESSES
|
129
|
-
/* If either pointer is misaligned, fall back to byte-wise xor. */
|
130
|
-
if (((((uintptr_t)state) & 7) != 0) || ((((uintptr_t)data) & 7) != 0)) {
|
131
|
-
for (i = 0; i < laneCount * 8; i++) {
|
132
|
-
((unsigned char*)state)[i] ^= data[i];
|
133
|
-
}
|
134
|
-
}
|
135
|
-
else
|
136
|
-
#endif
|
137
|
-
{
|
138
|
-
/* Otherwise... */
|
139
|
-
for( ; (i+8)<=laneCount; i+=8) {
|
140
|
-
((uint64_t*)state)[i+0] ^= ((uint64_t*)data)[i+0];
|
141
|
-
((uint64_t*)state)[i+1] ^= ((uint64_t*)data)[i+1];
|
142
|
-
((uint64_t*)state)[i+2] ^= ((uint64_t*)data)[i+2];
|
143
|
-
((uint64_t*)state)[i+3] ^= ((uint64_t*)data)[i+3];
|
144
|
-
((uint64_t*)state)[i+4] ^= ((uint64_t*)data)[i+4];
|
145
|
-
((uint64_t*)state)[i+5] ^= ((uint64_t*)data)[i+5];
|
146
|
-
((uint64_t*)state)[i+6] ^= ((uint64_t*)data)[i+6];
|
147
|
-
((uint64_t*)state)[i+7] ^= ((uint64_t*)data)[i+7];
|
148
|
-
}
|
149
|
-
for( ; (i+4)<=laneCount; i+=4) {
|
150
|
-
((uint64_t*)state)[i+0] ^= ((uint64_t*)data)[i+0];
|
151
|
-
((uint64_t*)state)[i+1] ^= ((uint64_t*)data)[i+1];
|
152
|
-
((uint64_t*)state)[i+2] ^= ((uint64_t*)data)[i+2];
|
153
|
-
((uint64_t*)state)[i+3] ^= ((uint64_t*)data)[i+3];
|
154
|
-
}
|
155
|
-
for( ; (i+2)<=laneCount; i+=2) {
|
156
|
-
((uint64_t*)state)[i+0] ^= ((uint64_t*)data)[i+0];
|
157
|
-
((uint64_t*)state)[i+1] ^= ((uint64_t*)data)[i+1];
|
158
|
-
}
|
159
|
-
if (i<laneCount) {
|
160
|
-
((uint64_t*)state)[i+0] ^= ((uint64_t*)data)[i+0];
|
161
|
-
}
|
162
|
-
}
|
163
|
-
#else
|
164
|
-
unsigned int i;
|
165
|
-
const uint8_t *curData = data;
|
166
|
-
for(i=0; i<laneCount; i++, curData+=8) {
|
167
|
-
uint64_t lane = (uint64_t)curData[0]
|
168
|
-
| ((uint64_t)curData[1] << 8)
|
169
|
-
| ((uint64_t)curData[2] << 16)
|
170
|
-
| ((uint64_t)curData[3] << 24)
|
171
|
-
| ((uint64_t)curData[4] << 32)
|
172
|
-
| ((uint64_t)curData[5] << 40)
|
173
|
-
| ((uint64_t)curData[6] << 48)
|
174
|
-
| ((uint64_t)curData[7] << 56);
|
175
|
-
((uint64_t*)state)[i] ^= lane;
|
176
|
-
}
|
177
|
-
#endif
|
178
|
-
}
|
179
|
-
|
180
|
-
/* ---------------------------------------------------------------- */
|
181
|
-
|
182
|
-
#if (PLATFORM_BYTE_ORDER != IS_LITTLE_ENDIAN)
|
183
|
-
void KeccakP1600_AddByte(void *state, unsigned char byte, unsigned int offset)
|
184
|
-
{
|
185
|
-
uint64_t lane = byte;
|
186
|
-
lane <<= (offset%8)*8;
|
187
|
-
((uint64_t*)state)[offset/8] ^= lane;
|
188
|
-
}
|
189
|
-
#endif
|
190
|
-
|
191
|
-
/* ---------------------------------------------------------------- */
|
192
|
-
|
193
|
-
void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
|
194
|
-
{
|
195
|
-
SnP_AddBytes(state, data, offset, length, KeccakP1600_AddLanes, KeccakP1600_AddBytesInLane, 8);
|
196
|
-
}
|
197
|
-
|
198
|
-
/* ---------------------------------------------------------------- */
|
199
|
-
|
200
|
-
void KeccakP1600_OverwriteBytesInLane(void *state, unsigned int lanePosition, const unsigned char *data, unsigned int offset, unsigned int length)
|
201
|
-
{
|
202
|
-
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
203
|
-
#ifdef KeccakP1600_useLaneComplementing
|
204
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20)) {
|
205
|
-
unsigned int i;
|
206
|
-
for(i=0; i<length; i++)
|
207
|
-
((unsigned char*)state)[lanePosition*8+offset+i] = ~data[i];
|
208
|
-
}
|
209
|
-
else
|
210
|
-
#endif
|
211
|
-
{
|
212
|
-
memcpy((unsigned char*)state+lanePosition*8+offset, data, length);
|
213
|
-
}
|
214
|
-
#else
|
215
|
-
uint64_t lane = ((uint64_t*)state)[lanePosition];
|
216
|
-
unsigned int i;
|
217
|
-
for(i=0; i<length; i++) {
|
218
|
-
lane &= ~((uint64_t)0xFF << ((offset+i)*8));
|
219
|
-
#ifdef KeccakP1600_useLaneComplementing
|
220
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20))
|
221
|
-
lane |= (uint64_t)(data[i] ^ 0xFF) << ((offset+i)*8);
|
222
|
-
else
|
223
|
-
#endif
|
224
|
-
lane |= (uint64_t)data[i] << ((offset+i)*8);
|
225
|
-
}
|
226
|
-
((uint64_t*)state)[lanePosition] = lane;
|
227
|
-
#endif
|
228
|
-
}
|
229
|
-
|
230
|
-
/* ---------------------------------------------------------------- */
|
231
|
-
|
232
|
-
void KeccakP1600_OverwriteLanes(void *state, const unsigned char *data, unsigned int laneCount)
|
233
|
-
{
|
234
|
-
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
235
|
-
#ifdef KeccakP1600_useLaneComplementing
|
236
|
-
unsigned int lanePosition;
|
237
|
-
|
238
|
-
for(lanePosition=0; lanePosition<laneCount; lanePosition++)
|
239
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20))
|
240
|
-
((uint64_t*)state)[lanePosition] = ~((const uint64_t*)data)[lanePosition];
|
241
|
-
else
|
242
|
-
((uint64_t*)state)[lanePosition] = ((const uint64_t*)data)[lanePosition];
|
243
|
-
#else
|
244
|
-
memcpy(state, data, laneCount*8);
|
245
|
-
#endif
|
246
|
-
#else
|
247
|
-
unsigned int lanePosition;
|
248
|
-
const uint8_t *curData = data;
|
249
|
-
for(lanePosition=0; lanePosition<laneCount; lanePosition++, curData+=8) {
|
250
|
-
uint64_t lane = (uint64_t)curData[0]
|
251
|
-
| ((uint64_t)curData[1] << 8)
|
252
|
-
| ((uint64_t)curData[2] << 16)
|
253
|
-
| ((uint64_t)curData[3] << 24)
|
254
|
-
| ((uint64_t)curData[4] << 32)
|
255
|
-
| ((uint64_t)curData[5] << 40)
|
256
|
-
| ((uint64_t)curData[6] << 48)
|
257
|
-
| ((uint64_t)curData[7] << 56);
|
258
|
-
#ifdef KeccakP1600_useLaneComplementing
|
259
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20))
|
260
|
-
((uint64_t*)state)[lanePosition] = ~lane;
|
261
|
-
else
|
262
|
-
#endif
|
263
|
-
((uint64_t*)state)[lanePosition] = lane;
|
264
|
-
}
|
265
|
-
#endif
|
266
|
-
}
|
267
|
-
|
268
|
-
/* ---------------------------------------------------------------- */
|
269
|
-
|
270
|
-
void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
|
271
|
-
{
|
272
|
-
SnP_OverwriteBytes(state, data, offset, length, KeccakP1600_OverwriteLanes, KeccakP1600_OverwriteBytesInLane, 8);
|
273
|
-
}
|
274
|
-
|
275
|
-
/* ---------------------------------------------------------------- */
|
276
|
-
|
277
|
-
void KeccakP1600_OverwriteWithZeroes(void *state, unsigned int byteCount)
|
278
|
-
{
|
279
|
-
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
280
|
-
#ifdef KeccakP1600_useLaneComplementing
|
281
|
-
unsigned int lanePosition;
|
282
|
-
|
283
|
-
for(lanePosition=0; lanePosition<byteCount/8; lanePosition++)
|
284
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20))
|
285
|
-
((uint64_t*)state)[lanePosition] = ~0;
|
286
|
-
else
|
287
|
-
((uint64_t*)state)[lanePosition] = 0;
|
288
|
-
if (byteCount%8 != 0) {
|
289
|
-
lanePosition = byteCount/8;
|
290
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20))
|
291
|
-
memset((unsigned char*)state+lanePosition*8, 0xFF, byteCount%8);
|
292
|
-
else
|
293
|
-
memset((unsigned char*)state+lanePosition*8, 0, byteCount%8);
|
294
|
-
}
|
295
|
-
#else
|
296
|
-
memset(state, 0, byteCount);
|
297
|
-
#endif
|
298
|
-
#else
|
299
|
-
unsigned int i, j;
|
300
|
-
for(i=0; i<byteCount; i+=8) {
|
301
|
-
unsigned int lanePosition = i/8;
|
302
|
-
if (i+8 <= byteCount) {
|
303
|
-
#ifdef KeccakP1600_useLaneComplementing
|
304
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20))
|
305
|
-
((uint64_t*)state)[lanePosition] = ~(uint64_t)0;
|
306
|
-
else
|
307
|
-
#endif
|
308
|
-
((uint64_t*)state)[lanePosition] = 0;
|
309
|
-
}
|
310
|
-
else {
|
311
|
-
uint64_t lane = ((uint64_t*)state)[lanePosition];
|
312
|
-
for(j=0; j<byteCount%8; j++) {
|
313
|
-
#ifdef KeccakP1600_useLaneComplementing
|
314
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20))
|
315
|
-
lane |= (uint64_t)0xFF << (j*8);
|
316
|
-
else
|
317
|
-
#endif
|
318
|
-
lane &= ~((uint64_t)0xFF << (j*8));
|
319
|
-
}
|
320
|
-
((uint64_t*)state)[lanePosition] = lane;
|
321
|
-
}
|
322
|
-
}
|
323
|
-
#endif
|
324
|
-
}
|
325
|
-
|
326
|
-
/* ---------------------------------------------------------------- */
|
327
|
-
|
328
|
-
void KeccakP1600_Permute_Nrounds(void *state, unsigned int nr)
|
329
|
-
{
|
330
|
-
declareABCDE
|
331
|
-
unsigned int i;
|
332
|
-
uint64_t *stateAsLanes = (uint64_t*)state;
|
333
|
-
|
334
|
-
copyFromState(A, stateAsLanes)
|
335
|
-
roundsN(nr)
|
336
|
-
copyToState(stateAsLanes, A)
|
337
|
-
|
338
|
-
}
|
339
|
-
|
340
|
-
/* ---------------------------------------------------------------- */
|
341
|
-
|
342
|
-
void KeccakP1600_Permute_24rounds(void *state)
|
343
|
-
{
|
344
|
-
declareABCDE
|
345
|
-
#ifndef KeccakP1600_fullUnrolling
|
346
|
-
unsigned int i;
|
347
|
-
#endif
|
348
|
-
uint64_t *stateAsLanes = (uint64_t*)state;
|
349
|
-
|
350
|
-
copyFromState(A, stateAsLanes)
|
351
|
-
rounds24
|
352
|
-
copyToState(stateAsLanes, A)
|
353
|
-
}
|
354
|
-
|
355
|
-
/* ---------------------------------------------------------------- */
|
356
|
-
|
357
|
-
void KeccakP1600_Permute_12rounds(void *state)
|
358
|
-
{
|
359
|
-
declareABCDE
|
360
|
-
#ifndef KeccakP1600_fullUnrolling
|
361
|
-
unsigned int i;
|
362
|
-
#endif
|
363
|
-
uint64_t *stateAsLanes = (uint64_t*)state;
|
364
|
-
|
365
|
-
copyFromState(A, stateAsLanes)
|
366
|
-
rounds12
|
367
|
-
copyToState(stateAsLanes, A)
|
368
|
-
}
|
369
|
-
|
370
|
-
/* ---------------------------------------------------------------- */
|
371
|
-
|
372
|
-
void KeccakP1600_ExtractBytesInLane(const void *state, unsigned int lanePosition, unsigned char *data, unsigned int offset, unsigned int length)
|
373
|
-
{
|
374
|
-
uint64_t lane = ((uint64_t*)state)[lanePosition];
|
375
|
-
#ifdef KeccakP1600_useLaneComplementing
|
376
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20))
|
377
|
-
lane = ~lane;
|
378
|
-
#endif
|
379
|
-
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
380
|
-
{
|
381
|
-
uint64_t lane1[1];
|
382
|
-
lane1[0] = lane;
|
383
|
-
memcpy(data, (uint8_t*)lane1+offset, length);
|
384
|
-
}
|
385
|
-
#else
|
386
|
-
unsigned int i;
|
387
|
-
lane >>= offset*8;
|
388
|
-
for(i=0; i<length; i++) {
|
389
|
-
data[i] = lane & 0xFF;
|
390
|
-
lane >>= 8;
|
391
|
-
}
|
392
|
-
#endif
|
393
|
-
}
|
394
|
-
|
395
|
-
/* ---------------------------------------------------------------- */
|
396
|
-
|
397
|
-
#if (PLATFORM_BYTE_ORDER != IS_LITTLE_ENDIAN)
|
398
|
-
static void fromWordToBytes(uint8_t *bytes, const uint64_t word)
|
399
|
-
{
|
400
|
-
unsigned int i;
|
401
|
-
|
402
|
-
for(i=0; i<(64/8); i++)
|
403
|
-
bytes[i] = (word >> (8*i)) & 0xFF;
|
404
|
-
}
|
405
|
-
#endif
|
406
|
-
|
407
|
-
void KeccakP1600_ExtractLanes(const void *state, unsigned char *data, unsigned int laneCount)
|
408
|
-
{
|
409
|
-
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
410
|
-
memcpy(data, state, laneCount*8);
|
411
|
-
#else
|
412
|
-
unsigned int i;
|
413
|
-
|
414
|
-
for(i=0; i<laneCount; i++)
|
415
|
-
fromWordToBytes(data+(i*8), ((const uint64_t*)state)[i]);
|
416
|
-
#endif
|
417
|
-
#ifdef KeccakP1600_useLaneComplementing
|
418
|
-
if (laneCount > 1) {
|
419
|
-
((uint64_t*)data)[ 1] = ~((uint64_t*)data)[ 1];
|
420
|
-
if (laneCount > 2) {
|
421
|
-
((uint64_t*)data)[ 2] = ~((uint64_t*)data)[ 2];
|
422
|
-
if (laneCount > 8) {
|
423
|
-
((uint64_t*)data)[ 8] = ~((uint64_t*)data)[ 8];
|
424
|
-
if (laneCount > 12) {
|
425
|
-
((uint64_t*)data)[12] = ~((uint64_t*)data)[12];
|
426
|
-
if (laneCount > 17) {
|
427
|
-
((uint64_t*)data)[17] = ~((uint64_t*)data)[17];
|
428
|
-
if (laneCount > 20) {
|
429
|
-
((uint64_t*)data)[20] = ~((uint64_t*)data)[20];
|
430
|
-
}
|
431
|
-
}
|
432
|
-
}
|
433
|
-
}
|
434
|
-
}
|
435
|
-
}
|
436
|
-
#endif
|
437
|
-
}
|
438
|
-
|
439
|
-
/* ---------------------------------------------------------------- */
|
440
|
-
|
441
|
-
void KeccakP1600_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length)
|
442
|
-
{
|
443
|
-
SnP_ExtractBytes(state, data, offset, length, KeccakP1600_ExtractLanes, KeccakP1600_ExtractBytesInLane, 8);
|
444
|
-
}
|
445
|
-
|
446
|
-
/* ---------------------------------------------------------------- */
|
447
|
-
|
448
|
-
void KeccakP1600_ExtractAndAddBytesInLane(const void *state, unsigned int lanePosition, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
|
449
|
-
{
|
450
|
-
uint64_t lane = ((uint64_t*)state)[lanePosition];
|
451
|
-
#ifdef KeccakP1600_useLaneComplementing
|
452
|
-
if ((lanePosition == 1) || (lanePosition == 2) || (lanePosition == 8) || (lanePosition == 12) || (lanePosition == 17) || (lanePosition == 20))
|
453
|
-
lane = ~lane;
|
454
|
-
#endif
|
455
|
-
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
456
|
-
{
|
457
|
-
unsigned int i;
|
458
|
-
uint64_t lane1[1];
|
459
|
-
lane1[0] = lane;
|
460
|
-
for(i=0; i<length; i++)
|
461
|
-
output[i] = input[i] ^ ((uint8_t*)lane1)[offset+i];
|
462
|
-
}
|
463
|
-
#else
|
464
|
-
unsigned int i;
|
465
|
-
lane >>= offset*8;
|
466
|
-
for(i=0; i<length; i++) {
|
467
|
-
output[i] = input[i] ^ (lane & 0xFF);
|
468
|
-
lane >>= 8;
|
469
|
-
}
|
470
|
-
#endif
|
471
|
-
}
|
472
|
-
|
473
|
-
/* ---------------------------------------------------------------- */
|
474
|
-
|
475
|
-
void KeccakP1600_ExtractAndAddLanes(const void *state, const unsigned char *input, unsigned char *output, unsigned int laneCount)
|
476
|
-
{
|
477
|
-
unsigned int i;
|
478
|
-
#if (PLATFORM_BYTE_ORDER != IS_LITTLE_ENDIAN)
|
479
|
-
unsigned char temp[8];
|
480
|
-
unsigned int j;
|
481
|
-
#endif
|
482
|
-
|
483
|
-
for(i=0; i<laneCount; i++) {
|
484
|
-
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
485
|
-
((uint64_t*)output)[i] = ((uint64_t*)input)[i] ^ ((const uint64_t*)state)[i];
|
486
|
-
#else
|
487
|
-
fromWordToBytes(temp, ((const uint64_t*)state)[i]);
|
488
|
-
for(j=0; j<8; j++)
|
489
|
-
output[i*8+j] = input[i*8+j] ^ temp[j];
|
490
|
-
#endif
|
491
|
-
}
|
492
|
-
#ifdef KeccakP1600_useLaneComplementing
|
493
|
-
if (laneCount > 1) {
|
494
|
-
((uint64_t*)output)[ 1] = ~((uint64_t*)output)[ 1];
|
495
|
-
if (laneCount > 2) {
|
496
|
-
((uint64_t*)output)[ 2] = ~((uint64_t*)output)[ 2];
|
497
|
-
if (laneCount > 8) {
|
498
|
-
((uint64_t*)output)[ 8] = ~((uint64_t*)output)[ 8];
|
499
|
-
if (laneCount > 12) {
|
500
|
-
((uint64_t*)output)[12] = ~((uint64_t*)output)[12];
|
501
|
-
if (laneCount > 17) {
|
502
|
-
((uint64_t*)output)[17] = ~((uint64_t*)output)[17];
|
503
|
-
if (laneCount > 20) {
|
504
|
-
((uint64_t*)output)[20] = ~((uint64_t*)output)[20];
|
505
|
-
}
|
506
|
-
}
|
507
|
-
}
|
508
|
-
}
|
509
|
-
}
|
510
|
-
}
|
511
|
-
#endif
|
512
|
-
}
|
513
|
-
|
514
|
-
/* ---------------------------------------------------------------- */
|
515
|
-
|
516
|
-
void KeccakP1600_ExtractAndAddBytes(const void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
|
517
|
-
{
|
518
|
-
SnP_ExtractAndAddBytes(state, input, output, offset, length, KeccakP1600_ExtractAndAddLanes, KeccakP1600_ExtractAndAddBytesInLane, 8);
|
519
|
-
}
|
520
|
-
|
521
|
-
/* ---------------------------------------------------------------- */
|
522
|
-
|
523
|
-
size_t KeccakF1600_FastLoop_Absorb(void *state, unsigned int laneCount, const unsigned char *data, size_t dataByteLen)
|
524
|
-
{
|
525
|
-
size_t originalDataByteLen = dataByteLen;
|
526
|
-
declareABCDE
|
527
|
-
#ifndef KeccakP1600_fullUnrolling
|
528
|
-
unsigned int i;
|
529
|
-
#endif
|
530
|
-
uint64_t *stateAsLanes = (uint64_t*)state;
|
531
|
-
uint64_t *inDataAsLanes = (uint64_t*)data;
|
532
|
-
|
533
|
-
copyFromState(A, stateAsLanes)
|
534
|
-
while(dataByteLen >= laneCount*8) {
|
535
|
-
addInput(A, inDataAsLanes, laneCount)
|
536
|
-
rounds24
|
537
|
-
inDataAsLanes += laneCount;
|
538
|
-
dataByteLen -= laneCount*8;
|
539
|
-
}
|
540
|
-
copyToState(stateAsLanes, A)
|
541
|
-
return originalDataByteLen - dataByteLen;
|
542
|
-
}
|
543
|
-
|
544
|
-
/* ---------------------------------------------------------------- */
|
545
|
-
|
546
|
-
size_t KeccakP1600_12rounds_FastLoop_Absorb(void *state, unsigned int laneCount, const unsigned char *data, size_t dataByteLen)
|
547
|
-
{
|
548
|
-
size_t originalDataByteLen = dataByteLen;
|
549
|
-
declareABCDE
|
550
|
-
#ifndef KeccakP1600_fullUnrolling
|
551
|
-
unsigned int i;
|
552
|
-
#endif
|
553
|
-
uint64_t *stateAsLanes = (uint64_t*)state;
|
554
|
-
uint64_t *inDataAsLanes = (uint64_t*)data;
|
555
|
-
|
556
|
-
copyFromState(A, stateAsLanes)
|
557
|
-
while(dataByteLen >= laneCount*8) {
|
558
|
-
addInput(A, inDataAsLanes, laneCount)
|
559
|
-
rounds12
|
560
|
-
inDataAsLanes += laneCount;
|
561
|
-
dataByteLen -= laneCount*8;
|
562
|
-
}
|
563
|
-
copyToState(stateAsLanes, A)
|
564
|
-
return originalDataByteLen - dataByteLen;
|
565
|
-
}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
This file defines some parameters of the implementation in the parent directory.
|
3
|
-
*/
|
4
|
-
|
5
|
-
#define KeccakP1600_implementation_config "lane complementing, all rounds unrolled, using SHLD for rotations"
|
6
|
-
#define KeccakP1600_fullUnrolling
|
7
|
-
#define KeccakP1600_useLaneComplementing
|
8
|
-
#define KeccakP1600_useSHLD
|
@@ -1,44 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
The eXtended Keccak Code Package (XKCP)
|
3
|
-
https://github.com/XKCP/XKCP
|
4
|
-
|
5
|
-
The Keccak-p permutations, designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.
|
6
|
-
|
7
|
-
Implementation by the designers, 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
|
-
Please refer to SnP-documentation.h for more details.
|
19
|
-
*/
|
20
|
-
|
21
|
-
#ifndef _KeccakP_1600_SnP_h_
|
22
|
-
#define _KeccakP_1600_SnP_h_
|
23
|
-
|
24
|
-
#define KeccakP1600_implementation "32-bit bit-interleaved reference implementation"
|
25
|
-
#define KeccakP1600_stateSizeInBytes 200
|
26
|
-
#define KeccakP1600_stateAlignment 4
|
27
|
-
|
28
|
-
#ifdef KeccakReference
|
29
|
-
void KeccakP1600_StaticInitialize( void );
|
30
|
-
#else
|
31
|
-
#define KeccakP1600_StaticInitialize()
|
32
|
-
#endif
|
33
|
-
void KeccakP1600_Initialize(void *state);
|
34
|
-
void KeccakP1600_AddByte(void *state, unsigned char data, unsigned int offset);
|
35
|
-
void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
|
36
|
-
void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
|
37
|
-
void KeccakP1600_OverwriteWithZeroes(void *state, unsigned int byteCount);
|
38
|
-
void KeccakP1600_Permute_Nrounds(void *state, unsigned int nrounds);
|
39
|
-
void KeccakP1600_Permute_12rounds(void *state);
|
40
|
-
void KeccakP1600_Permute_24rounds(void *state);
|
41
|
-
void KeccakP1600_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length);
|
42
|
-
void KeccakP1600_ExtractAndAddBytes(const void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
|
43
|
-
|
44
|
-
#endif
|
@@ -1,23 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
The eXtended Keccak Code Package (XKCP)
|
3
|
-
https://github.com/XKCP/XKCP
|
4
|
-
|
5
|
-
The Keccak-p permutations, designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.
|
6
|
-
|
7
|
-
Implementation by the designers, 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 _KeccakP_1600_reference_h_
|
18
|
-
#define _KeccakP_1600_reference_h_
|
19
|
-
|
20
|
-
void KeccakP1600_DisplayRoundConstants(FILE *f);
|
21
|
-
void KeccakP1600_DisplayRhoOffsets(FILE *f);
|
22
|
-
|
23
|
-
#endif
|