2 ms·
I think a good solution involves more than operations. Consider: int a = read_a_value(); a = constant_time_add(a+1); do_something_with(a); In many
by amluto 2y ago
I think a good solution involves more than operations. Consider:
int a = read_a_value();
a = constant_time_add(a+1);
do_something_with(a);
In many languages, the compiler is free to insert entirely new operations between these statements so long as the output isn’t affected. Or the compiler could reuse a register that contained a to do something else and do something awful like zeroing that register in non-constant time.
I think that new types are a better solution. A type could be specified such that the compiler must not use its value in a non-constant time operation, nor may the compiler leak it into an initialized value.