Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAnnotate blocks that must run in constant time regardless of inputs #9859
Comments
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
|
Triage. This seems useful, but very complex and probably out of scope for now. |
This comment has been minimized.
This comment has been minimized.
|
Agreed that it's out of scope since it requires llvm-side guarantee. It's possible to write constant-time code with |
This comment has been minimized.
This comment has been minimized.
|
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized. This issue has been moved to the RFCs repo: rust-lang/rfcs#847 |
steveklabnik
referenced this issue
Feb 14, 2015
Closed
Annotate blocks that must run in constant time regardless of inputs #847
steveklabnik
closed this
Feb 14, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zackw commentedOct 15, 2013
In a whole bunch of security-related contexts it's important to write code that runs in constant time regardless of input; the obvious example is that if you compare two strings character-by-character for equality and break out of the loop when you hit the first difference, someone might learn how much of their forged authentication token (for example) was correct by measuring the time it took to fail.
Constant-time code requires careful programming, but in the general case it also requires compiler support -- at minimum, it has to be possible to disable optimizations that would convert
a|btoa||bin the name of speed, or similar. Ideally, though, the compiler would verify that an annotated block would execute in constant time, and fail the compilation if it was impossible to guarantee that of the generated code.I think the natural way to expose this in Rust is a
#[constant_time]annotation that could be applied to blocks. Most of the heavy lifting, however, probably needs to be done in the LLVM core.