-
Notifications
You must be signed in to change notification settings - Fork 162
AES-GCM: Add function pointer trampolines to avoid delocator issue #2919
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2919 +/- ##
==========================================
- Coverage 78.22% 78.21% -0.01%
==========================================
Files 690 690
Lines 118745 118750 +5
Branches 16680 16679 -1
==========================================
- Hits 92890 92885 -5
- Misses 24968 24976 +8
- Partials 887 889 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Can we collect benchmarks on c6i, c7i, c6g, c7g and r8g for GCM init and encrypt/decrypt. Just to make sure the trampoline is not noticeable? |
|
Ok benchmarked c6i, c7i, c6g, c7g and r8g on |
Delocate AES, GCM, and cipher wrapper functions
On AArch64, the delocator can patch up the computation of function pointers only if the pointers can be computed with a PC-relative offset in the range (-1MB, 1MB).
For the function pointer computations in
crypto/fipsmodule/aes/mode_wrappers.c,crypto/fipsmodule/cipher/e_aes.c, andcrypto/fipsmodule/modes/gcm.c, this bounds condition is about to be violated by further code additions to AWS-LC, as witnessed in AES-unrelated PRs.This commit preventatively fixes the issue by adding function pointer trampolines to these files: These are stub functions immediately branching into the desired assembly routines, but close enough to the C code computing their address to ensure that their addresses will be computable using a PC-relative offset.
This fix is similar to previous delocator fixes addressing the same AArch64 PC-relative offset limitation, see #2165, #2294 for examples.
AWS-LC-Verification
As there are SAW proofs for AES GCM, these changes affect the proofs (formal-verification / fv-saw-x86_64-aes-gcm (pull_request)) and require changes in aws-lc-verification to continue proof support -- this has been added in awslabs/aws-lc-verification#180.
Testing:
Stability of the fix was tested in #2903 which added ~10,000 lines of additional AVX2 backend.
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.