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-gcm: Make use of the optimized aarch64 implementation #1935

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

vkrasnov
Copy link
Contributor

Currently ring bundles an interleaved AES-GCM implementation for aarch64, but does not make use of it, instead calling AES-CTR + GHASH in succession.

This change makes use of the bundled implementation, resulting in speedups of 45% for AES-128-GCM and 55% for AES-256-GCM on Apple M1 CPU.

@vkrasnov vkrasnov force-pushed the vlad/gcm branch 2 times, most recently from a2b6569 to 94ddede Compare January 24, 2024 22:39
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (c1e31b8) 96.22% compared to head (5ac1d08) 96.23%.

Files Patch % Lines
src/aead/gcm.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1935      +/-   ##
==========================================
+ Coverage   96.22%   96.23%   +0.01%     
==========================================
  Files         135      135              
  Lines       20550    20632      +82     
  Branches      226      226              
==========================================
+ Hits        19774    19855      +81     
- Misses        742      743       +1     
  Partials       34       34              

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

Copy link
Owner

@briansmith briansmith left a comment

Choose a reason for hiding this comment

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

Thanks. This looks good to me other than removing ARM from the build.rs line noted below.

I will also test this on aarch64-windows to make sure it works there, before merging.

Currently ring bundles an interleaved AES-GCM implementation for aarch64,
but does not make use of it, instead calling AES-CTR + GHASH in succession.

This change makes use of the bundled implementation, resulting in speedups
of 45% for AES-128-GCM 1350B and 55% for AES-128-GCM 8192B on an Apple M1 CPU.
@briansmith
Copy link
Owner

I have now tested this on Windows 11 aarch64-pc-windows-msvc and verified that the implementation is selected and that the tests pass.

@vkrasnov
Copy link
Contributor Author

vkrasnov commented Feb 6, 2024

And how the performance on that platform?

@briansmith
Copy link
Owner

And how the performance on that platform?

I didn't run the benchmarks because I actually ran the test in Parallels on an M1 Mac. The only ARM64 Windows hardware I have is an original Surface Pro X (SQ1) tablet which isn't very relevant.

@briansmith briansmith merged commit 244627f into briansmith:main Feb 16, 2024
131 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.

2 participants