open-quantum-safe / liboqs

C library for prototyping and experimenting with quantum-resistant cryptography
https://openquantumsafe.org/
Other
1.82k stars 447 forks source link

Extend constant-time testing #1807

Open bhess opened 3 months ago

bhess commented 3 months ago

This issue is to suggest extending the constant-time testing to include more configurations.

Background: modern compilers might add regressions by 'optimizing' code meant to be constant-time and adding conditional branches. An example is a recent regression in the Kyber/ML-KEM reference code, when using clang >= v15 on x86_64 and compiler options -Os, -O1, -O2 -fno-vectorize or -O3 -fno-vectorize.

The liboqs constant-time tooling would be able to detect the above issue, but CI runs the test only on a single platform, with one compiler (gcc) and with one configuration (cmake DEBUG).

To cover such cases, the suggestion would be to run the tests with different variables (e.g., in weekly tests). For example:

I think it's unrealistic to be really exhaustive, but it should be document which configurations were tested (and what the limitations of the tests are).