-
Notifications
You must be signed in to change notification settings - Fork 197
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
Constant time comparison for SigV4a #3174
Conversation
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
let d = Zeroizing::new(pk.to_bytes_be().1); | ||
break SigningKey::from_bytes(&d).unwrap(); | ||
if k0 <= BIG_N_MINUS_2 { | ||
let pk = k0.checked_add(&U256::ONE).unwrap_or(U256::ZERO); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it might be a change in behavior. What was the behavior for the +
operator previously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a change in behavior. k0 + 1
is computed when k0 <= BIG_N_MINUS_2
, and BIG_N_MINUS_2 < U256::MAX
. I can change the unwrap_or
to expect
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an expect
with the reasoning above would be clearer.
We should rerun the sigv4a canary before merging this for sure |
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
A new generated diff is ready to view.
A new doc preview is ready to view. |
Closes #3162
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.