I have a question to Rust language developers. I was wondering if it was ever considered to implement possibility to declare a function to be constant time.
When declared as such, function would execute always in same amount of time (same number of instructions) no matter which branch has been taken.
I'm not even sure if it's possible to implement such thing, but it would be very useful for all cryptography related algorithms, to mitigate timing attacks.
Unfortunately, even taking the same number of the same instructions is not enough. You also have to access the same memory locations (possibly in the same order).
@skade that's a different thing. const-fn is just a function that is valid to run at compile time. This thread is talking about functions whose (real) running time isn't affected by the inputs -- a property important for crypto.