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

AES ECB mode support #597

Merged
merged 3 commits into from
Nov 15, 2024
Merged

AES ECB mode support #597

merged 3 commits into from
Nov 15, 2024

Conversation

skmcgrail
Copy link
Member

Issues:

Resolves #573

Description of changes:

  • Adds support for ECB mode with pkcs7 padding
  • Adds support for ECB mode with pkcs7 padding using the streaming interface
  • Adds support for ECB mode without padding (requires input/output to be multiple of block length).

Call-outs:

  • Streaming mode doesn't support ECB without padding as the EVP interface doesn't have a way to toggle off the behavior for this mode.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@skmcgrail skmcgrail requested a review from a team as a code owner November 15, 2024 20:28
@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 93.48269% with 32 lines in your changes missing coverage. Please review.

Project coverage is 92.69%. Comparing base (c358484) to head (dcb21a1).
Report is 114 commits behind head on main.

Files with missing lines Patch % Lines
aws-lc-rs/src/cipher/aes.rs 92.40% 11 Missing and 7 partials ⚠️
aws-lc-rs/src/cipher/streaming.rs 93.75% 2 Missing and 7 partials ⚠️
aws-lc-rs/src/cipher.rs 94.18% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #597      +/-   ##
==========================================
- Coverage   95.80%   92.69%   -3.11%     
==========================================
  Files          61       67       +6     
  Lines        8143     9772    +1629     
  Branches        0     9772    +9772     
==========================================
+ Hits         7801     9058    +1257     
- Misses        342      429      +87     
- Partials        0      285     +285     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

aws-lc-rs/src/cipher.rs Outdated Show resolved Hide resolved
aws-lc-rs/src/cipher.rs Outdated Show resolved Hide resolved
aws-lc-rs/src/cipher.rs Outdated Show resolved Hide resolved
aws-lc-rs/src/cipher/padded.rs Outdated Show resolved Hide resolved
aws-lc-rs/src/cipher/padded.rs Outdated Show resolved Hide resolved
@skmcgrail skmcgrail requested a review from justsmth November 15, 2024 21:55
aes_ecb_decrypt(key, block);
}

// This is a sanity check hat should not fail. We validate in `decrypt` that in_out.len() % block_len == 0 for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// This is a sanity check hat should not fail. We validate in `decrypt` that in_out.len() % block_len == 0 for
// This is a sanity check that should not fail. We validate in `decrypt` that in_out.len() % block_len == 0 for

Comment on lines +1097 to +1098
2,
9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like all of these using 2-9 (including the original code). What's the meaning behind the numbers and can we just move them within the macro/abstract them as variables?

@justsmth justsmth merged commit 602aeb7 into aws:main Nov 15, 2024
236 of 246 checks passed
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.

Decrypting AES ECB payload
4 participants