ascon / ascon-c

Ascon - Lightweight Authenticated Encryption & Hashing
https://ascon.iaik.tugraz.at/
Creative Commons Zero v1.0 Universal
189 stars 30 forks source link

CMakeLists.txt creates non-portable code #8

Closed schwaerz closed 1 year ago

schwaerz commented 1 year ago

In https://github.com/ascon/ascon-c/blob/main/CMakeLists.txt#L27 CMakeLists.txt tells the compiler to optimize the generated object files for the current CPU.

Then of course the resulting binary may not work on other machines.

So it happened to us: When creating the code on a not-really-new Core-i7, it did not run on an older Xeon CPU.

Imho this needs to be changed to some fixed value per compilation target. Imho the easiest solution would be to use the compiler default - at least for -march - (remove those specifications) and let the end user decide in case more optimization will be required.

mschlaeffer commented 1 year ago

We default to optimized implementations in cmake. The Release flags can be set manually using the REL_FLAGS variable to compile for a different CPU. I have updated the README accordingly.

The -march=native optimization can be deactivated by calling e.g.: cmake .. -DREL_FLAGS="-O2;-fomit-frame-pointer"