Small speedups for AES-GCM:#204
Open
brian-pane wants to merge 1 commit into
Open
Conversation
brian-pane
commented
Jul 3, 2026
Contributor
- Eliminate a copy in the GHASH(length) computation at the end.
- In the tag computation, instead of copying the 128-bit GHASH result into a u8 array and doing a bytewise XOR loop, load it into a u128 and do a vector XOR.
Contributor
Author
|
On aarch64, this provides a modest speedup when doing AES-GCM encryption on 2KB buffers: but it doesn't help on larger buffers (where the encrypt function spent proportionally less of its time in the code path that this patch addresses) : I need to do some more work to get this working with x86_64. |
ce60a6e to
b59f5d7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #204 +/- ##
==========================================
- Coverage 99.78% 99.77% -0.01%
==========================================
Files 216 216
Lines 56500 56525 +25
Branches 230 230
==========================================
+ Hits 56377 56400 +23
- Misses 92 93 +1
- Partials 31 32 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
This is working on x86_64 now, but I can't tell whether it's any faster on that platform. I got inconsistent results that suggest my x86_64 VM test environment may be too noisy for reliable benchmarks: |
da327c2 to
4e54f83
Compare
* Eliminate a copy in the GHASH(length) computation at the end. * In the tag computation, instead of copying the 128-bit GHASH result into a u8 array and doing a bytewise XOR loop, load it into a u128 and do a vector XOR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.