digest-kangarootwelve 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +51 -11
- data/Rakefile +2 -2
- data/digest-kangarootwelve.gemspec +322 -42
- data/ext/digest/kangarootwelve/ext.c +1 -1
- data/ext/digest/kangarootwelve/extconf.rb +13 -1
- data/ext/digest/kangarootwelve/keccak/armv6m/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv6m/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv6m/KeccakP-1600-SnP.h +36 -0
- data/ext/digest/kangarootwelve/{KeccakP-1600-times2-SnP.h → keccak/armv6m/KeccakP-1600-times2-SnP.h} +10 -10
- data/ext/digest/kangarootwelve/{KeccakP-1600-times2-on1.c → keccak/armv6m/KeccakP-1600-times2-on1.c} +13 -7
- data/ext/digest/kangarootwelve/{KeccakP-1600-times4-SnP.h → keccak/armv6m/KeccakP-1600-times4-SnP.h} +10 -10
- data/ext/digest/kangarootwelve/{KeccakP-1600-times4-on1.c → keccak/armv6m/KeccakP-1600-times4-on1.c} +13 -7
- data/ext/digest/kangarootwelve/{KeccakP-1600-times8-SnP.h → keccak/armv6m/KeccakP-1600-times8-SnP.h} +10 -10
- data/ext/digest/kangarootwelve/{KeccakP-1600-times8-on1.c → keccak/armv6m/KeccakP-1600-times8-on1.c} +13 -7
- data/ext/digest/kangarootwelve/keccak/armv6m/KeccakP-1600-u2-32bi-armv6m-le-gcc.s +1334 -0
- data/ext/digest/kangarootwelve/keccak/armv6m/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/{PlSnP-Fallback.inc → keccak/armv6m/PlSnP-Fallback.inc} +11 -7
- data/ext/digest/kangarootwelve/keccak/armv6m/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-SnP.h +37 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-armv7a-le-neon-gcc.s +826 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-inplace-pl2-armv7a-neon-le-gcc.s +1245 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times2-SnP.h +38 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times4-on2.c +38 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times8-on2.c +38 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/armv7a/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-SnP.h +36 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-inplace-32bi-armv7m-le-gcc.s +1170 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/armv7m/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-SnP.h +28 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-armv8a-neon.s +537 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/armv8a/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-SnP.h +37 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-x86-64-gas.s +1190 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-SnP.h +37 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-x86-64-shld-gas.s +1190 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/asmx86-64shld/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-SnP.h +37 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-avr8-fast.s +1116 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/avr8/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/avr8/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/avr8/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-SnP.h +39 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-XOP-config.h +6 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-XOP.c +473 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times2-SIMD128.c +954 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times2-SnP.h +47 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times4-on2.c +38 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times8-on2.c +38 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-unrolling.macros +302 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/bulldozer/SIMD128-config.h +9 -0
- data/ext/digest/kangarootwelve/{SnP-Relaned.h → keccak/bulldozer/SnP-Relaned.h} +13 -7
- data/ext/digest/kangarootwelve/keccak/bulldozer/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/{KangarooTwelve.c → keccak/common/KangarooTwelve.c} +6 -10
- data/ext/digest/kangarootwelve/{KangarooTwelve.h → keccak/common/KangarooTwelve.h} +3 -7
- data/ext/digest/kangarootwelve/keccak/common/KeccakDuplex-common.h +37 -0
- data/ext/digest/kangarootwelve/keccak/common/KeccakDuplex.inc +192 -0
- data/ext/digest/kangarootwelve/keccak/common/KeccakDuplexWidth1600.c +34 -0
- data/ext/digest/kangarootwelve/keccak/common/KeccakDuplexWidth1600.h +25 -0
- data/ext/digest/kangarootwelve/{KeccakSponge-common.h → keccak/common/KeccakSponge-common.h} +5 -7
- data/ext/digest/kangarootwelve/{KeccakSponge.inc → keccak/common/KeccakSponge.inc} +6 -8
- data/ext/digest/kangarootwelve/{KeccakSpongeWidth1600.c → keccak/common/KeccakSpongeWidth1600.c} +6 -8
- data/ext/digest/kangarootwelve/{KeccakSpongeWidth1600.h → keccak/common/KeccakSpongeWidth1600.h} +5 -7
- data/ext/digest/kangarootwelve/{Phases.h → keccak/common/Phases.h} +3 -7
- data/ext/digest/kangarootwelve/{align.h → keccak/common/align.h} +5 -7
- data/ext/digest/kangarootwelve/{brg_endian.h → keccak/common/brg_endian.h} +0 -0
- data/ext/digest/kangarootwelve/keccak/compact/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/compact/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/{KeccakP-1600-SnP.h → keccak/compact/KeccakP-1600-SnP.h} +7 -10
- data/ext/digest/kangarootwelve/{KeccakP-1600-compact64.c → keccak/compact/KeccakP-1600-compact64.c} +11 -7
- data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/compact/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/compact/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/compact/SnP-Relaned.h +140 -0
- data/ext/digest/kangarootwelve/keccak/compact/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-SnP.h +38 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-inplace32BI.c +1162 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic32/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic32/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/generic32/SnP-Relaned.h +140 -0
- data/ext/digest/kangarootwelve/keccak/generic32/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-SnP.h +38 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-inplace32BI.c +1162 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/SnP-Relaned.h +140 -0
- data/ext/digest/kangarootwelve/keccak/generic32lc/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-64.macros +2195 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-SnP.h +49 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-opt64-config.h +6 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-opt64.c +541 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-unrolling.macros +302 -0
- data/ext/digest/kangarootwelve/keccak/generic64/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic64/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/generic64/SnP-Relaned.h +140 -0
- data/ext/digest/kangarootwelve/keccak/generic64/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-64.macros +2195 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-SnP.h +49 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-opt64-config.h +7 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-opt64.c +541 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-unrolling.macros +302 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/SnP-Relaned.h +140 -0
- data/ext/digest/kangarootwelve/keccak/generic64lc/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-AVX2.s +993 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-SnP.h +41 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times2-SIMD128.c +954 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times2-SnP.h +47 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times4-SIMD256.c +1303 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times4-SnP.h +53 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times8-on4.c +38 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-unrolling.macros +302 -0
- data/ext/digest/kangarootwelve/keccak/haswell/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/haswell/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/haswell/SIMD128-config.h +8 -0
- data/ext/digest/kangarootwelve/keccak/haswell/SIMD256-config.h +7 -0
- data/ext/digest/kangarootwelve/keccak/haswell/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-64.macros +2195 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-SnP.h +49 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-opt64-config.h +7 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-opt64.c +541 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times2-SIMD128.c +954 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times2-SnP.h +47 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times4-on2.c +38 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times8-on2.c +38 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-unrolling.macros +302 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/SIMD128-config.h +8 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/SnP-Relaned.h +140 -0
- data/ext/digest/kangarootwelve/keccak/nehalem/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/reference/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-SnP.h +41 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-reference.c +424 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-reference.h +20 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/reference/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/reference/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/reference/displayIntermediateValues.c +176 -0
- data/ext/digest/kangarootwelve/keccak/reference/displayIntermediateValues.h +29 -0
- data/ext/digest/kangarootwelve/keccak/reference/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-SnP.h +41 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-reference.h +20 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-reference32BI.c +612 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times2-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times2-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times4-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times8-on1.c +37 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/displayIntermediateValues.c +176 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/displayIntermediateValues.h +29 -0
- data/ext/digest/kangarootwelve/keccak/reference32bits/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-64.macros +2195 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-SnP.h +49 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-opt64-config.h +8 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-opt64.c +541 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times2-SIMD128.c +954 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times2-SnP.h +47 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times4-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times4-on2.c +38 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times8-SnP.h +45 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times8-on2.c +38 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-unrolling.macros +302 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/PlSnP-Fallback.inc +287 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/SIMD128-config.h +8 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/SnP-Relaned.h +140 -0
- data/ext/digest/kangarootwelve/keccak/sandybridge/ext.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KangarooTwelve.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakDuplexWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-AVX512-config.h +6 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-AVX512.c +621 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-SnP.h +42 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times2-SIMD512.c +852 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times2-SnP.h +49 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times4-SIMD512.c +883 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times4-SnP.h +49 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times8-SIMD512.c +1473 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times8-SnP.h +53 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/KeccakSpongeWidth1600.link.c +1 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/SIMD512-2-config.h +7 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/SIMD512-4-config.h +7 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/SIMD512-config.h +7 -0
- data/ext/digest/kangarootwelve/keccak/skylakex/ext.link.c +1 -0
- data/lib/digest/kangarootwelve/version.rb +1 -1
- metadata +299 -21
@@ -1,2 +1,14 @@
|
|
1
1
|
require 'mkmf'
|
2
|
-
|
2
|
+
|
3
|
+
TARGETS = ['armv6m', 'armv7a', 'armv7m', 'armv8a', 'asmx86-64', 'asmx86-64shld',
|
4
|
+
'avr8', 'bulldozer', 'compact', 'generic32', 'generic32lc', 'generic64',
|
5
|
+
'generic64lc', 'haswell', 'nehalem', 'reference', 'reference32bits',
|
6
|
+
'sandybridge', 'skylakex']
|
7
|
+
|
8
|
+
target = with_config('target') || 'compact'
|
9
|
+
raise "Invalid target '#{target}'." unless TARGETS.include? target
|
10
|
+
common_dir = File.join(File.dirname(__FILE__), 'keccak', 'common')
|
11
|
+
target_dir = File.join(File.dirname(__FILE__), 'keccak', target)
|
12
|
+
find_header('align.h', common_dir)
|
13
|
+
find_header('KeccakP-1600-SnP.h', target_dir)
|
14
|
+
create_makefile('digest/kangarootwelve', target_dir)
|
@@ -0,0 +1 @@
|
|
1
|
+
#include "../common/KangarooTwelve.c"
|
@@ -0,0 +1 @@
|
|
1
|
+
#include "../common/KeccakDuplexWidth1600.c"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/*
|
2
|
+
Implementation by Ronny Van Keer, hereby denoted as "the implementer".
|
3
|
+
|
4
|
+
For more information, feedback or questions, please refer to our website:
|
5
|
+
https://keccak.team/
|
6
|
+
|
7
|
+
To the extent possible under law, the implementer has waived all copyright
|
8
|
+
and related or neighboring rights to the source code in this file.
|
9
|
+
http://creativecommons.org/publicdomain/zero/1.0/
|
10
|
+
|
11
|
+
---
|
12
|
+
|
13
|
+
Please refer to SnP-documentation.h for more details.
|
14
|
+
*/
|
15
|
+
|
16
|
+
#ifndef _KeccakP_1600_SnP_h_
|
17
|
+
#define _KeccakP_1600_SnP_h_
|
18
|
+
|
19
|
+
#define KeccakP1600_implementation "32-bit bit-interleaved optimized ARM assembler implementation"
|
20
|
+
#define KeccakP1600_stateSizeInBytes 200
|
21
|
+
#define KeccakP1600_stateAlignment 4
|
22
|
+
|
23
|
+
/* void KeccakP1600_StaticInitialize( void ); */
|
24
|
+
#define KeccakP1600_StaticInitialize()
|
25
|
+
void KeccakP1600_Initialize(void *state);
|
26
|
+
void KeccakP1600_AddByte(void *state, unsigned char data, unsigned int offset);
|
27
|
+
void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
|
28
|
+
void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
|
29
|
+
void KeccakP1600_OverwriteWithZeroes(void *state, unsigned int byteCount);
|
30
|
+
void KeccakP1600_Permute_Nrounds(void *state, unsigned int nrounds);
|
31
|
+
void KeccakP1600_Permute_12rounds(void *state);
|
32
|
+
void KeccakP1600_Permute_24rounds(void *state);
|
33
|
+
void KeccakP1600_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length);
|
34
|
+
void KeccakP1600_ExtractAndAddBytes(const void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
|
35
|
+
|
36
|
+
#endif
|
data/ext/digest/kangarootwelve/{KeccakP-1600-times2-SnP.h → keccak/armv6m/KeccakP-1600-times2-SnP.h}
RENAMED
@@ -1,29 +1,29 @@
|
|
1
1
|
/*
|
2
|
-
Implementation by the Keccak
|
3
|
-
|
4
|
-
denoted as "the implementer".
|
2
|
+
Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
|
3
|
+
Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
|
4
|
+
hereby denoted as "the implementer".
|
5
5
|
|
6
|
-
For more information, feedback or questions, please refer to our
|
7
|
-
|
8
|
-
http://keyak.noekeon.org/
|
9
|
-
http://ketje.noekeon.org/
|
6
|
+
For more information, feedback or questions, please refer to our website:
|
7
|
+
https://keccak.team/
|
10
8
|
|
11
9
|
To the extent possible under law, the implementer has waived all copyright
|
12
10
|
and related or neighboring rights to the source code in this file.
|
13
11
|
http://creativecommons.org/publicdomain/zero/1.0/
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
Please refer to PlSnP-documentation.h for more details.
|
14
16
|
*/
|
15
17
|
|
16
18
|
#ifndef _KeccakP_1600_times2_SnP_h_
|
17
19
|
#define _KeccakP_1600_times2_SnP_h_
|
18
20
|
|
19
|
-
/** For the documentation, see PlSnP-documentation.h.
|
20
|
-
*/
|
21
|
-
|
22
21
|
#include "KeccakP-1600-SnP.h"
|
23
22
|
|
24
23
|
#define KeccakP1600times2_implementation "fallback on serial implementation (" KeccakP1600_implementation ")"
|
25
24
|
#define KeccakP1600times2_statesSizeInBytes (((KeccakP1600_stateSizeInBytes+(KeccakP1600_stateAlignment-1))/KeccakP1600_stateAlignment)*KeccakP1600_stateAlignment*2)
|
26
25
|
#define KeccakP1600times2_statesAlignment KeccakP1600_stateAlignment
|
26
|
+
#define KeccakP1600times2_isFallback
|
27
27
|
|
28
28
|
void KeccakP1600times2_StaticInitialize( void );
|
29
29
|
void KeccakP1600times2_InitializeAll(void *states);
|
data/ext/digest/kangarootwelve/{KeccakP-1600-times2-on1.c → keccak/armv6m/KeccakP-1600-times2-on1.c}
RENAMED
@@ -1,16 +1,22 @@
|
|
1
1
|
/*
|
2
|
-
Implementation by the Keccak
|
3
|
-
|
4
|
-
denoted as "the implementer".
|
2
|
+
Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
|
3
|
+
Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
|
4
|
+
hereby denoted as "the implementer".
|
5
5
|
|
6
|
-
For more information, feedback or questions, please refer to our
|
7
|
-
|
8
|
-
http://keyak.noekeon.org/
|
9
|
-
http://ketje.noekeon.org/
|
6
|
+
For more information, feedback or questions, please refer to our website:
|
7
|
+
https://keccak.team/
|
10
8
|
|
11
9
|
To the extent possible under law, the implementer has waived all copyright
|
12
10
|
and related or neighboring rights to the source code in this file.
|
13
11
|
http://creativecommons.org/publicdomain/zero/1.0/
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
This file implements Keccak-p[1600]×2 in a PlSnP-compatible way.
|
16
|
+
Please refer to PlSnP-documentation.h for more details.
|
17
|
+
|
18
|
+
This implementation comes with KeccakP-1600-times2-SnP.h in the same folder.
|
19
|
+
Please refer to LowLevel.build for the exact list of other files it must be combined with.
|
14
20
|
*/
|
15
21
|
|
16
22
|
#include "KeccakP-1600-SnP.h"
|
data/ext/digest/kangarootwelve/{KeccakP-1600-times4-SnP.h → keccak/armv6m/KeccakP-1600-times4-SnP.h}
RENAMED
@@ -1,29 +1,29 @@
|
|
1
1
|
/*
|
2
|
-
Implementation by the Keccak
|
3
|
-
|
4
|
-
denoted as "the implementer".
|
2
|
+
Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
|
3
|
+
Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
|
4
|
+
hereby denoted as "the implementer".
|
5
5
|
|
6
|
-
For more information, feedback or questions, please refer to our
|
7
|
-
|
8
|
-
http://keyak.noekeon.org/
|
9
|
-
http://ketje.noekeon.org/
|
6
|
+
For more information, feedback or questions, please refer to our website:
|
7
|
+
https://keccak.team/
|
10
8
|
|
11
9
|
To the extent possible under law, the implementer has waived all copyright
|
12
10
|
and related or neighboring rights to the source code in this file.
|
13
11
|
http://creativecommons.org/publicdomain/zero/1.0/
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
Please refer to PlSnP-documentation.h for more details.
|
14
16
|
*/
|
15
17
|
|
16
18
|
#ifndef _KeccakP_1600_times4_SnP_h_
|
17
19
|
#define _KeccakP_1600_times4_SnP_h_
|
18
20
|
|
19
|
-
/** For the documentation, see PlSnP-documentation.h.
|
20
|
-
*/
|
21
|
-
|
22
21
|
#include "KeccakP-1600-SnP.h"
|
23
22
|
|
24
23
|
#define KeccakP1600times4_implementation "fallback on serial implementation (" KeccakP1600_implementation ")"
|
25
24
|
#define KeccakP1600times4_statesSizeInBytes (((KeccakP1600_stateSizeInBytes+(KeccakP1600_stateAlignment-1))/KeccakP1600_stateAlignment)*KeccakP1600_stateAlignment*4)
|
26
25
|
#define KeccakP1600times4_statesAlignment KeccakP1600_stateAlignment
|
26
|
+
#define KeccakP1600times4_isFallback
|
27
27
|
|
28
28
|
void KeccakP1600times4_StaticInitialize( void );
|
29
29
|
void KeccakP1600times4_InitializeAll(void *states);
|
data/ext/digest/kangarootwelve/{KeccakP-1600-times4-on1.c → keccak/armv6m/KeccakP-1600-times4-on1.c}
RENAMED
@@ -1,16 +1,22 @@
|
|
1
1
|
/*
|
2
|
-
Implementation by the Keccak
|
3
|
-
|
4
|
-
denoted as "the implementer".
|
2
|
+
Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
|
3
|
+
Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
|
4
|
+
hereby denoted as "the implementer".
|
5
5
|
|
6
|
-
For more information, feedback or questions, please refer to our
|
7
|
-
|
8
|
-
http://keyak.noekeon.org/
|
9
|
-
http://ketje.noekeon.org/
|
6
|
+
For more information, feedback or questions, please refer to our website:
|
7
|
+
https://keccak.team/
|
10
8
|
|
11
9
|
To the extent possible under law, the implementer has waived all copyright
|
12
10
|
and related or neighboring rights to the source code in this file.
|
13
11
|
http://creativecommons.org/publicdomain/zero/1.0/
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
This file implements Keccak-p[1600]×4 in a PlSnP-compatible way.
|
16
|
+
Please refer to PlSnP-documentation.h for more details.
|
17
|
+
|
18
|
+
This implementation comes with KeccakP-1600-times4-SnP.h in the same folder.
|
19
|
+
Please refer to LowLevel.build for the exact list of other files it must be combined with.
|
14
20
|
*/
|
15
21
|
|
16
22
|
#include "KeccakP-1600-SnP.h"
|
data/ext/digest/kangarootwelve/{KeccakP-1600-times8-SnP.h → keccak/armv6m/KeccakP-1600-times8-SnP.h}
RENAMED
@@ -1,29 +1,29 @@
|
|
1
1
|
/*
|
2
|
-
Implementation by the Keccak
|
3
|
-
|
4
|
-
denoted as "the implementer".
|
2
|
+
Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
|
3
|
+
Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
|
4
|
+
hereby denoted as "the implementer".
|
5
5
|
|
6
|
-
For more information, feedback or questions, please refer to our
|
7
|
-
|
8
|
-
http://keyak.noekeon.org/
|
9
|
-
http://ketje.noekeon.org/
|
6
|
+
For more information, feedback or questions, please refer to our website:
|
7
|
+
https://keccak.team/
|
10
8
|
|
11
9
|
To the extent possible under law, the implementer has waived all copyright
|
12
10
|
and related or neighboring rights to the source code in this file.
|
13
11
|
http://creativecommons.org/publicdomain/zero/1.0/
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
Please refer to PlSnP-documentation.h for more details.
|
14
16
|
*/
|
15
17
|
|
16
18
|
#ifndef _KeccakP_1600_times8_SnP_h_
|
17
19
|
#define _KeccakP_1600_times8_SnP_h_
|
18
20
|
|
19
|
-
/** For the documentation, see PlSnP-documentation.h.
|
20
|
-
*/
|
21
|
-
|
22
21
|
#include "KeccakP-1600-SnP.h"
|
23
22
|
|
24
23
|
#define KeccakP1600times8_implementation "fallback on serial implementation (" KeccakP1600_implementation ")"
|
25
24
|
#define KeccakP1600times8_statesSizeInBytes (((KeccakP1600_stateSizeInBytes+(KeccakP1600_stateAlignment-1))/KeccakP1600_stateAlignment)*KeccakP1600_stateAlignment*8)
|
26
25
|
#define KeccakP1600times8_statesAlignment KeccakP1600_stateAlignment
|
26
|
+
#define KeccakP1600times8_isFallback
|
27
27
|
|
28
28
|
void KeccakP1600times8_StaticInitialize( void );
|
29
29
|
void KeccakP1600times8_InitializeAll(void *states);
|
data/ext/digest/kangarootwelve/{KeccakP-1600-times8-on1.c → keccak/armv6m/KeccakP-1600-times8-on1.c}
RENAMED
@@ -1,16 +1,22 @@
|
|
1
1
|
/*
|
2
|
-
Implementation by the Keccak
|
3
|
-
|
4
|
-
denoted as "the implementer".
|
2
|
+
Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
|
3
|
+
Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
|
4
|
+
hereby denoted as "the implementer".
|
5
5
|
|
6
|
-
For more information, feedback or questions, please refer to our
|
7
|
-
|
8
|
-
http://keyak.noekeon.org/
|
9
|
-
http://ketje.noekeon.org/
|
6
|
+
For more information, feedback or questions, please refer to our website:
|
7
|
+
https://keccak.team/
|
10
8
|
|
11
9
|
To the extent possible under law, the implementer has waived all copyright
|
12
10
|
and related or neighboring rights to the source code in this file.
|
13
11
|
http://creativecommons.org/publicdomain/zero/1.0/
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
This file implements Keccak-p[1600]×8 in a PlSnP-compatible way.
|
16
|
+
Please refer to PlSnP-documentation.h for more details.
|
17
|
+
|
18
|
+
This implementation comes with KeccakP-1600-times8-SnP.h in the same folder.
|
19
|
+
Please refer to LowLevel.build for the exact list of other files it must be combined with.
|
14
20
|
*/
|
15
21
|
|
16
22
|
#include "KeccakP-1600-SnP.h"
|
@@ -0,0 +1,1334 @@
|
|
1
|
+
@
|
2
|
+
@ Implementation by Ronny Van Keer, hereby denoted as "the implementer".
|
3
|
+
@
|
4
|
+
@ For more information, feedback or questions, please refer to our website:
|
5
|
+
@ https://keccak.team/
|
6
|
+
@
|
7
|
+
@ To the extent possible under law, the implementer has waived all copyright
|
8
|
+
@ and related or neighboring rights to the source code in this file.
|
9
|
+
@ http://creativecommons.org/publicdomain/zero/1.0/
|
10
|
+
@
|
11
|
+
@ ---
|
12
|
+
@
|
13
|
+
@ This file implements Keccak-p[1600] in a SnP-compatible way.
|
14
|
+
@ Please refer to SnP-documentation.h for more details.
|
15
|
+
@
|
16
|
+
@ This implementation comes with KeccakP-1600-SnP.h in the same folder.
|
17
|
+
@ Please refer to LowLevel.build for the exact list of other files it must be combined with.
|
18
|
+
@
|
19
|
+
|
20
|
+
@ WARNING: This implementation assumes a little endian CPU with ARMv6M architecture (e.g., Cortex-M0) and the GCC compiler.
|
21
|
+
|
22
|
+
|
23
|
+
.thumb
|
24
|
+
.syntax unified
|
25
|
+
.text
|
26
|
+
|
27
|
+
@ Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002
|
28
|
+
.macro toBitInterleaving in0,in1,out0,out1,t,tt,pMask
|
29
|
+
|
30
|
+
mov \out0, \in0
|
31
|
+
ldr \t, [\pMask, #0]
|
32
|
+
ands \out0, \out0, \t
|
33
|
+
lsrs \t, \out0, #1
|
34
|
+
orrs \out0, \out0, \t
|
35
|
+
ldr \t, [\pMask, #4]
|
36
|
+
ands \out0, \out0, \t
|
37
|
+
lsrs \t, \out0, #2
|
38
|
+
orrs \out0, \out0, \t
|
39
|
+
ldr \t, [\pMask, #8]
|
40
|
+
ands \out0, \out0, \t
|
41
|
+
lsrs \t, \out0, #4
|
42
|
+
orrs \out0, \out0, \t
|
43
|
+
ldr \t, [\pMask, #12]
|
44
|
+
ands \out0, \out0, \t
|
45
|
+
lsrs \t, \out0, #8
|
46
|
+
orrs \out0, \out0, \t
|
47
|
+
|
48
|
+
mov \out1, \in1
|
49
|
+
ldr \t, [\pMask, #0]
|
50
|
+
ands \out1, \out1, \t
|
51
|
+
lsrs \t, \out1, #1
|
52
|
+
orrs \out1, \out1, \t
|
53
|
+
ldr \t, [\pMask, #4]
|
54
|
+
ands \out1, \out1, \t
|
55
|
+
lsrs \t, \out1, #2
|
56
|
+
orrs \out1, \out1, \t
|
57
|
+
ldr \t, [\pMask, #8]
|
58
|
+
ands \out1, \out1, \t
|
59
|
+
lsrs \t, \out1, #4
|
60
|
+
orrs \out1, \out1, \t
|
61
|
+
ldr \t, [\pMask, #12]
|
62
|
+
ands \out1, \out1, \t
|
63
|
+
lsrs \t, \out1, #8
|
64
|
+
orrs \out1, \out1, \t
|
65
|
+
|
66
|
+
lsls \out0, \out0, #16
|
67
|
+
lsrs \out0, \out0, #16
|
68
|
+
lsls \out1, \out1, #16
|
69
|
+
orrs \out0, \out0, \out1
|
70
|
+
|
71
|
+
mov \out1, \in0
|
72
|
+
ldr \t, [\pMask, #16]
|
73
|
+
ands \out1, \out1, \t
|
74
|
+
lsls \t, \out1, #1
|
75
|
+
orrs \out1, \out1, \t
|
76
|
+
ldr \t, [\pMask, #20]
|
77
|
+
ands \out1, \out1, \t
|
78
|
+
lsls \t, \out1, #2
|
79
|
+
orrs \out1, \out1, \t
|
80
|
+
ldr \t, [\pMask, #24]
|
81
|
+
ands \out1, \out1, \t
|
82
|
+
lsls \t, \out1, #4
|
83
|
+
orrs \out1, \out1, \t
|
84
|
+
ldr \t, [\pMask, #28]
|
85
|
+
ands \out1, \out1, \t
|
86
|
+
lsls \t, \out1, #8
|
87
|
+
orrs \out1, \out1, \t
|
88
|
+
|
89
|
+
mov \tt, \in1
|
90
|
+
ldr \t, [\pMask, #16]
|
91
|
+
ands \tt, \tt, \t
|
92
|
+
lsls \t, \tt, #1
|
93
|
+
orrs \tt, \tt, \t
|
94
|
+
ldr \t, [\pMask, #20]
|
95
|
+
ands \tt, \tt, \t
|
96
|
+
lsls \t, \tt, #2
|
97
|
+
orrs \tt, \tt, \t
|
98
|
+
ldr \t, [\pMask, #24]
|
99
|
+
ands \tt, \tt, \t
|
100
|
+
lsls \t, \tt, #4
|
101
|
+
orrs \tt, \tt, \t
|
102
|
+
ldr \t, [\pMask, #28]
|
103
|
+
ands \tt, \tt, \t
|
104
|
+
lsls \t, \tt, #8
|
105
|
+
orrs \tt, \tt, \t
|
106
|
+
|
107
|
+
lsrs \out1,\out1, #16
|
108
|
+
lsrs \tt, \tt, #16
|
109
|
+
lsls \tt, \tt, #16
|
110
|
+
orrs \out1,\out1,\tt
|
111
|
+
.endm
|
112
|
+
|
113
|
+
@ Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002
|
114
|
+
.macro fromBitInterleavingStep x, t, tt, pMask, maskofs, shift
|
115
|
+
|
116
|
+
@ t = (x ^ (x >> shift)) & mask@ x = x ^ t ^ (t << shift)@
|
117
|
+
lsrs \t, \x, #\shift
|
118
|
+
eors \t, \t, \x
|
119
|
+
ldr \tt, [\pMask, #\maskofs]
|
120
|
+
ands \t, \t, \tt
|
121
|
+
eors \x, \x, \t
|
122
|
+
lsls \t, \t, #\shift
|
123
|
+
eors \x, \x, \t
|
124
|
+
.endm
|
125
|
+
|
126
|
+
.macro fromBitInterleaving x0, x1, t, tt, pMask
|
127
|
+
movs \t, \x0 @ t = x0
|
128
|
+
lsls \x0, \x0, #16 @ x0 = (x0 & 0x0000FFFF) | (x1 << 16)@
|
129
|
+
lsrs \x0, \x0, #16
|
130
|
+
lsls \tt, \x1, #16
|
131
|
+
orrs \x0, \x0, \tt
|
132
|
+
lsrs \x1, \x1, #16 @ x1 = (t >> 16) | (x1 & 0xFFFF0000)@
|
133
|
+
lsls \x1, \x1, #16
|
134
|
+
lsrs \t, \t, #16
|
135
|
+
orrs \x1, \x1, \t
|
136
|
+
fromBitInterleavingStep \x0, \t, \tt, \pMask, 0, 8
|
137
|
+
fromBitInterleavingStep \x0, \t, \tt, \pMask, 4, 4
|
138
|
+
fromBitInterleavingStep \x0, \t, \tt, \pMask, 8, 2
|
139
|
+
fromBitInterleavingStep \x0, \t, \tt, \pMask, 12, 1
|
140
|
+
fromBitInterleavingStep \x1, \t, \tt, \pMask, 0, 8
|
141
|
+
fromBitInterleavingStep \x1, \t, \tt, \pMask, 4, 4
|
142
|
+
fromBitInterleavingStep \x1, \t, \tt, \pMask, 8, 2
|
143
|
+
fromBitInterleavingStep \x1, \t, \tt, \pMask, 12, 1
|
144
|
+
.endm
|
145
|
+
|
146
|
+
@ --- offsets in state
|
147
|
+
.equ _ba0 , 0*4
|
148
|
+
.equ _ba1 , 1*4
|
149
|
+
.equ _be0 , 2*4
|
150
|
+
.equ _be1 , 3*4
|
151
|
+
.equ _bi0 , 4*4
|
152
|
+
.equ _bi1 , 5*4
|
153
|
+
.equ _bo0 , 6*4
|
154
|
+
.equ _bo1 , 7*4
|
155
|
+
.equ _bu0 , 8*4
|
156
|
+
.equ _bu1 , 9*4
|
157
|
+
.equ _ga0 , 10*4
|
158
|
+
.equ _ga1 , 11*4
|
159
|
+
.equ _ge0 , 12*4
|
160
|
+
.equ _ge1 , 13*4
|
161
|
+
.equ _gi0 , 14*4
|
162
|
+
.equ _gi1 , 15*4
|
163
|
+
.equ _go0 , 16*4
|
164
|
+
.equ _go1 , 17*4
|
165
|
+
.equ _gu0 , 18*4
|
166
|
+
.equ _gu1 , 19*4
|
167
|
+
.equ _ka0 , 20*4
|
168
|
+
.equ _ka1 , 21*4
|
169
|
+
.equ _ke0 , 22*4
|
170
|
+
.equ _ke1 , 23*4
|
171
|
+
.equ _ki0 , 24*4
|
172
|
+
.equ _ki1 , 25*4
|
173
|
+
.equ _ko0 , 26*4
|
174
|
+
.equ _ko1 , 27*4
|
175
|
+
.equ _ku0 , 28*4
|
176
|
+
.equ _ku1 , 29*4
|
177
|
+
.equ _ma0 , 30*4
|
178
|
+
.equ _ma1 , 31*4
|
179
|
+
.equ _me0 , 32*4
|
180
|
+
.equ _me1 , 33*4
|
181
|
+
.equ _mi0 , 34*4
|
182
|
+
.equ _mi1 , 35*4
|
183
|
+
.equ _mo0 , 36*4
|
184
|
+
.equ _mo1 , 37*4
|
185
|
+
.equ _mu0 , 38*4
|
186
|
+
.equ _mu1 , 39*4
|
187
|
+
.equ _sa0 , 40*4
|
188
|
+
.equ _sa1 , 41*4
|
189
|
+
.equ _se0 , 42*4
|
190
|
+
.equ _se1 , 43*4
|
191
|
+
.equ _si0 , 44*4
|
192
|
+
.equ _si1 , 45*4
|
193
|
+
.equ _so0 , 46*4
|
194
|
+
.equ _so1 , 47*4
|
195
|
+
.equ _su0 , 48*4
|
196
|
+
.equ _su1 , 49*4
|
197
|
+
|
198
|
+
@ --- offsets on stack
|
199
|
+
.equ mEs , 0 @ Secondary state
|
200
|
+
.equ mD , 25*2*4
|
201
|
+
.equ mDo0 , mD+0*4
|
202
|
+
.equ mDo1 , mD+1*4
|
203
|
+
.equ mDu0 , mD+2*4
|
204
|
+
.equ mDu1 , mD+3*4
|
205
|
+
.equ mRC , mD+4*4
|
206
|
+
.equ mRFU , mD+5*4
|
207
|
+
.equ mSize , mD+6*4
|
208
|
+
|
209
|
+
@ --- macros
|
210
|
+
|
211
|
+
.macro load reg, stkIn, offset
|
212
|
+
.if \stkIn == 1
|
213
|
+
ldr \reg, [sp, #\offset]
|
214
|
+
.else
|
215
|
+
.if \offset >= _ma0
|
216
|
+
ldr \reg, [r7, #\offset-_ma0]
|
217
|
+
.else
|
218
|
+
ldr \reg, [r0, #\offset]
|
219
|
+
.endif
|
220
|
+
.endif
|
221
|
+
.endm
|
222
|
+
|
223
|
+
.macro store reg, stkIn, offset
|
224
|
+
.if \stkIn == 0
|
225
|
+
str \reg, [sp, #\offset]
|
226
|
+
.else
|
227
|
+
.if \offset >= _ma0
|
228
|
+
str \reg, [r7, #\offset-_ma0]
|
229
|
+
.else
|
230
|
+
str \reg, [r0, #\offset]
|
231
|
+
.endif
|
232
|
+
.endif
|
233
|
+
.endm
|
234
|
+
|
235
|
+
.macro xor5 stkIn, result,b,g,k,m,s
|
236
|
+
load \result, \stkIn, \b
|
237
|
+
load r6, \stkIn, \g
|
238
|
+
eors \result, \result, r6
|
239
|
+
load r6, \stkIn, \k
|
240
|
+
eors \result, \result, r6
|
241
|
+
load r6, \stkIn, \m
|
242
|
+
eors \result, \result, r6
|
243
|
+
load r6, \stkIn, \s
|
244
|
+
eors \result, \result, r6
|
245
|
+
.endm
|
246
|
+
|
247
|
+
.macro te0m oD, rCp0, rCn1
|
248
|
+
rors \rCn1, \rCn1, r4
|
249
|
+
eors \rCn1, \rCn1, \rCp0
|
250
|
+
str \rCn1, [sp, #\oD]
|
251
|
+
.endm
|
252
|
+
|
253
|
+
.macro te1m oD, rCp1, rCn0
|
254
|
+
eors \rCn0, \rCn0, \rCp1
|
255
|
+
str \rCn0, [sp, #\oD]
|
256
|
+
.endm
|
257
|
+
|
258
|
+
.macro te0r rD, rCp0, rCn1
|
259
|
+
rors \rCn1, \rCn1, r4
|
260
|
+
eors \rCn1, \rCn1, \rCp0
|
261
|
+
mov \rD, \rCn1
|
262
|
+
.endm
|
263
|
+
|
264
|
+
.macro te1r rD, rCp1, rCn0
|
265
|
+
eors \rCn0, \rCn0, \rCp1
|
266
|
+
mov \rD, \rCn0
|
267
|
+
.endm
|
268
|
+
|
269
|
+
.macro trp1 stkIn, b, ofS, orD, fD, rot
|
270
|
+
load \b, \stkIn, \ofS
|
271
|
+
.if \fD != 0
|
272
|
+
mov r6, \orD
|
273
|
+
.else
|
274
|
+
ldr r6, [sp, #\orD]
|
275
|
+
.endif
|
276
|
+
eors \b, \b, r6
|
277
|
+
.if \rot != 0
|
278
|
+
movs r6, #32-\rot
|
279
|
+
rors \b, \b, r6
|
280
|
+
.endif
|
281
|
+
.endm
|
282
|
+
|
283
|
+
.macro trp5 stkIn, oS0, orD0, fD0, oR0, oS1, orD1, fD1, oR1, oS2, orD2, fD2, oR2, oS3, orD3, fD3, oR3, oS4, orD4, fD4, oR4
|
284
|
+
trp1 \stkIn, r1, \oS0, \orD0, \fD0, \oR0
|
285
|
+
trp1 \stkIn, r2, \oS1, \orD1, \fD1, \oR1
|
286
|
+
trp1 \stkIn, r3, \oS2, \orD2, \fD2, \oR2
|
287
|
+
trp1 \stkIn, r4, \oS3, \orD3, \fD3, \oR3
|
288
|
+
trp1 \stkIn, r5, \oS4, \orD4, \fD4, \oR4
|
289
|
+
.endm
|
290
|
+
|
291
|
+
.macro chio1 stkIn, oOut, ax0, ax1, ax2, iota, useax2
|
292
|
+
.if \useax2 != 0
|
293
|
+
bics \ax2, \ax2, \ax1 @ A[x+2] = A[x+2] & ~A[x+1]
|
294
|
+
eors \ax2, \ax2, \ax0 @ A[x+2] = A[x+2] ^ A[x]
|
295
|
+
.if \iota != 0xFF
|
296
|
+
ldr r1, [sp, #mRC]
|
297
|
+
ldr r4, [r1, #\iota]
|
298
|
+
eors \ax2, \ax2, r4
|
299
|
+
.endif
|
300
|
+
store \ax2, \stkIn, \oOut
|
301
|
+
.else
|
302
|
+
mov r6, \ax2 @ T1 = A[x+2]
|
303
|
+
bics r6, r6, \ax1 @ T1 = T1 & ~A[x+1]
|
304
|
+
eors r6, r6, \ax0 @ T1 = T1 ^ A[x]
|
305
|
+
store r6, \stkIn, \oOut
|
306
|
+
.endif
|
307
|
+
.endm
|
308
|
+
|
309
|
+
.macro chio5 stkIn, oOut, iota
|
310
|
+
chio1 \stkIn, \oOut+8*4, r5, r1, r2, 0xFF, 0
|
311
|
+
chio1 \stkIn, \oOut+6*4, r4, r5, r1, 0xFF, 0
|
312
|
+
chio1 \stkIn, \oOut+4*4, r3, r4, r5, 0xFF, 1
|
313
|
+
chio1 \stkIn, \oOut+2*4, r2, r3, r4, 0xFF, 1
|
314
|
+
chio1 \stkIn, \oOut+0*4, r1, r2, r3, \iota, 1
|
315
|
+
.endm
|
316
|
+
|
317
|
+
.macro Kround stkIn, iota
|
318
|
+
|
319
|
+
@ prepare Theta
|
320
|
+
movs r4, #31
|
321
|
+
|
322
|
+
xor5 \stkIn, r1, _be1, _ge1, _ke1, _me1, _se1
|
323
|
+
xor5 \stkIn, r2, _bu0, _gu0, _ku0, _mu0, _su0
|
324
|
+
mov r6, r1
|
325
|
+
te0r r8, r2, r6
|
326
|
+
|
327
|
+
xor5 \stkIn, r3, _bi1, _gi1, _ki1, _mi1, _si1
|
328
|
+
te1m mDo1, r3, r2
|
329
|
+
|
330
|
+
xor5 \stkIn, r2, _ba0, _ga0, _ka0, _ma0, _sa0
|
331
|
+
te0r r10, r2, r3
|
332
|
+
|
333
|
+
xor5 \stkIn, r3, _bo1, _go1, _ko1, _mo1, _so1
|
334
|
+
te1m mDu1, r3, r2
|
335
|
+
|
336
|
+
xor5 \stkIn, r2, _be0, _ge0, _ke0, _me0, _se0
|
337
|
+
te0r r12, r2, r3
|
338
|
+
|
339
|
+
xor5 \stkIn, r3, _bu1, _gu1, _ku1, _mu1, _su1
|
340
|
+
te1r r9, r3, r2
|
341
|
+
|
342
|
+
xor5 \stkIn, r2, _bi0, _gi0, _ki0, _mi0, _si0
|
343
|
+
te0m mDo0, r2, r3
|
344
|
+
|
345
|
+
xor5 \stkIn, r3, _ba1, _ga1, _ka1, _ma1, _sa1
|
346
|
+
te1r r11, r3, r2
|
347
|
+
|
348
|
+
xor5 \stkIn, r2, _bo0, _go0, _ko0, _mo0, _so0
|
349
|
+
te0m mDu0, r2, r3
|
350
|
+
te1r lr, r1, r2
|
351
|
+
|
352
|
+
trp5 \stkIn, _bi0, r12, 1, 31, _go1, mDo1, 0, 28, _ku1, mDu1, 0, 20, _ma1, r9, 1, 21, _se0, r10, 1, 1
|
353
|
+
chio5 \stkIn, _sa0, 0xFF
|
354
|
+
trp5 \stkIn, _bi1, lr, 1, 31, _go0, mDo0, 0, 27, _ku0, mDu0, 0, 19, _ma0, r8, 1, 20, _se1, r11, 1, 1
|
355
|
+
chio5 \stkIn, _sa1, 0xFF
|
356
|
+
|
357
|
+
trp5 \stkIn, _bu1, mDu1, 0, 14, _ga0, r8, 1, 18, _ke0, r10, 1, 5, _mi1, lr, 1, 8, _so0, mDo0, 0, 28
|
358
|
+
chio5 \stkIn, _ma0, 0xFF
|
359
|
+
trp5 \stkIn, _bu0, mDu0, 0, 13, _ga1, r9, 1, 18, _ke1, r11, 1, 5, _mi0, r12, 1, 7, _so1, mDo1, 0, 28
|
360
|
+
chio5 \stkIn, _ma1, 0xFF
|
361
|
+
|
362
|
+
trp5 \stkIn, _be1, r11, 1, 1, _gi0, r12, 1, 3, _ko1, mDo1, 0, 13, _mu0, mDu0, 0, 4, _sa0, r8, 1, 9
|
363
|
+
chio5 \stkIn, _ka0, 0xFF
|
364
|
+
trp5 \stkIn, _be0, r10, 1, 0, _gi1, lr, 1, 3, _ko0, mDo0, 0, 12, _mu1, mDu1, 0, 4, _sa1, r9, 1, 9
|
365
|
+
chio5 \stkIn, _ka1, 0xFF
|
366
|
+
|
367
|
+
trp5 \stkIn, _bo0, mDo0, 0, 14, _gu0, mDu0, 0, 10, _ka1, r9, 1, 2, _me1, r11, 1, 23, _si1, lr, 1, 31
|
368
|
+
chio5 \stkIn, _ga0, 0xFF
|
369
|
+
trp5 \stkIn, _bo1, mDo1, 0, 14, _gu1, mDu1, 0, 10, _ka0, r8, 1, 1, _me0, r10, 1, 22, _si0, r12, 1, 30
|
370
|
+
chio5 \stkIn, _ga1, 0xFF
|
371
|
+
|
372
|
+
trp5 \stkIn, _ba0, r8, 1, 0, _ge0, r10, 1, 22, _ki1, lr, 1, 22, _mo1, mDo1, 0, 11, _su0, mDu0, 0, 7
|
373
|
+
chio5 \stkIn, _ba0, \iota+0
|
374
|
+
trp5 \stkIn, _ba1, r9, 1, 0, _ge1, r11, 1, 22, _ki0, r12, 1, 21, _mo0, mDo0, 0, 10, _su1, mDu1, 0, 7
|
375
|
+
chio5 \stkIn, _ba1, \iota+4
|
376
|
+
.endm
|
377
|
+
|
378
|
+
@----------------------------------------------------------------------------
|
379
|
+
@
|
380
|
+
@ void KeccakP1600_StaticInitialize( void )
|
381
|
+
@
|
382
|
+
.align 8
|
383
|
+
.global KeccakP1600_StaticInitialize
|
384
|
+
.type KeccakP1600_StaticInitialize, %function;
|
385
|
+
KeccakP1600_StaticInitialize:
|
386
|
+
bx lr
|
387
|
+
|
388
|
+
|
389
|
+
@----------------------------------------------------------------------------
|
390
|
+
@
|
391
|
+
@ void KeccakP1600_Initialize(void *state)
|
392
|
+
@
|
393
|
+
.align 8
|
394
|
+
.global KeccakP1600_Initialize
|
395
|
+
.type KeccakP1600_Initialize, %function;
|
396
|
+
KeccakP1600_Initialize:
|
397
|
+
push {r4 - r5}
|
398
|
+
movs r1, #0
|
399
|
+
movs r2, #0
|
400
|
+
movs r3, #0
|
401
|
+
movs r4, #0
|
402
|
+
movs r5, #0
|
403
|
+
stmia r0!, { r1 - r5 }
|
404
|
+
stmia r0!, { r1 - r5 }
|
405
|
+
stmia r0!, { r1 - r5 }
|
406
|
+
stmia r0!, { r1 - r5 }
|
407
|
+
stmia r0!, { r1 - r5 }
|
408
|
+
stmia r0!, { r1 - r5 }
|
409
|
+
stmia r0!, { r1 - r5 }
|
410
|
+
stmia r0!, { r1 - r5 }
|
411
|
+
stmia r0!, { r1 - r5 }
|
412
|
+
stmia r0!, { r1 - r5 }
|
413
|
+
pop {r4 - r5}
|
414
|
+
bx lr
|
415
|
+
|
416
|
+
|
417
|
+
@ ----------------------------------------------------------------------------
|
418
|
+
@
|
419
|
+
@ void KeccakP1600_AddByte(void *state, unsigned char byte, unsigned int offset)
|
420
|
+
@
|
421
|
+
.align 8
|
422
|
+
.global KeccakP1600_AddByte
|
423
|
+
.type KeccakP1600_AddByte, %function;
|
424
|
+
KeccakP1600_AddByte:
|
425
|
+
push {r4 - r7}
|
426
|
+
mov r4, r8
|
427
|
+
mov r5, r9
|
428
|
+
push {r4 - r5}
|
429
|
+
lsrs r4, r2, #3 @ offset &= ~7
|
430
|
+
lsls r4, r4, #3
|
431
|
+
adds r0, r0, r4 @ add whole lane offset to state pointer
|
432
|
+
lsls r2, r2, #29 @ offset &= 7 (part not lane aligned)
|
433
|
+
lsrs r2, r2, #29
|
434
|
+
adr r7, KeccakP1600_AddBytes_ToBitInterleavingConstants
|
435
|
+
movs r4, #0
|
436
|
+
movs r5, #0
|
437
|
+
push { r4 - r5 }
|
438
|
+
add r2, r2, sp
|
439
|
+
strb r1, [r2]
|
440
|
+
pop { r4 - r5 }
|
441
|
+
mov r8, r4
|
442
|
+
mov r9, r5
|
443
|
+
toBitInterleaving r8, r9, r4, r5, r6, r2, r7
|
444
|
+
ldr r6, [r0]
|
445
|
+
eors r4, r4, r6
|
446
|
+
ldr r6, [r0, #4]
|
447
|
+
eors r5, r5, r6
|
448
|
+
stmia r0!, { r4, r5 }
|
449
|
+
pop {r4 - r5}
|
450
|
+
mov r8, r4
|
451
|
+
mov r9, r5
|
452
|
+
pop {r4 - r7}
|
453
|
+
bx lr
|
454
|
+
|
455
|
+
|
456
|
+
@----------------------------------------------------------------------------
|
457
|
+
@
|
458
|
+
@ void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
|
459
|
+
@
|
460
|
+
.align 8
|
461
|
+
.global KeccakP1600_AddBytes
|
462
|
+
.type KeccakP1600_AddBytes, %function;
|
463
|
+
KeccakP1600_AddBytes:
|
464
|
+
cmp r3, #0 @ .if length != 0
|
465
|
+
beq KeccakP1600_AddBytes_Exit1
|
466
|
+
push {r4 - r6, lr} @ then
|
467
|
+
mov r4, r8
|
468
|
+
mov r5, r9
|
469
|
+
mov r6, r10
|
470
|
+
push {r4 - r7}
|
471
|
+
lsrs r4, r2, #3 @ offset &= ~7
|
472
|
+
lsls r4, r4, #3
|
473
|
+
adds r0, r0, r4 @ add whole lane offset to state pointer
|
474
|
+
lsls r2, r2, #29 @ offset &= 7 (part not lane aligned)
|
475
|
+
lsrs r2, r2, #29
|
476
|
+
beq KeccakP1600_AddBytes_CheckLanes @ .if offset != 0
|
477
|
+
movs r4, r3 @ then, do remaining bytes in first lane
|
478
|
+
movs r5, #8
|
479
|
+
subs r5, r2 @ max size in lane = 8 - offset
|
480
|
+
cmp r4, r5
|
481
|
+
ble KeccakP1600_AddBytes_BytesAlign
|
482
|
+
movs r4, r5
|
483
|
+
KeccakP1600_AddBytes_BytesAlign:
|
484
|
+
subs r3, r3, r4 @ size left
|
485
|
+
mov r10, r3
|
486
|
+
movs r3, r4
|
487
|
+
adr r7, KeccakP1600_AddBytes_ToBitInterleavingConstants
|
488
|
+
bl __KeccakP1600_AddBytesInLane
|
489
|
+
mov r3, r10
|
490
|
+
KeccakP1600_AddBytes_CheckLanes:
|
491
|
+
lsrs r2, r3, #3 @ .if length >= 8
|
492
|
+
beq KeccakP1600_AddBytes_Bytes
|
493
|
+
mov r10, r3
|
494
|
+
adr r3, KeccakP1600_AddBytes_ToBitInterleavingConstants
|
495
|
+
bl __KeccakP1600_AddLanes
|
496
|
+
mov r3, r10
|
497
|
+
lsls r3, r3, #29
|
498
|
+
lsrs r3, r3, #29
|
499
|
+
KeccakP1600_AddBytes_Bytes:
|
500
|
+
cmp r3, #0
|
501
|
+
beq KeccakP1600_AddBytes_Exit
|
502
|
+
movs r2, #0
|
503
|
+
adr r7, KeccakP1600_AddBytes_ToBitInterleavingConstants
|
504
|
+
bl __KeccakP1600_AddBytesInLane
|
505
|
+
KeccakP1600_AddBytes_Exit:
|
506
|
+
pop {r4 - r7}
|
507
|
+
mov r8, r4
|
508
|
+
mov r9, r5
|
509
|
+
mov r10, r6
|
510
|
+
pop {r4 - r6, pc}
|
511
|
+
KeccakP1600_AddBytes_Exit1:
|
512
|
+
bx lr
|
513
|
+
nop
|
514
|
+
KeccakP1600_AddBytes_ToBitInterleavingConstants:
|
515
|
+
.long 0x55555555
|
516
|
+
.long 0x33333333
|
517
|
+
.long 0x0F0F0F0F
|
518
|
+
.long 0x00FF00FF
|
519
|
+
.long 0xAAAAAAAA
|
520
|
+
.long 0xCCCCCCCC
|
521
|
+
.long 0xF0F0F0F0
|
522
|
+
.long 0xFF00FF00
|
523
|
+
|
524
|
+
|
525
|
+
@----------------------------------------------------------------------------
|
526
|
+
@
|
527
|
+
@ __KeccakP1600_AddLanes
|
528
|
+
@
|
529
|
+
@ Input:
|
530
|
+
@ r0 state pointer
|
531
|
+
@ r1 data pointer
|
532
|
+
@ r2 laneCount
|
533
|
+
@ r3 to bit interleaving constants pointer
|
534
|
+
@
|
535
|
+
@ Output:
|
536
|
+
@ r0 state pointer next lane
|
537
|
+
@ r1 data pointer next byte to input
|
538
|
+
@
|
539
|
+
@ Changed: r2-r9
|
540
|
+
@
|
541
|
+
.align 8
|
542
|
+
__KeccakP1600_AddLanes:
|
543
|
+
lsls r4, r1, #30
|
544
|
+
bne __KeccakP1600_AddLanes_LoopUnaligned
|
545
|
+
__KeccakP1600_AddLanes_LoopAligned:
|
546
|
+
ldmia r1!, {r6,r7}
|
547
|
+
mov r8, r6
|
548
|
+
mov r9, r7
|
549
|
+
toBitInterleaving r8, r9, r6, r7, r5, r4, r3
|
550
|
+
ldr r5, [r0]
|
551
|
+
eors r6, r6, r5
|
552
|
+
ldr r5, [r0, #4]
|
553
|
+
eors r7, r7, r5
|
554
|
+
stmia r0!, {r6,r7}
|
555
|
+
subs r2, r2, #1
|
556
|
+
bne __KeccakP1600_AddLanes_LoopAligned
|
557
|
+
bx lr
|
558
|
+
__KeccakP1600_AddLanes_LoopUnaligned:
|
559
|
+
ldrb r6, [r1, #0]
|
560
|
+
ldrb r4, [r1, #1]
|
561
|
+
lsls r4, r4, #8
|
562
|
+
orrs r6, r6, r4
|
563
|
+
ldrb r4, [r1, #2]
|
564
|
+
lsls r4, r4, #16
|
565
|
+
orrs r6, r6, r4
|
566
|
+
ldrb r4, [r1, #3]
|
567
|
+
lsls r4, r4, #24
|
568
|
+
orrs r6, r6, r4
|
569
|
+
ldrb r7, [r1, #4]
|
570
|
+
ldrb r4, [r1, #5]
|
571
|
+
lsls r4, r4, #8
|
572
|
+
orrs r7, r7, r4
|
573
|
+
ldrb r4, [r1, #6]
|
574
|
+
lsls r4, r4, #16
|
575
|
+
orrs r7, r7, r4
|
576
|
+
ldrb r4, [r1, #7]
|
577
|
+
lsls r4, r4, #24
|
578
|
+
orrs r7, r7, r4
|
579
|
+
adds r1, r1, #8
|
580
|
+
mov r8, r6
|
581
|
+
mov r9, r7
|
582
|
+
toBitInterleaving r8, r9, r6, r7, r5, r4, r3
|
583
|
+
ldr r5, [r0]
|
584
|
+
eors r6, r6, r5
|
585
|
+
ldr r5, [r0, #4]
|
586
|
+
eors r7, r7, r5
|
587
|
+
stmia r0!, {r6, r7}
|
588
|
+
subs r2, r2, #1
|
589
|
+
bne __KeccakP1600_AddLanes_LoopUnaligned
|
590
|
+
bx lr
|
591
|
+
|
592
|
+
|
593
|
+
@----------------------------------------------------------------------------
|
594
|
+
@
|
595
|
+
@ __KeccakP1600_AddBytesInLane
|
596
|
+
@
|
597
|
+
@ Input:
|
598
|
+
@ r0 state pointer
|
599
|
+
@ r1 data pointer
|
600
|
+
@ r2 offset in lane
|
601
|
+
@ r3 length
|
602
|
+
@ r7 to bit interleaving constants pointer
|
603
|
+
@
|
604
|
+
@ Output:
|
605
|
+
@ r0 state pointer next lane
|
606
|
+
@ r1 data pointer next byte to input
|
607
|
+
@
|
608
|
+
@ Changed: r2-r9
|
609
|
+
@
|
610
|
+
.align 8
|
611
|
+
__KeccakP1600_AddBytesInLane:
|
612
|
+
movs r4, #0
|
613
|
+
movs r5, #0
|
614
|
+
push { r4 - r5 }
|
615
|
+
add r2, r2, sp
|
616
|
+
__KeccakP1600_AddBytesInLane_Loop:
|
617
|
+
ldrb r5, [r1]
|
618
|
+
strb r5, [r2]
|
619
|
+
adds r1, r1, #1
|
620
|
+
adds r2, r2, #1
|
621
|
+
subs r3, r3, #1
|
622
|
+
bne __KeccakP1600_AddBytesInLane_Loop
|
623
|
+
pop { r4 - r5 }
|
624
|
+
mov r8, r4
|
625
|
+
mov r9, r5
|
626
|
+
toBitInterleaving r8, r9, r4, r5, r6, r2, r7
|
627
|
+
ldr r6, [r0]
|
628
|
+
eors r4, r4, r6
|
629
|
+
ldr r6, [r0, #4]
|
630
|
+
eors r5, r5, r6
|
631
|
+
stmia r0!, { r4, r5 }
|
632
|
+
bx lr
|
633
|
+
|
634
|
+
|
635
|
+
@----------------------------------------------------------------------------
|
636
|
+
@
|
637
|
+
@ void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
|
638
|
+
@
|
639
|
+
.align 8
|
640
|
+
.global KeccakP1600_OverwriteBytes
|
641
|
+
.type KeccakP1600_OverwriteBytes, %function;
|
642
|
+
KeccakP1600_OverwriteBytes:
|
643
|
+
cmp r3, #0 @ .if length != 0
|
644
|
+
beq KeccakP1600_OverwriteBytes_Exit1
|
645
|
+
push {r4 - r6, lr} @ then
|
646
|
+
mov r4, r8
|
647
|
+
mov r5, r9
|
648
|
+
mov r6, r10
|
649
|
+
push {r4 - r7}
|
650
|
+
lsrs r4, r2, #3 @ offset &= ~7
|
651
|
+
lsls r4, r4, #3
|
652
|
+
adds r0, r0, r4 @ add whole lane offset to state pointer
|
653
|
+
lsls r2, r2, #29 @ offset &= 7 (part not lane aligned)
|
654
|
+
lsrs r2, r2, #29
|
655
|
+
beq KeccakP1600_OverwriteBytes_CheckLanes @ .if offset != 0
|
656
|
+
movs r4, r3 @ then, do remaining bytes in first lane
|
657
|
+
movs r5, #8
|
658
|
+
subs r5, r2 @ max size in lane = 8 - offset
|
659
|
+
cmp r4, r5
|
660
|
+
ble KeccakP1600_OverwriteBytes_BytesAlign
|
661
|
+
movs r4, r5
|
662
|
+
KeccakP1600_OverwriteBytes_BytesAlign:
|
663
|
+
subs r3, r3, r4 @ size left
|
664
|
+
mov r10, r3
|
665
|
+
movs r3, r4
|
666
|
+
adr r7, KeccakP1600_OverwriteBytes_ToBitInterleavingConstants
|
667
|
+
bl __KeccakP1600_OverwriteBytesInLane
|
668
|
+
mov r3, r10
|
669
|
+
KeccakP1600_OverwriteBytes_CheckLanes:
|
670
|
+
lsrs r2, r3, #3 @ .if length >= 8
|
671
|
+
beq KeccakP1600_OverwriteBytes_Bytes
|
672
|
+
mov r10, r3
|
673
|
+
adr r3, KeccakP1600_OverwriteBytes_ToBitInterleavingConstants
|
674
|
+
bl __KeccakP1600_OverwriteLanes
|
675
|
+
mov r3, r10
|
676
|
+
lsls r3, r3, #29
|
677
|
+
lsrs r3, r3, #29
|
678
|
+
KeccakP1600_OverwriteBytes_Bytes:
|
679
|
+
cmp r3, #0
|
680
|
+
beq KeccakP1600_OverwriteBytes_Exit
|
681
|
+
movs r2, #0
|
682
|
+
adr r7, KeccakP1600_OverwriteBytes_ToBitInterleavingConstants
|
683
|
+
bl __KeccakP1600_OverwriteBytesInLane
|
684
|
+
KeccakP1600_OverwriteBytes_Exit:
|
685
|
+
pop {r4 - r7}
|
686
|
+
mov r8, r4
|
687
|
+
mov r9, r5
|
688
|
+
mov r10, r6
|
689
|
+
pop {r4 - r6, pc}
|
690
|
+
KeccakP1600_OverwriteBytes_Exit1:
|
691
|
+
bx lr
|
692
|
+
nop
|
693
|
+
KeccakP1600_OverwriteBytes_ToBitInterleavingConstants:
|
694
|
+
.long 0x55555555
|
695
|
+
.long 0x33333333
|
696
|
+
.long 0x0F0F0F0F
|
697
|
+
.long 0x00FF00FF
|
698
|
+
.long 0xAAAAAAAA
|
699
|
+
.long 0xCCCCCCCC
|
700
|
+
.long 0xF0F0F0F0
|
701
|
+
.long 0xFF00FF00
|
702
|
+
|
703
|
+
|
704
|
+
@----------------------------------------------------------------------------
|
705
|
+
@
|
706
|
+
@ __KeccakP1600_OverwriteLanes
|
707
|
+
@
|
708
|
+
@ Input:
|
709
|
+
@ r0 state pointer
|
710
|
+
@ r1 data pointer
|
711
|
+
@ r2 laneCount
|
712
|
+
@ r3 to bit interleaving constants pointer
|
713
|
+
@
|
714
|
+
@ Output:
|
715
|
+
@ r0 state pointer next lane
|
716
|
+
@ r1 data pointer next byte to input
|
717
|
+
@
|
718
|
+
@ Changed: r2-r9
|
719
|
+
@
|
720
|
+
.align 8
|
721
|
+
__KeccakP1600_OverwriteLanes:
|
722
|
+
lsls r4, r1, #30
|
723
|
+
bne __KeccakP1600_OverwriteLanes_LoopUnaligned
|
724
|
+
__KeccakP1600_OverwriteLanes_LoopAligned:
|
725
|
+
ldmia r1!, {r6,r7}
|
726
|
+
mov r8, r6
|
727
|
+
mov r9, r7
|
728
|
+
toBitInterleaving r8, r9, r6, r7, r5, r4, r3
|
729
|
+
stmia r0!, {r6,r7}
|
730
|
+
subs r2, r2, #1
|
731
|
+
bne __KeccakP1600_OverwriteLanes_LoopAligned
|
732
|
+
bx lr
|
733
|
+
__KeccakP1600_OverwriteLanes_LoopUnaligned:
|
734
|
+
ldrb r6, [r1, #0]
|
735
|
+
ldrb r4, [r1, #1]
|
736
|
+
lsls r4, r4, #8
|
737
|
+
orrs r6, r6, r4
|
738
|
+
ldrb r4, [r1, #2]
|
739
|
+
lsls r4, r4, #16
|
740
|
+
orrs r6, r6, r4
|
741
|
+
ldrb r4, [r1, #3]
|
742
|
+
lsls r4, r4, #24
|
743
|
+
orrs r6, r6, r4
|
744
|
+
ldrb r7, [r1, #4]
|
745
|
+
ldrb r4, [r1, #5]
|
746
|
+
lsls r4, r4, #8
|
747
|
+
orrs r7, r7, r4
|
748
|
+
ldrb r4, [r1, #6]
|
749
|
+
lsls r4, r4, #16
|
750
|
+
orrs r7, r7, r4
|
751
|
+
ldrb r4, [r1, #7]
|
752
|
+
lsls r4, r4, #24
|
753
|
+
orrs r7, r7, r4
|
754
|
+
adds r1, r1, #8
|
755
|
+
mov r8, r6
|
756
|
+
mov r9, r7
|
757
|
+
toBitInterleaving r8, r9, r6, r7, r5, r4, r3
|
758
|
+
stmia r0!, {r6, r7}
|
759
|
+
subs r2, r2, #1
|
760
|
+
bne __KeccakP1600_OverwriteLanes_LoopUnaligned
|
761
|
+
bx lr
|
762
|
+
|
763
|
+
|
764
|
+
@----------------------------------------------------------------------------
|
765
|
+
@
|
766
|
+
@ __KeccakP1600_OverwriteBytesInLane
|
767
|
+
@
|
768
|
+
@ Input:
|
769
|
+
@ r0 state pointer
|
770
|
+
@ r1 data pointer
|
771
|
+
@ r2 offset in lane
|
772
|
+
@ r3 length
|
773
|
+
@ r7 to bit interleaving constants pointer
|
774
|
+
@
|
775
|
+
@ Output:
|
776
|
+
@ r0 state pointer next lane
|
777
|
+
@ r1 data pointer next byte to input
|
778
|
+
@
|
779
|
+
@ Changed: r2-r9
|
780
|
+
@
|
781
|
+
.align 8
|
782
|
+
__KeccakP1600_OverwriteBytesInLane:
|
783
|
+
movs r4, #0
|
784
|
+
movs r5, #0
|
785
|
+
push { r4 - r5 }
|
786
|
+
lsls r6, r2, #2
|
787
|
+
add r2, r2, sp
|
788
|
+
movs r4, #0x0F @r4 mask to wipe nibbles(bit interleaved bytes) in state
|
789
|
+
lsls r4, r4, r6
|
790
|
+
movs r6, r4
|
791
|
+
__KeccakP1600_OverwriteBytesInLane_Loop:
|
792
|
+
orrs r6, r6, r4
|
793
|
+
lsls r4, r4, #4
|
794
|
+
ldrb r5, [r1]
|
795
|
+
strb r5, [r2]
|
796
|
+
adds r1, r1, #1
|
797
|
+
adds r2, r2, #1
|
798
|
+
subs r3, r3, #1
|
799
|
+
bne __KeccakP1600_OverwriteBytesInLane_Loop
|
800
|
+
pop { r4 - r5 }
|
801
|
+
mov r8, r4
|
802
|
+
mov r9, r5
|
803
|
+
toBitInterleaving r8, r9, r4, r5, r3, r2, r7
|
804
|
+
ldr r3, [r0]
|
805
|
+
bics r3, r3, r6
|
806
|
+
eors r4, r4, r3
|
807
|
+
ldr r3, [r0, #4]
|
808
|
+
bics r3, r3, r6
|
809
|
+
eors r5, r5, r3
|
810
|
+
stmia r0!, { r4, r5 }
|
811
|
+
bx lr
|
812
|
+
|
813
|
+
|
814
|
+
@----------------------------------------------------------------------------
|
815
|
+
@
|
816
|
+
@ void KeccakP1600_OverwriteWithZeroes(void *state, unsigned int byteCount)
|
817
|
+
@
|
818
|
+
.align 8
|
819
|
+
.global KeccakP1600_OverwriteWithZeroes
|
820
|
+
.type KeccakP1600_OverwriteWithZeroes, %function;
|
821
|
+
KeccakP1600_OverwriteWithZeroes:
|
822
|
+
push {r4 - r5}
|
823
|
+
lsrs r2, r1, #3
|
824
|
+
beq KeccakP1600_OverwriteWithZeroes_Bytes
|
825
|
+
movs r4, #0
|
826
|
+
movs r5, #0
|
827
|
+
KeccakP1600_OverwriteWithZeroes_LoopLanes:
|
828
|
+
stm r0!, { r4, r5 }
|
829
|
+
subs r2, r2, #1
|
830
|
+
bne KeccakP1600_OverwriteWithZeroes_LoopLanes
|
831
|
+
KeccakP1600_OverwriteWithZeroes_Bytes:
|
832
|
+
lsls r1, r1, #32-3
|
833
|
+
beq KeccakP1600_OverwriteWithZeroes_Exit
|
834
|
+
lsrs r1, r1, #32-3
|
835
|
+
movs r3, #0x0F @r2 already zero, r3 = mask to wipe nibbles(bit interleaved bytes) in state
|
836
|
+
KeccakP1600_OverwriteWithZeroes_LoopBytes:
|
837
|
+
orrs r2, r2, r3
|
838
|
+
lsls r3, r3, #4
|
839
|
+
subs r1, r1, #1
|
840
|
+
bne KeccakP1600_OverwriteWithZeroes_LoopBytes
|
841
|
+
ldr r4, [r0]
|
842
|
+
ldr r5, [r0, #4]
|
843
|
+
bics r4, r4, r2
|
844
|
+
bics r5, r5, r2
|
845
|
+
stm r0!, { r4, r5 }
|
846
|
+
KeccakP1600_OverwriteWithZeroes_Exit:
|
847
|
+
pop {r4 - r5}
|
848
|
+
bx lr
|
849
|
+
|
850
|
+
|
851
|
+
@----------------------------------------------------------------------------
|
852
|
+
@
|
853
|
+
@ void KeccakP1600_ExtractBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
|
854
|
+
@
|
855
|
+
.align 8
|
856
|
+
.global KeccakP1600_ExtractBytes
|
857
|
+
.type KeccakP1600_ExtractBytes, %function;
|
858
|
+
KeccakP1600_ExtractBytes:
|
859
|
+
cmp r3, #0 @ .if length != 0
|
860
|
+
beq KeccakP1600_ExtractBytes_Exit1
|
861
|
+
push {r4 - r6, lr} @ then
|
862
|
+
mov r4, r8
|
863
|
+
push {r4, r7}
|
864
|
+
lsrs r4, r2, #3 @ offset &= ~7
|
865
|
+
lsls r4, r4, #3
|
866
|
+
adds r0, r0, r4 @ add whole lane offset to state pointer
|
867
|
+
lsls r2, r2, #29 @ offset &= 7 (part not lane aligned)
|
868
|
+
lsrs r2, r2, #29
|
869
|
+
beq KeccakP1600_ExtractBytes_CheckLanes @ .if offset != 0
|
870
|
+
movs r4, r3 @ then, do remaining bytes in first lane
|
871
|
+
movs r5, #8
|
872
|
+
subs r5, r2 @ max size in lane = 8 - offset
|
873
|
+
cmp r4, r5
|
874
|
+
ble KeccakP1600_ExtractBytes_BytesAlign
|
875
|
+
movs r4, r5
|
876
|
+
KeccakP1600_ExtractBytes_BytesAlign:
|
877
|
+
subs r3, r3, r4 @ size left
|
878
|
+
mov r8, r3
|
879
|
+
movs r3, r4
|
880
|
+
adr r7, KeccakP1600_ExtractBytes_FromBitInterleavingConstants
|
881
|
+
bl __KeccakP1600_ExtractBytesInLane
|
882
|
+
mov r3, r8
|
883
|
+
KeccakP1600_ExtractBytes_CheckLanes:
|
884
|
+
lsrs r2, r3, #3 @ .if length >= 8
|
885
|
+
beq KeccakP1600_ExtractBytes_Bytes
|
886
|
+
mov r8, r3
|
887
|
+
adr r3, KeccakP1600_ExtractBytes_FromBitInterleavingConstants
|
888
|
+
bl __KeccakP1600_ExtractLanes
|
889
|
+
mov r3, r8
|
890
|
+
lsls r3, r3, #29
|
891
|
+
lsrs r3, r3, #29
|
892
|
+
KeccakP1600_ExtractBytes_Bytes:
|
893
|
+
cmp r3, #0
|
894
|
+
beq KeccakP1600_ExtractBytes_Exit
|
895
|
+
movs r2, #0
|
896
|
+
adr r7, KeccakP1600_ExtractBytes_FromBitInterleavingConstants
|
897
|
+
bl __KeccakP1600_ExtractBytesInLane
|
898
|
+
KeccakP1600_ExtractBytes_Exit:
|
899
|
+
pop {r4,r7}
|
900
|
+
mov r8, r4
|
901
|
+
pop {r4 - r6, pc}
|
902
|
+
KeccakP1600_ExtractBytes_Exit1:
|
903
|
+
bx lr
|
904
|
+
nop
|
905
|
+
KeccakP1600_ExtractBytes_FromBitInterleavingConstants:
|
906
|
+
.long 0x0000FF00
|
907
|
+
.long 0x00F000F0
|
908
|
+
.long 0x0C0C0C0C
|
909
|
+
.long 0x22222222
|
910
|
+
|
911
|
+
|
912
|
+
@----------------------------------------------------------------------------
|
913
|
+
@
|
914
|
+
@ __KeccakP1600_ExtractLanes
|
915
|
+
@
|
916
|
+
@ Input:
|
917
|
+
@ r0 state pointer
|
918
|
+
@ r1 data pointer
|
919
|
+
@ r2 laneCount
|
920
|
+
@ r3 from bit interleaving constants pointer
|
921
|
+
@
|
922
|
+
@ Output:
|
923
|
+
@ r0 state pointer next lane
|
924
|
+
@ r1 data pointer next byte to output
|
925
|
+
@
|
926
|
+
@ Changed: r2-r7
|
927
|
+
@
|
928
|
+
.align 8
|
929
|
+
__KeccakP1600_ExtractLanes:
|
930
|
+
lsls r4, r1, #30
|
931
|
+
bne __KeccakP1600_ExtractLanes_LoopUnaligned
|
932
|
+
__KeccakP1600_ExtractLanes_LoopAligned:
|
933
|
+
ldmia r0!, {r6,r7}
|
934
|
+
fromBitInterleaving r6, r7, r5, r4, r3
|
935
|
+
stmia r1!, {r6,r7}
|
936
|
+
subs r2, r2, #1
|
937
|
+
bne __KeccakP1600_ExtractLanes_LoopAligned
|
938
|
+
bx lr
|
939
|
+
__KeccakP1600_ExtractLanes_LoopUnaligned:
|
940
|
+
ldmia r0!, {r6,r7}
|
941
|
+
fromBitInterleaving r6, r7, r5, r4, r3
|
942
|
+
strb r6, [r1, #0]
|
943
|
+
lsrs r6, r6, #8
|
944
|
+
strb r6, [r1, #1]
|
945
|
+
lsrs r6, r6, #8
|
946
|
+
strb r6, [r1, #2]
|
947
|
+
lsrs r6, r6, #8
|
948
|
+
strb r6, [r1, #3]
|
949
|
+
strb r7, [r1, #4]
|
950
|
+
lsrs r7, r7, #8
|
951
|
+
strb r7, [r1, #5]
|
952
|
+
lsrs r7, r7, #8
|
953
|
+
strb r7, [r1, #6]
|
954
|
+
lsrs r7, r7, #8
|
955
|
+
strb r7, [r1, #7]
|
956
|
+
adds r1, r1, #8
|
957
|
+
subs r2, r2, #1
|
958
|
+
bne __KeccakP1600_ExtractLanes_LoopUnaligned
|
959
|
+
bx lr
|
960
|
+
|
961
|
+
|
962
|
+
@----------------------------------------------------------------------------
|
963
|
+
@
|
964
|
+
@ __KeccakP1600_ExtractBytesInLane
|
965
|
+
@
|
966
|
+
@ Input:
|
967
|
+
@ r0 state pointer
|
968
|
+
@ r1 data pointer
|
969
|
+
@ r2 offset in lane
|
970
|
+
@ r3 length
|
971
|
+
@ r7 from bit interleaving constants pointer
|
972
|
+
@
|
973
|
+
@ Output:
|
974
|
+
@ r0 state pointer next lane
|
975
|
+
@ r1 data pointer next byte to output
|
976
|
+
@
|
977
|
+
@ Changed: r2-r7
|
978
|
+
@
|
979
|
+
.align 8
|
980
|
+
__KeccakP1600_ExtractBytesInLane:
|
981
|
+
ldmia r0!, {r4,r5}
|
982
|
+
push {r0, r3}
|
983
|
+
fromBitInterleaving r4, r5, r0, r3, r7
|
984
|
+
pop {r0, r3}
|
985
|
+
push {r4, r5}
|
986
|
+
mov r4, sp
|
987
|
+
adds r4, r4, r2
|
988
|
+
__KeccakP1600_ExtractBytesInLane_Loop:
|
989
|
+
ldrb r2, [r4]
|
990
|
+
adds r4, r4, #1
|
991
|
+
strb r2, [r1]
|
992
|
+
adds r1, r1, #1
|
993
|
+
subs r3, r3, #1
|
994
|
+
bne __KeccakP1600_ExtractBytesInLane_Loop
|
995
|
+
add sp, #8
|
996
|
+
bx lr
|
997
|
+
|
998
|
+
|
999
|
+
@----------------------------------------------------------------------------
|
1000
|
+
@
|
1001
|
+
@ void KeccakP1600_ExtractAndAddBytes(void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
|
1002
|
+
@
|
1003
|
+
.align 8
|
1004
|
+
.global KeccakP1600_ExtractAndAddBytes
|
1005
|
+
.type KeccakP1600_ExtractAndAddBytes, %function;
|
1006
|
+
KeccakP1600_ExtractAndAddBytes:
|
1007
|
+
push {r3 - r7, lr}
|
1008
|
+
mov r4, r8
|
1009
|
+
mov r5, r9
|
1010
|
+
push {r4 - r5}
|
1011
|
+
mov r9, r2
|
1012
|
+
mov r2, r3
|
1013
|
+
ldr r3, [sp, #8*4]
|
1014
|
+
cmp r3, #0 @ .if length != 0
|
1015
|
+
beq KeccakP1600_ExtractAndAddBytes_Exit
|
1016
|
+
lsrs r4, r2, #3 @ offset &= ~7
|
1017
|
+
lsls r4, r4, #3
|
1018
|
+
adds r0, r0, r4 @ add whole lane offset to state pointer
|
1019
|
+
lsls r2, r2, #29 @ offset &= 7 (part not lane aligned)
|
1020
|
+
lsrs r2, r2, #29
|
1021
|
+
beq KeccakP1600_ExtractAndAddBytes_CheckLanes @ .if offset != 0
|
1022
|
+
movs r4, r3 @ then, do remaining bytes in first lane
|
1023
|
+
movs r5, #8
|
1024
|
+
subs r5, r2 @ max size in lane = 8 - offset
|
1025
|
+
cmp r4, r5
|
1026
|
+
ble KeccakP1600_ExtractAndAddBytes_BytesAlign
|
1027
|
+
movs r4, r5
|
1028
|
+
KeccakP1600_ExtractAndAddBytes_BytesAlign:
|
1029
|
+
subs r3, r3, r4 @ size left
|
1030
|
+
mov r8, r3
|
1031
|
+
movs r3, r4
|
1032
|
+
adr r7, KeccakP1600_ExtractAndAddBytes_FromBitInterleavingConstants
|
1033
|
+
bl __KeccakP1600_ExtractAndAddBytesInLane
|
1034
|
+
mov r3, r8
|
1035
|
+
KeccakP1600_ExtractAndAddBytes_CheckLanes:
|
1036
|
+
lsrs r2, r3, #3 @ .if length >= 8
|
1037
|
+
beq KeccakP1600_ExtractAndAddBytes_Bytes
|
1038
|
+
mov r8, r3
|
1039
|
+
adr r3, KeccakP1600_ExtractAndAddBytes_FromBitInterleavingConstants
|
1040
|
+
bl __KeccakP1600_ExtractAndAddLanes
|
1041
|
+
mov r3, r8
|
1042
|
+
lsls r3, r3, #29
|
1043
|
+
lsrs r3, r3, #29
|
1044
|
+
KeccakP1600_ExtractAndAddBytes_Bytes:
|
1045
|
+
cmp r3, #0
|
1046
|
+
beq KeccakP1600_ExtractAndAddBytes_Exit
|
1047
|
+
movs r2, #0
|
1048
|
+
adr r7, KeccakP1600_ExtractAndAddBytes_FromBitInterleavingConstants
|
1049
|
+
bl __KeccakP1600_ExtractAndAddBytesInLane
|
1050
|
+
KeccakP1600_ExtractAndAddBytes_Exit:
|
1051
|
+
pop {r4 - r5}
|
1052
|
+
mov r8, r4
|
1053
|
+
mov r9, r5
|
1054
|
+
pop {r3 - r7, pc}
|
1055
|
+
.align 8
|
1056
|
+
KeccakP1600_ExtractAndAddBytes_FromBitInterleavingConstants:
|
1057
|
+
.long 0x0000FF00
|
1058
|
+
.long 0x00F000F0
|
1059
|
+
.long 0x0C0C0C0C
|
1060
|
+
.long 0x22222222
|
1061
|
+
|
1062
|
+
|
1063
|
+
@----------------------------------------------------------------------------
|
1064
|
+
@
|
1065
|
+
@ __KeccakP1600_ExtractAndAddLanes
|
1066
|
+
@
|
1067
|
+
@ Input:
|
1068
|
+
@ r0 state pointer
|
1069
|
+
@ r1 in pointer
|
1070
|
+
@ r2 laneCount
|
1071
|
+
@ r3 from bit interleaving constants pointer
|
1072
|
+
@ r9 out pointer
|
1073
|
+
@
|
1074
|
+
@ Output:
|
1075
|
+
@ r0 state pointer next lane
|
1076
|
+
@ r1 in pointer (next lane)
|
1077
|
+
@ r9 out pointer (next lane)
|
1078
|
+
@
|
1079
|
+
@ Changed: r2-r7
|
1080
|
+
@
|
1081
|
+
.align 8
|
1082
|
+
__KeccakP1600_ExtractAndAddLanes:
|
1083
|
+
lsls r4, r1, #30
|
1084
|
+
bne __KeccakP1600_ExtractAndAddLanes_LoopUnaligned
|
1085
|
+
mov r4, r9
|
1086
|
+
lsls r4, r4, #30
|
1087
|
+
bne __KeccakP1600_ExtractAndAddLanes_LoopUnaligned
|
1088
|
+
__KeccakP1600_ExtractAndAddLanes_LoopAligned:
|
1089
|
+
ldmia r0!, {r6,r7}
|
1090
|
+
fromBitInterleaving r6, r7, r5, r4, r3
|
1091
|
+
mov r4, r9
|
1092
|
+
ldm r1!, {r5}
|
1093
|
+
eors r6, r6, r5
|
1094
|
+
ldm r1!, {r5}
|
1095
|
+
eors r7, r7, r5
|
1096
|
+
stmia r4!, {r6,r7}
|
1097
|
+
mov r9, r4
|
1098
|
+
subs r2, r2, #1
|
1099
|
+
bne __KeccakP1600_ExtractAndAddLanes_LoopAligned
|
1100
|
+
bx lr
|
1101
|
+
__KeccakP1600_ExtractAndAddLanes_LoopUnaligned:
|
1102
|
+
ldmia r0!, {r6,r7}
|
1103
|
+
fromBitInterleaving r6, r7, r5, r4, r3
|
1104
|
+
mov r4, r9
|
1105
|
+
ldrb r5, [r1, #0]
|
1106
|
+
eors r5, r5, r6
|
1107
|
+
strb r5, [r4, #0]
|
1108
|
+
lsrs r6, r6, #8
|
1109
|
+
ldrb r5, [r1, #1]
|
1110
|
+
eors r5, r5, r6
|
1111
|
+
strb r5, [r4, #1]
|
1112
|
+
lsrs r6, r6, #8
|
1113
|
+
ldrb r5, [r1, #2]
|
1114
|
+
eors r5, r5, r6
|
1115
|
+
strb r5, [r4, #2]
|
1116
|
+
lsrs r6, r6, #8
|
1117
|
+
ldrb r5, [r1, #3]
|
1118
|
+
eors r5, r5, r6
|
1119
|
+
strb r5, [r4, #3]
|
1120
|
+
ldrb r5, [r1, #4]
|
1121
|
+
eors r5, r5, r7
|
1122
|
+
strb r5, [r4, #4]
|
1123
|
+
lsrs r7, r7, #8
|
1124
|
+
ldrb r5, [r1, #5]
|
1125
|
+
eors r5, r5, r7
|
1126
|
+
strb r5, [r4, #5]
|
1127
|
+
lsrs r7, r7, #8
|
1128
|
+
ldrb r5, [r1, #6]
|
1129
|
+
eors r5, r5, r7
|
1130
|
+
strb r5, [r4, #6]
|
1131
|
+
lsrs r7, r7, #8
|
1132
|
+
ldrb r5, [r1, #7]
|
1133
|
+
eors r5, r5, r7
|
1134
|
+
strb r5, [r4, #7]
|
1135
|
+
adds r1, r1, #8
|
1136
|
+
adds r4, r4, #8
|
1137
|
+
mov r9, r4
|
1138
|
+
subs r2, r2, #1
|
1139
|
+
bne __KeccakP1600_ExtractAndAddLanes_LoopUnaligned
|
1140
|
+
bx lr
|
1141
|
+
|
1142
|
+
|
1143
|
+
@----------------------------------------------------------------------------
|
1144
|
+
@
|
1145
|
+
@ __KeccakP1600_ExtractAndAddBytesInLane
|
1146
|
+
@
|
1147
|
+
@ Input:
|
1148
|
+
@ r0 state pointer
|
1149
|
+
@ r1 data pointer
|
1150
|
+
@ r2 offset in lane
|
1151
|
+
@ r3 length
|
1152
|
+
@ r7 from bit interleaving constants pointer
|
1153
|
+
@ r9 out pointer
|
1154
|
+
@
|
1155
|
+
@ Output:
|
1156
|
+
@ r0 state pointer next lane
|
1157
|
+
@ r1 in pointer (next byte)
|
1158
|
+
@ r9 out pointer (next byte)
|
1159
|
+
@
|
1160
|
+
@ Changed: r2-r7
|
1161
|
+
@
|
1162
|
+
.align 8
|
1163
|
+
__KeccakP1600_ExtractAndAddBytesInLane:
|
1164
|
+
ldmia r0!, {r4,r5}
|
1165
|
+
push {r0, r3}
|
1166
|
+
fromBitInterleaving r4, r5, r0, r3, r7
|
1167
|
+
pop {r0, r3}
|
1168
|
+
push {r4, r5}
|
1169
|
+
mov r4, sp
|
1170
|
+
adds r4, r4, r2
|
1171
|
+
mov r6, r9
|
1172
|
+
__KeccakP1600_ExtractAndAddBytesInLane_Loop:
|
1173
|
+
ldrb r2, [r4]
|
1174
|
+
adds r4, r4, #1
|
1175
|
+
ldrb r5, [r1]
|
1176
|
+
eors r2, r2, r5
|
1177
|
+
strb r2, [r6]
|
1178
|
+
adds r1, r1, #1
|
1179
|
+
adds r6, r6, #1
|
1180
|
+
subs r3, r3, #1
|
1181
|
+
bne __KeccakP1600_ExtractAndAddBytesInLane_Loop
|
1182
|
+
add sp, #8
|
1183
|
+
mov r9, r6
|
1184
|
+
bx lr
|
1185
|
+
|
1186
|
+
|
1187
|
+
@ ----------------------------------------------------------------------------
|
1188
|
+
@
|
1189
|
+
@ void KeccakP1600_Permute_Nrounds(void *state, unsigned int nrounds)
|
1190
|
+
@
|
1191
|
+
.align 8
|
1192
|
+
.global KeccakP1600_Permute_Nrounds
|
1193
|
+
.type KeccakP1600_Permute_Nrounds, %function;
|
1194
|
+
KeccakP1600_Permute_Nrounds:
|
1195
|
+
movs r2, r1
|
1196
|
+
lsls r3, r2, #3
|
1197
|
+
adr r1, KeccakP1600_Permute_RoundConstants0
|
1198
|
+
subs r1, r1, r3
|
1199
|
+
lsls r2, r2, #31
|
1200
|
+
bne KeccakP1600_Permute_NroundsOdd
|
1201
|
+
b KeccakP1600_Permute
|
1202
|
+
KeccakP1600_Permute_NroundsOdd:
|
1203
|
+
push { r4 - r6, lr }
|
1204
|
+
mov r2, r8
|
1205
|
+
mov r3, r9
|
1206
|
+
mov r4, r10
|
1207
|
+
mov r5, r11
|
1208
|
+
mov r6, r12
|
1209
|
+
push { r2 - r7 }
|
1210
|
+
sub sp, #mSize
|
1211
|
+
subs r1, r1, #8
|
1212
|
+
str r1, [sp, #mRC]
|
1213
|
+
mov r7, sp
|
1214
|
+
ldm r0!, {r1-r5}
|
1215
|
+
stm r7!, {r1-r5}
|
1216
|
+
ldm r0!, {r1-r5}
|
1217
|
+
stm r7!, {r1-r5}
|
1218
|
+
ldm r0!, {r1-r5}
|
1219
|
+
stm r7!, {r1-r5}
|
1220
|
+
ldm r0!, {r1-r5}
|
1221
|
+
stm r7!, {r1-r5}
|
1222
|
+
ldm r0!, {r1-r5}
|
1223
|
+
stm r7!, {r1-r5}
|
1224
|
+
ldm r0!, {r1-r5}
|
1225
|
+
stm r7!, {r1-r5}
|
1226
|
+
ldm r0!, {r1-r5}
|
1227
|
+
stm r7!, {r1-r5}
|
1228
|
+
ldm r0!, {r1-r5}
|
1229
|
+
stm r7!, {r1-r5}
|
1230
|
+
ldm r0!, {r1-r5}
|
1231
|
+
stm r7!, {r1-r5}
|
1232
|
+
ldm r0!, {r1-r5}
|
1233
|
+
stm r7!, {r1-r5}
|
1234
|
+
subs r0, r0, #25*2*4
|
1235
|
+
movs r7, #_ma0
|
1236
|
+
adds r7, r7, r0
|
1237
|
+
b KeccakP1600_Permute_RoundOdd
|
1238
|
+
|
1239
|
+
|
1240
|
+
@ ----------------------------------------------------------------------------
|
1241
|
+
@
|
1242
|
+
@ void KeccakP1600_Permute_12rounds( void *state )
|
1243
|
+
@
|
1244
|
+
.align 8
|
1245
|
+
.global KeccakP1600_Permute_12rounds
|
1246
|
+
.type KeccakP1600_Permute_12rounds, %function;
|
1247
|
+
KeccakP1600_Permute_12rounds:
|
1248
|
+
adr r1, KeccakP1600_Permute_RoundConstants12
|
1249
|
+
b KeccakP1600_Permute
|
1250
|
+
|
1251
|
+
|
1252
|
+
@ ----------------------------------------------------------------------------
|
1253
|
+
@
|
1254
|
+
@ void KeccakP1600_Permute_24rounds( void *state )
|
1255
|
+
@
|
1256
|
+
.align 8
|
1257
|
+
.global KeccakP1600_Permute_24rounds
|
1258
|
+
.type KeccakP1600_Permute_24rounds, %function;
|
1259
|
+
KeccakP1600_Permute_24rounds:
|
1260
|
+
adr r1, KeccakP1600_Permute_RoundConstants24
|
1261
|
+
b KeccakP1600_Permute
|
1262
|
+
|
1263
|
+
|
1264
|
+
.align 8
|
1265
|
+
KeccakP1600_Permute_RoundConstants24:
|
1266
|
+
@ 0 1
|
1267
|
+
.long 0x00000001, 0x00000000
|
1268
|
+
.long 0x00000000, 0x00000089
|
1269
|
+
.long 0x00000000, 0x8000008b
|
1270
|
+
.long 0x00000000, 0x80008080
|
1271
|
+
.long 0x00000001, 0x0000008b
|
1272
|
+
.long 0x00000001, 0x00008000
|
1273
|
+
.long 0x00000001, 0x80008088
|
1274
|
+
.long 0x00000001, 0x80000082
|
1275
|
+
.long 0x00000000, 0x0000000b
|
1276
|
+
.long 0x00000000, 0x0000000a
|
1277
|
+
.long 0x00000001, 0x00008082
|
1278
|
+
.long 0x00000000, 0x00008003
|
1279
|
+
KeccakP1600_Permute_RoundConstants12:
|
1280
|
+
.long 0x00000001, 0x0000808b
|
1281
|
+
.long 0x00000001, 0x8000000b
|
1282
|
+
.long 0x00000001, 0x8000008a
|
1283
|
+
.long 0x00000001, 0x80000081
|
1284
|
+
.long 0x00000000, 0x80000081
|
1285
|
+
.long 0x00000000, 0x80000008
|
1286
|
+
.long 0x00000000, 0x00000083
|
1287
|
+
.long 0x00000000, 0x80008003
|
1288
|
+
.long 0x00000001, 0x80008088
|
1289
|
+
.long 0x00000000, 0x80000088
|
1290
|
+
.long 0x00000001, 0x00008000
|
1291
|
+
.long 0x00000000, 0x80008082
|
1292
|
+
KeccakP1600_Permute_RoundConstants0:
|
1293
|
+
.long 0x000000FF @terminator
|
1294
|
+
|
1295
|
+
@----------------------------------------------------------------------------
|
1296
|
+
@
|
1297
|
+
@ void KeccakP1600_Permute( void *state, void * rc )
|
1298
|
+
@
|
1299
|
+
.align 8
|
1300
|
+
KeccakP1600_Permute:
|
1301
|
+
push { r4 - r6, lr }
|
1302
|
+
mov r2, r8
|
1303
|
+
mov r3, r9
|
1304
|
+
mov r4, r10
|
1305
|
+
mov r5, r11
|
1306
|
+
mov r6, r12
|
1307
|
+
push { r2 - r7 }
|
1308
|
+
sub sp, #mSize
|
1309
|
+
movs r7, #_ma0
|
1310
|
+
adds r7, r7, r0
|
1311
|
+
KeccakP1600_Permute_RoundLoop:
|
1312
|
+
str r1, [sp, #mRC]
|
1313
|
+
Kround 0, 0
|
1314
|
+
KeccakP1600_Permute_RoundOdd:
|
1315
|
+
Kround 1, 8
|
1316
|
+
adds r1, r1, #2*8 @ Update pointer RC
|
1317
|
+
ldr r6, [r1] @ Check terminator
|
1318
|
+
cmp r6, #0xFF
|
1319
|
+
beq KeccakP1600_Permute_Done
|
1320
|
+
ldr r6, =KeccakP1600_Permute_RoundLoop+1
|
1321
|
+
bx r6
|
1322
|
+
.align 8
|
1323
|
+
.ltorg
|
1324
|
+
KeccakP1600_Permute_Done:
|
1325
|
+
add sp, #mSize
|
1326
|
+
pop { r1 - r5, r7 }
|
1327
|
+
mov r8, r1
|
1328
|
+
mov r9, r2
|
1329
|
+
mov r10, r3
|
1330
|
+
mov r11, r4
|
1331
|
+
mov r12, r5
|
1332
|
+
pop { r4 - r6, pc }
|
1333
|
+
|
1334
|
+
|