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,198 @@
|
|
|
1
|
+
<?xml version='1.0' encoding="UTF-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
The eXtended Keccak Code Package (XKCP)
|
|
4
|
+
https://github.com/XKCP/XKCP
|
|
5
|
+
|
|
6
|
+
Implementation by Gilles Van Assche, hereby denoted as "the implementer".
|
|
7
|
+
|
|
8
|
+
For more information, feedback or questions, please refer to the Keccak Team website:
|
|
9
|
+
https://keccak.team/
|
|
10
|
+
|
|
11
|
+
To the extent possible under law, the implementer has waived all copyright
|
|
12
|
+
and related or neighboring rights to the source code in this file.
|
|
13
|
+
http://creativecommons.org/publicdomain/zero/1.0/
|
|
14
|
+
-->
|
|
15
|
+
<xsl:stylesheet
|
|
16
|
+
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
|
|
17
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
18
|
+
version='1.0'>
|
|
19
|
+
|
|
20
|
+
<xsl:key name="I" match="I" use="."/>
|
|
21
|
+
<xsl:key name="h" match="h" use="."/>
|
|
22
|
+
<xsl:key name="c" match="c|s" use="."/>
|
|
23
|
+
<xsl:key name="inc" match="inc" use="."/>
|
|
24
|
+
|
|
25
|
+
<xsl:template name="ConfigurationType">
|
|
26
|
+
<xsl:param name="name"/>
|
|
27
|
+
<xsl:choose>
|
|
28
|
+
<xsl:when test="substring($name, string-length($name)-1, 2)='.a'">
|
|
29
|
+
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
30
|
+
</xsl:when>
|
|
31
|
+
<xsl:when test="substring($name, string-length($name)-2, 3)='.so'">
|
|
32
|
+
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
33
|
+
</xsl:when>
|
|
34
|
+
<xsl:otherwise>
|
|
35
|
+
<ConfigurationType>Application</ConfigurationType>
|
|
36
|
+
</xsl:otherwise>
|
|
37
|
+
</xsl:choose>
|
|
38
|
+
</xsl:template>
|
|
39
|
+
|
|
40
|
+
<xsl:template match="target">
|
|
41
|
+
<xsl:variable name="name" select="translate(@name, '/', '\')"/>
|
|
42
|
+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
43
|
+
<ItemGroup Label="ProjectConfigurations">
|
|
44
|
+
<ProjectConfiguration Include="Debug|Win32">
|
|
45
|
+
<Configuration>Debug</Configuration>
|
|
46
|
+
<Platform>Win32</Platform>
|
|
47
|
+
</ProjectConfiguration>
|
|
48
|
+
<ProjectConfiguration Include="Debug|x64">
|
|
49
|
+
<Configuration>Debug</Configuration>
|
|
50
|
+
<Platform>x64</Platform>
|
|
51
|
+
</ProjectConfiguration>
|
|
52
|
+
<ProjectConfiguration Include="Debug|ARM64">
|
|
53
|
+
<Configuration>Debug</Configuration>
|
|
54
|
+
<Platform>ARM64</Platform>
|
|
55
|
+
</ProjectConfiguration>
|
|
56
|
+
<ProjectConfiguration Include="Release|Win32">
|
|
57
|
+
<Configuration>Release</Configuration>
|
|
58
|
+
<Platform>Win32</Platform>
|
|
59
|
+
</ProjectConfiguration>
|
|
60
|
+
<ProjectConfiguration Include="Release|x64">
|
|
61
|
+
<Configuration>Release</Configuration>
|
|
62
|
+
<Platform>x64</Platform>
|
|
63
|
+
</ProjectConfiguration>
|
|
64
|
+
<ProjectConfiguration Include="Release|ARM64">
|
|
65
|
+
<Configuration>Release</Configuration>
|
|
66
|
+
<Platform>ARM64</Platform>
|
|
67
|
+
</ProjectConfiguration>
|
|
68
|
+
</ItemGroup>
|
|
69
|
+
<PropertyGroup Label="Globals">
|
|
70
|
+
<ProjectGuid>{6F1C9407-7A01-444D-A07B-7DAE147F22A1}</ProjectGuid>
|
|
71
|
+
<RootNamespace>XKCP</RootNamespace>
|
|
72
|
+
</PropertyGroup>
|
|
73
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
74
|
+
<PropertyGroup Condition="'$(RuntimeLibrary)'==''">
|
|
75
|
+
<RuntimeLibrary Condition="'$(Configuration)'=='Debug'">MultiThreadedDebugDll</RuntimeLibrary>
|
|
76
|
+
<RuntimeLibrary Condition="'$(Configuration)'=='Release'">MultiThreadedDll</RuntimeLibrary>
|
|
77
|
+
</PropertyGroup>
|
|
78
|
+
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
|
79
|
+
<xsl:call-template name="ConfigurationType"><xsl:with-param name="name" select="$name"/></xsl:call-template>
|
|
80
|
+
<UseDebugLibraries>true</UseDebugLibraries>
|
|
81
|
+
<PlatformToolset>v142</PlatformToolset>
|
|
82
|
+
<CharacterSet>MultiByte</CharacterSet>
|
|
83
|
+
</PropertyGroup>
|
|
84
|
+
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
|
85
|
+
<xsl:call-template name="ConfigurationType"><xsl:with-param name="name" select="$name"/></xsl:call-template>
|
|
86
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
|
87
|
+
<PlatformToolset>v142</PlatformToolset>
|
|
88
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
89
|
+
<CharacterSet>MultiByte</CharacterSet>
|
|
90
|
+
</PropertyGroup>
|
|
91
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
92
|
+
<ImportGroup Label="ExtensionSettings">
|
|
93
|
+
</ImportGroup>
|
|
94
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
95
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
96
|
+
</ImportGroup>
|
|
97
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
98
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
99
|
+
</ImportGroup>
|
|
100
|
+
<PropertyGroup Label="UserMacros" />
|
|
101
|
+
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
|
102
|
+
<OutDir>$(ProjectDir)\<xsl:value-of select="$name"/>\$(Configuration)_$(Platform)\</OutDir>
|
|
103
|
+
<IntDir>$(ProjectDir)\<xsl:value-of select="$name"/>\$(Configuration)_$(Platform)\</IntDir>
|
|
104
|
+
</PropertyGroup>
|
|
105
|
+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
|
106
|
+
<OutDir>$(ProjectDir)\<xsl:value-of select="$name"/>\$(Configuration)_$(Platform)\</OutDir>
|
|
107
|
+
<IntDir>$(ProjectDir)\<xsl:value-of select="$name"/>\$(Configuration)_$(Platform)\</IntDir>
|
|
108
|
+
</PropertyGroup>
|
|
109
|
+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
|
110
|
+
<ClCompile>
|
|
111
|
+
<RuntimeLibrary>$(RuntimeLibrary)</RuntimeLibrary>
|
|
112
|
+
<WarningLevel>Level3</WarningLevel>
|
|
113
|
+
<Optimization>Disabled</Optimization>
|
|
114
|
+
<AdditionalIncludeDirectories>$(ProjectDir)\<xsl:value-of select="$name"/>\config;<xsl:apply-templates select="I"/></AdditionalIncludeDirectories>
|
|
115
|
+
<PreprocessorDefinitions><xsl:apply-templates select="define"/>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
116
|
+
<xsl:apply-templates select="msvc"/>
|
|
117
|
+
</ClCompile>
|
|
118
|
+
<Link>
|
|
119
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
120
|
+
</Link>
|
|
121
|
+
</ItemDefinitionGroup>
|
|
122
|
+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
|
123
|
+
<ClCompile>
|
|
124
|
+
<RuntimeLibrary>$(RuntimeLibrary)</RuntimeLibrary>
|
|
125
|
+
<WarningLevel>Level3</WarningLevel>
|
|
126
|
+
<Optimization>MaxSpeed</Optimization>
|
|
127
|
+
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
128
|
+
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
129
|
+
<AdditionalIncludeDirectories>$(ProjectDir)\<xsl:value-of select="$name"/>\config;<xsl:apply-templates select="I"/></AdditionalIncludeDirectories>
|
|
130
|
+
<PreprocessorDefinitions><xsl:apply-templates select="define"/>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
131
|
+
<xsl:apply-templates select="msvc"/>
|
|
132
|
+
</ClCompile>
|
|
133
|
+
<Link>
|
|
134
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
135
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
136
|
+
<OptimizeReferences>true</OptimizeReferences>
|
|
137
|
+
</Link>
|
|
138
|
+
</ItemDefinitionGroup>
|
|
139
|
+
<ItemGroup>
|
|
140
|
+
<xsl:apply-templates select="h|inc"/>
|
|
141
|
+
</ItemGroup>
|
|
142
|
+
<ItemGroup>
|
|
143
|
+
<xsl:apply-templates select="c|s"/>
|
|
144
|
+
</ItemGroup>
|
|
145
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
146
|
+
<ImportGroup Label="ExtensionTargets">
|
|
147
|
+
</ImportGroup>
|
|
148
|
+
</Project>
|
|
149
|
+
</xsl:template>
|
|
150
|
+
|
|
151
|
+
<xsl:template match="I">
|
|
152
|
+
<xsl:if test="generate-id()=generate-id(key('I', .)[1])">
|
|
153
|
+
<xsl:text>$(ProjectDir)..\..\</xsl:text>
|
|
154
|
+
<xsl:value-of select="translate(., '/', '\')"/>
|
|
155
|
+
<xsl:text>;</xsl:text>
|
|
156
|
+
</xsl:if>
|
|
157
|
+
</xsl:template>
|
|
158
|
+
|
|
159
|
+
<xsl:template match="h">
|
|
160
|
+
<xsl:if test="generate-id()=generate-id(key('h', .)[1])">
|
|
161
|
+
<ClInclude Include="{concat('..\..\', translate(., '/', '\'))}"/>
|
|
162
|
+
<xsl:text>
|
|
163
|
+
</xsl:text>
|
|
164
|
+
</xsl:if>
|
|
165
|
+
</xsl:template>
|
|
166
|
+
|
|
167
|
+
<xsl:template match="inc">
|
|
168
|
+
<xsl:if test="generate-id()=generate-id(key('inc', .)[1])">
|
|
169
|
+
<ClInclude Include="{concat('..\..\', translate(., '/', '\'))}"/>
|
|
170
|
+
<xsl:text>
|
|
171
|
+
</xsl:text>
|
|
172
|
+
</xsl:if>
|
|
173
|
+
</xsl:template>
|
|
174
|
+
|
|
175
|
+
<xsl:template match="c">
|
|
176
|
+
<xsl:if test="generate-id()=generate-id(key('c', .)[1])">
|
|
177
|
+
<ClCompile Include="{concat('..\..\', translate(., '/', '\'))}"/>
|
|
178
|
+
<xsl:text>
|
|
179
|
+
</xsl:text>
|
|
180
|
+
</xsl:if>
|
|
181
|
+
</xsl:template>
|
|
182
|
+
|
|
183
|
+
<xsl:template match="s">
|
|
184
|
+
<xsl:message terminate="yes">The file '<xsl:value-of select="."/>' is a GCC assembly file and cannot be included in a Microsoft Visual Studio project.</xsl:message>
|
|
185
|
+
</xsl:template>
|
|
186
|
+
|
|
187
|
+
<xsl:template match="msvc">
|
|
188
|
+
<AdditionalOptions><xsl:value-of select="."/></AdditionalOptions>
|
|
189
|
+
</xsl:template>
|
|
190
|
+
|
|
191
|
+
<xsl:template match="define">
|
|
192
|
+
<xsl:value-of select="."/>
|
|
193
|
+
<xsl:text>;</xsl:text>
|
|
194
|
+
</xsl:template>
|
|
195
|
+
|
|
196
|
+
<xsl:template match="*|text()"/>
|
|
197
|
+
|
|
198
|
+
</xsl:stylesheet>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# XKCP ARM cycle count extension with a Cortex-A57 / RPIB3+ example
|
|
2
|
+
|
|
3
|
+
**By Bruno Pairault, 2019**
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
**ARM** allow the counting of cycles via few techniques :
|
|
8
|
+
**DWT** or nowdays **Performance Monitor Unit** (PMU). There is several versions of PMU for the different
|
|
9
|
+
Cortex processor.
|
|
10
|
+
|
|
11
|
+
The **ARM cycle count implementation** is Linux Kernel dependant to allow the PMU managment for User.
|
|
12
|
+
Enabling the PMU on user-mode is provided per **Kernel-PMU** and is independent of XKCP.
|
|
13
|
+
|
|
14
|
+
The XKCP PMU implementation supports two architectures yet **Aarch64** and **ARMv7-A**. The two XKCP
|
|
15
|
+
PMU implementations to read cycles are coded in the XKCP file `tests/UnitTest/Timing.h` This file
|
|
16
|
+
is only updated using the several native preprocessor compilation options. **Performance Monitors Cycle
|
|
17
|
+
Counters** are then read when required.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Principle of Kernel-PMU
|
|
22
|
+
**Kernel-PMU** is a Linux dependant module that has to be loaded to allow the PMU user-mode.
|
|
23
|
+
XKCP `tests/UnitTest/Timing.h` will then be abble to read the register.
|
|
24
|
+
|
|
25
|
+
The [Cortex-A57](https://en.wikipedia.org/wiki/ARM_Cortex-A57)
|
|
26
|
+
documentation can be found on the ARM site for details on the [PMU](https://developer.arm.com/docs/ddi0488/latest/preface) . The Chapter 11
|
|
27
|
+
describes the Performance Monitor Unit. For all the **Cortex A**, you can reach the [Cortex-A](https://developer.arm.com/products/processors/cortex-a) technical library.
|
|
28
|
+
##Principle of the computation
|
|
29
|
+
When the **Kernel-PMU** is loaded, the processor is likely to answer with the current cycle count for PMU 32
|
|
30
|
+
or 64 Architecture. Obviously similar PMU thread exist on Internet however this integration in XKCP follow exactly the principle introduced initially in `Timing.h` by **Doug Whiting**
|
|
31
|
+
for Intel via `RTDSC`. Minimal changes are required in **XKCP**. We added the few ASM instructions to read the PMU according to the precompilations options.
|
|
32
|
+
The number of cycles of an operation is the difference between the cycle counter before and the cycle
|
|
33
|
+
counter after.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
1. Install the kernel-header version for your kernel release number given per the command `#uname -r`.
|
|
38
|
+
The method is dependant on your Packet Manager (zypper, apt-get, dpkg).
|
|
39
|
+
|
|
40
|
+
* Raspbian (32 bits): `sudo apt-get install raspberrypi-kernel-headers`
|
|
41
|
+
|
|
42
|
+
* OpenSuse Leap 15 (64 bits): Likely on a fresh install `nothing to do` or if the OS has been updated you will have probably to run `sudo zypper in kernel-dev`.
|
|
43
|
+
|
|
44
|
+
2. Compile Kernel-PMU
|
|
45
|
+
|
|
46
|
+
#cd Kernel-PMU
|
|
47
|
+
#make
|
|
48
|
+
|
|
49
|
+
3. Load Kernel-PMU and Check
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
#sudo ./load-module
|
|
53
|
+
#dmesg
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
The expect result for **Cortex-a57** is similar to :
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
[ 6014.689804] ENABLE_ARM_PMU enabling user PMU access on CPU-Core #0
|
|
61
|
+
[ 6014.689809] ENABLE_ARM_PMU enabling user PMU access on CPU-Core #2
|
|
62
|
+
[ 6014.689813] ENABLE_ARM_PMU enabling user PMU access on CPU-Core #3
|
|
63
|
+
[ 6014.689820] ENABLE_ARM_PMU enabling user PMU access on CPU-Core #1
|
|
64
|
+
|
|
65
|
+
###Know-Issues
|
|
66
|
+
* Depending on your Linux OS (Raspbian, Ubuntu Mate, OpenSuse) and your OS release you may also
|
|
67
|
+
be required to download from source the kernel files to compile the module. The module will not load if
|
|
68
|
+
the matching is not correct. Modify the path in the makefile if required.
|
|
69
|
+
|
|
70
|
+
* The module must be reload after rebooting if you do not implement auto-load @reboot.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
##Check the CPU configuration and the native GCC options
|
|
74
|
+
* The objective is to understand the compilation you need to added if you use `-mnative`.
|
|
75
|
+
* Sanity check the CPU configuration and check all the native `-mXXX` compilations options like `march`,`
|
|
76
|
+
mtune`.
|
|
77
|
+
|
|
78
|
+
# lscpu
|
|
79
|
+
# cat /proc/cpuinfo
|
|
80
|
+
# gcc -v
|
|
81
|
+
|
|
82
|
+
###Know-Issues Raspbian case with Updated system OS on 2019-01-01
|
|
83
|
+
* On Raspbian the Cortex-a53 is declared as an ARMv7l with 4 cores as per `lscpu`. GCC [(gcc
|
|
84
|
+
version 6.3.0 20170516 (Raspbian 6.3.0-18+rpi1+deb9u1)] come with native ARMv6 `-march`
|
|
85
|
+
option. This is due to the implementation. Type `cat /proc/cpuinfo` and you will discover the
|
|
86
|
+
**BCM2835** CPU which is the ARMv6 of the first RPI1(2010). It looks like it’s an ARMv6 for each of the 4
|
|
87
|
+
cores. The impact is that we have to force the precompiler options to use the PMU 32 bits for ARM.
|
|
88
|
+
|
|
89
|
+
* **Cortex-a53** RPIB3+ is an **ARMV8-a 64 bits** running mostly 32 bits as most OS for RPI are 32 bits.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
* The preprocessor options `-D__ARM_xx` have to be consistent with the processor and the OS. On a
|
|
93
|
+
32 bits implementation the PMU register is the 32 bits PMU while the 64 bits PMU counter will be used
|
|
94
|
+
on Aarch64.
|
|
95
|
+
|
|
96
|
+
##XKCP Compilation options tips for Cortex-a53 and RPIB3+
|
|
97
|
+
|
|
98
|
+
Depending on what you are trying to achieve you may like to check the compilation options for gcc or
|
|
99
|
+
modify the XKCP `lib/LowLevel.build`. Below some suggestions.
|
|
100
|
+
|
|
101
|
+
For 32 bits OS on ARM PMU on target
|
|
102
|
+
|
|
103
|
+
The RPI3 on 32Bits OS is declared as a ARMv6 per GCC precompilation options. We have then to force
|
|
104
|
+
the `ARM_ARCH_7A` option to read the 32 bit Cycle counter.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
▪ <gcc>-v</gcc> This option add verbose
|
|
108
|
+
▪ <gcc>-D__ARM_ARCH_7A_</gcc>
|
|
109
|
+
|
|
110
|
+
For 64 bits OS on ARM on target : `-mnative` will likely implement natively `__aarch64` . it is
|
|
111
|
+
suggested per GCC as good practice to enable `fix-cortex-a53-835769` and
|
|
112
|
+
`fix-cortex-a53-843419`.
|
|
113
|
+
|
|
114
|
+
For Cross Compilation 32 bits
|
|
115
|
+
|
|
116
|
+
▪ <gcc>-march=armv8-a+crc</gcc>
|
|
117
|
+
▪ <gcc>-mtune=cortex-a53</gcc>
|
|
118
|
+
▪ <gcc>-mlittle-endian</gcc>
|
|
119
|
+
|
|
120
|
+
For Cross Compilation 64 bits using aarch64-linux-gnu-gcc
|
|
121
|
+
|
|
122
|
+
▪ <gcc>-march=armv8-a+crc</gcc>
|
|
123
|
+
▪ <gcc>-mtune=cortex-a53</gcc>
|
|
124
|
+
▪ <gcc>-mlittle-endian</gcc>
|
|
125
|
+
▪ <gcc>-mabi=lp64</gcc>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
Finally compile **KeccakTests**.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
##License
|
|
132
|
+
This code is for GNU General Public License (GNU GPL or GPL) which guarantees end users the freedom
|
|
133
|
+
to run, study, share and modify the Kernel-PMU.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kernel-PMU
|
|
3
|
+
Enabling user-mode access to the performance monitor unit (PMU) on ARMv8 Aarch64 and ARMv7
|
|
4
|
+
Copyright (C) 2019 Bruno Pairault
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/* Inspired with
|
|
21
|
+
https://community.arm.com/dev-platforms/f/discussions/10366/help-configuring-pmu-s
|
|
22
|
+
https://patchwork.kernel.org/patch/5217341/
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/* Enable user-mode ARM performance counter access on ARMv7 & Armv8 Aarch64 */
|
|
26
|
+
#include <linux/kernel.h>
|
|
27
|
+
#include <linux/module.h>
|
|
28
|
+
#include <linux/smp.h>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
#if !defined(__arm__) && !defined(__aarch64__)
|
|
32
|
+
#error Module can only be compiled on ARM.
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
/* #define from /lib/modules/uname-r/source/arch/arm64/include/asm/perf_event.h in ASM Aarch 64 */
|
|
36
|
+
#define ARMV8_PMCR_MASK 0x3f
|
|
37
|
+
#define ARMV8_PMCR_E (1 << 0) /* Enable all counters */
|
|
38
|
+
#define ARMV8_PMCR_P (1 << 1) /* Reset all counters */
|
|
39
|
+
#define ARMV8_PMCR_C (1 << 2) /* Cycle counter reset */
|
|
40
|
+
#define ARMV8_PMCR_N_MASK 0x1f
|
|
41
|
+
|
|
42
|
+
#define ARMV8_PMUSERENR_EN_EL0 (1 << 0) /* EL0 access enable */
|
|
43
|
+
#define ARMV8_PMUSERENR_CR (1 << 2) /* Cycle counter read enable */
|
|
44
|
+
#define ARMV8_PMUSERENR_ER (1 << 3) /* Event counter read enable */
|
|
45
|
+
|
|
46
|
+
#define ARMV8_PMCNTENSET_EL0_ENABLE (1<<31) /* *< Enable Perf count reg */
|
|
47
|
+
|
|
48
|
+
#define PERF_DEF_OPTS (1 | 16)
|
|
49
|
+
|
|
50
|
+
static inline u32 armv8pmu_read(void)
|
|
51
|
+
{
|
|
52
|
+
u64 val=0;
|
|
53
|
+
asm volatile("MRS %0, pmcr_el0" : "=r" (val));
|
|
54
|
+
return (u32)val;
|
|
55
|
+
}
|
|
56
|
+
static inline void armv8pmu_write(u32 val)
|
|
57
|
+
{
|
|
58
|
+
val &= ARMV8_PMCR_MASK;
|
|
59
|
+
asm volatile("isb" : : : "memory");
|
|
60
|
+
asm volatile("MSR pmcr_el0, %0" : : "r" ((u64)val));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static void
|
|
64
|
+
enable_cpu_counters(void* data)
|
|
65
|
+
{
|
|
66
|
+
printk(KERN_INFO "ENABLE_ARM_PMU enabling user PMU access on CPU-Core #%d", smp_processor_id());
|
|
67
|
+
#if __aarch64__
|
|
68
|
+
/* Enable user-mode access to counters. */
|
|
69
|
+
asm volatile("MSR pmuserenr_el0, %0" : : "r"((u64)ARMV8_PMUSERENR_EN_EL0|ARMV8_PMUSERENR_ER|ARMV8_PMUSERENR_CR));
|
|
70
|
+
/* Initialize & Reset PMNC: C and P bits. */
|
|
71
|
+
armv8pmu_write(ARMV8_PMCR_P | ARMV8_PMCR_C);
|
|
72
|
+
asm volatile("MSR pmintenset_el1, %0" : : "r" ((u64)(0 << 31)));
|
|
73
|
+
/* Count Enable Set register bit 31 enable */
|
|
74
|
+
asm volatile("MSR pmcntenset_el0, %0" : : "r" (ARMV8_PMCNTENSET_EL0_ENABLE));
|
|
75
|
+
armv8pmu_write(armv8pmu_read() | ARMV8_PMCR_E);
|
|
76
|
+
|
|
77
|
+
#elif defined(__ARM_ARCH_7A__)
|
|
78
|
+
|
|
79
|
+
/* Enable user-mode access to counters. */
|
|
80
|
+
asm volatile("MCR p15, 0, %0, c9, c14, 0" :: "r"(1));
|
|
81
|
+
/* Program PMU and enable all counters */
|
|
82
|
+
asm volatile("MCR p15, 0, %0, c9, c12, 0" :: "r"(PERF_DEF_OPTS));
|
|
83
|
+
asm volatile("MCR p15, 0, %0, c9, c12, 1" :: "r"(0x8000000f));
|
|
84
|
+
#else
|
|
85
|
+
#error Module Does Not Support your ARM
|
|
86
|
+
#endif
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static void
|
|
90
|
+
disable_cpu_counters(void* data)
|
|
91
|
+
{
|
|
92
|
+
printk(KERN_INFO "ENABLE_ARM_PMU disabling user PMU access on CPU-Core #%d", smp_processor_id());
|
|
93
|
+
|
|
94
|
+
#if __aarch64__
|
|
95
|
+
/* Performance Monitors Count Enable Set register bit 31:0 disable */
|
|
96
|
+
asm volatile("MSR pmcntenset_el0, %0" : : "r" (0<<31));
|
|
97
|
+
/* Disable all counters and user-mode access to counters. */
|
|
98
|
+
armv8pmu_write(armv8pmu_read() |~ ARMV8_PMCR_E);
|
|
99
|
+
asm volatile("MSR pmuserenr_el0, %0" : : "r"((u64)0));
|
|
100
|
+
#elif defined(__ARM_ARCH_7A__)
|
|
101
|
+
asm volatile("MCR p15, 0, %0, c9, c12, 0" :: "r"(0));
|
|
102
|
+
/* Disable all counters and user-mode access to counters. */
|
|
103
|
+
asm volatile("MCR p15, 0, %0, c9, c12, 2" :: "r"(0x8000000f));
|
|
104
|
+
asm volatile("MCR p15, 0, %0, c9, c14, 0" :: "r"(0));
|
|
105
|
+
#else
|
|
106
|
+
#error Module Does Not Support your ARM
|
|
107
|
+
#endif
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static int __init
|
|
111
|
+
init(void)
|
|
112
|
+
{
|
|
113
|
+
on_each_cpu(enable_cpu_counters, NULL, 1);
|
|
114
|
+
printk(KERN_INFO "ENABLE_ARM_PMU Initialized");
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static void __exit
|
|
119
|
+
leave(void)
|
|
120
|
+
{
|
|
121
|
+
on_each_cpu(disable_cpu_counters, NULL, 1);
|
|
122
|
+
printk(KERN_INFO "ENABLE_ARM_PMU Unloaded");
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
MODULE_LICENSE("GPL");
|
|
126
|
+
MODULE_DESCRIPTION("Enables user-mode access to ARMv7A-v8 Aarch64 PMU counters");
|
|
127
|
+
MODULE_VERSION("1:0.0-dev");
|
|
128
|
+
module_init(init);
|
|
129
|
+
module_exit(leave);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sudo insmod ./enable_arm_pmu.ko
|