Skip to content
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

Merged
merged 13 commits into from
Nov 16, 2023
Merged

Constant time comparison for SigV4a #3174

merged 13 commits into from
Nov 16, 2023

Conversation

82marbag
Copy link
Contributor

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.

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
@82marbag 82marbag requested a review from a team as a code owner November 10, 2023 19:37
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
aws/rust-runtime/aws-sigv4/Cargo.toml Outdated Show resolved Hide resolved
aws/rust-runtime/aws-sigv4/src/sign/v4a.rs Outdated Show resolved Hide resolved
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);
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

@rcoh
Copy link
Collaborator

rcoh commented Nov 10, 2023

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>
@smithy-lang smithy-lang deleted a comment from github-actions bot Nov 13, 2023
@smithy-lang smithy-lang deleted a comment from github-actions bot Nov 13, 2023
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
82marbag and others added 2 commits November 14, 2023 09:31
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
@82marbag 82marbag enabled auto-merge November 15, 2023 08:38
@smithy-lang smithy-lang deleted a comment from github-actions bot Nov 15, 2023
@smithy-lang smithy-lang deleted a comment from github-actions bot Nov 15, 2023
@smithy-lang smithy-lang deleted a comment from github-actions bot Nov 15, 2023
@smithy-lang smithy-lang deleted a comment from github-actions bot Nov 16, 2023
@smithy-lang smithy-lang deleted a comment from github-actions bot Nov 16, 2023
@smithy-lang smithy-lang deleted a comment from github-actions bot Nov 16, 2023
Copy link

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@82marbag 82marbag added this pull request to the merge queue Nov 16, 2023
Merged via the queue into main with commit 4411131 Nov 16, 2023
41 checks passed
@82marbag 82marbag deleted the constant-time-sigv4a branch November 16, 2023 20:43
@smithy-lang smithy-lang deleted a comment from github-actions bot Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Constant time comparison for SigV4a
3 participants