floodyberry / chacha-opt

Optimized block functions for the ChaCha stream cipher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AVX2-32 Errors

krovetz opened this issue · comments

Hello Andrew,

Today using gcc 5.3 on an Arch linux multilib system I see errors reported for AVX2-32.

haswell> ./configure --force-32bits
cleaning project [chacha]
framework/include/asmopt.h generated for chacha, run 'make' or 'make [util,exe]' now
haswell> make util
gcc -m32 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_CHACHA -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -MMD -MF build/framework/driver/cpucycles.temp -c -o build/framework/driver/cpucycles.o framework/driver/cpucycles.c
gcc -m32 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_CHACHA -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -MMD -MF build/framework/driver/cpuid.temp -c -o build/framework/driver/cpuid.o framework/driver/cpuid.c
gcc -m32 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_CHACHA -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -MMD -MF build_util/app/extensions/chacha/impl.temp -DUTILITIES -c -o build_util/app/extensions/chacha/impl.o app/extensions/chacha/impl.c
gcc -m32 -c -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -Wa,-I./app/extensions -Wa,-I./app/include -Wa,-I./framework/include -Wa,-I./framework/driver -Wa,-I./framework/driver/x86 -MMD -MF build/app/extensions/chacha/chacha.temp -D BUILDING_ASM -c -o build/app/extensions/chacha/chacha.o app/extensions/chacha/chacha.S
gcc -m32 -c -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -Wa,-I./app/extensions -Wa,-I./app/include -Wa,-I./framework/include -Wa,-I./framework/driver -Wa,-I./framework/driver/x86 -MMD -MF build/framework/driver/x86/driver.temp -D BUILDING_ASM -c -o build/framework/driver/x86/driver.o framework/driver/x86/driver.S
gcc -m32 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_CHACHA -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -MMD -MF build_util/framework/main_util.temp -DUTILITIES -c -o build_util/framework/main_util.o framework/main_util.c
gcc -m32 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_CHACHA -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -MMD -MF build_util/framework/bench.temp -DUTILITIES -c -o build_util/framework/bench.o framework/bench.c
gcc -m32 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_CHACHA -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -MMD -MF build_util/framework/fuzz.temp -DUTILITIES -c -o build_util/framework/fuzz.o framework/fuzz.c
gcc -m32 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_CHACHA -o bin/chacha-util  build/framework/driver/cpucycles.o  build/framework/driver/cpuid.o  build_util/app/extensions/chacha/impl.o  build/app/extensions/chacha/chacha.o  build/framework/driver/x86/driver.o  build_util/framework/main_util.o  build_util/framework/bench.o  build_util/framework/fuzz.o
built [bin/chacha-util]
haswell> bin/chacha-util bench
ChaCha

---- 8 rounds ----
time granularity: 28 cycles, 2900851904 cycles/second

avx2: error in implementation!
avx2: error in implementation!
avx2: error in implementation!
avx2: error in implementation!

---- 12 rounds ----
avx2: error in implementation!
avx2: error in implementation!
avx2: error in implementation!
avx2: error in implementation!

---- 20 rounds ----
avx2: error in implementation!
avx2: error in implementation!
avx2: error in implementation!
avx2: error in implementation!
HChaCha

---- 8 rounds ----
avx2: error in implementation!

---- 12 rounds ----
avx2: error in implementation!

---- 20 rounds ----
avx2: error in implementation!
haswell> 

Git bisect and chacha-util fuzz reveals that this was introduced in d69e5ac.