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

CBMC: Some minor clean-up #439

Closed mkannwischer closed 22 hours ago

mkannwischer commented 1 day ago

This is a series of small improvements to the CBMC annotations and proofs that I have been holding back.

I'd like your opinion particularly on the first commit: We can remove all loop annotations in the relatively simple loops in polyvec.c. I very much prefer fewer annotations in code.

The reason, this didn't actually work before was that we got the loop index wrong. Functions like POLYVEC_UBOUND are defined as an empty while loop in debug.h and, hence, count as a loop for CBMC.

There are potentially more places where this can help.

mkannwischer commented 1 day ago

I double checked that c10c3f7 had no impact on the proof run-time of

hanno-becker commented 22 hours ago

I agree that annotations should be kept to a minimum. If a loop can simply be fully unrolled without incurring a meaningful performance cost, we should do that.