-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added more constant-time code / removed biases in the prime number generation routines. #182
Conversation
…generation routines.
(Edit: previous message send before it was complete, sorry.) Thanks for your contribution!
|
Regarding ...by common compilers with various optimization...: for sure, it is impossible to check every version of every compiler on every platform with every flag combination. Therefore, I tend to prefer writing flow-constant code, for security hygiene reasons, even if it is less readable. For a solid reference, see e.g. https://cryptocoding.net/index.php/Coding_rules#Compare_secret_strings_in_constant_time |
I agree it's impossible. But for the same reason, it's impossible to guarantee that flow-constant C code will always be translated to flow-constant assembly code by every compiler on every platform with every flag combination, and the cited reference indeed gives an example when that fails to happen: This reference (which I already knew) is indeed solid on the how, but IMO no so solid on the why. For constant-time string comparison, it jumps straight from the obviously bad "stop early" version to the version with only bit operations without a word about why they think a version with a constant number of iterations but using OTOH, I agree that the way of coding you recommend is indeed the accepted "best practice". I just feel chronically uncomfortable about this "best practice" being, IMHO, not that well motivated. (This probably shows in my code, which currently contains a mix of |
PS: just to be clear, I've been arguing about the constant-time part because I was hoping you could convince me, rather that the other way round :) |
Ok, I finally convinced myself that replacing I guess I'm in for some code review and fixing (I'm sure there are other places than these, at least one in our Bleichenbacher counter-measure in ssl_srv.c, but maybe others as well). |
Thank you to provide this information: it confirms my feelings (and those of many applied cryptographers), and the strategy of being conservative regarding those aspects! Are you going to keep the link https://github.com/mpg/ct/blob/master/results alive? If yes, one might add a link to it on https://www.cryptocoding.net. |
I fully intend to keep the data available (since having to rely on feelings rather than data was the main reason for my earlier hesitations, so I hope it will help others), but it's not entirely clear yet if this specific link will continue to work. However, I can update the link on cryptocoding.net if/when it changes. |
Hi Pascal, I'm currently busy getting a standard CLA for mbed TLS within ARM. When that is done, I'll send it to you, so we can integrate your improvements into the core codebase! |
Pascal, It is done. Can you send me your e-mail address? paul dot bakker at arm dot com |
…w_private_key Asymmetric import/export format: raw private EC keys
…-reduction Replace some macros by functions in ecp
Add a length check before reading packet data.
This pull request brings two changes: