pq-code-package / mlkem-native

High-assurance, high-performance ML-KEM implementation for mobile, pc, and server targets
https://pq-code-package.github.io/mlkem-native/dev/bench/
Apache License 2.0
11 stars 9 forks source link

Build: Never use -flto for verify.c #438

Closed hanno-becker closed 1 day ago

hanno-becker commented 1 day ago

verify.c contains various functions which must not be inlined because compilers are tempted to compile them into code that's not constant time and thereby leaks something about the secret data being processed.

If -flto is used as a compile-time flag, verify.c is likely to be inlined.

This commit modifies the Makefile to force -fno-lto for verify.c, overwriting -flto if present.

This in particular affects our CI benchmarks, which do compile with -flto.