generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 24
Add wrappers to AES-GCM functions #180
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
Open
jakemas
wants to merge
11
commits into
awslabs:master
Choose a base branch
from
jakemas:aes-wrappers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
46e9167 to
2637816
Compare
fecba29 to
7e9a731
Compare
pennyannn
approved these changes
Dec 19, 2025
Contributor
pennyannn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.
Add wrappers to AES-GCM functions
For aws/aws-lc#2902
#P342421881
Overview
This PR fixes the AES-GCM verification proofs by updating them to verify wrapper functions (
aes_hw_encrypt_wrapperandaes_hw_ctr32_encrypt_blocks_wrapper) instead of attempting to verify the direct assembly implementations, which were being called through wrappers in the actual code.Root Cause
The AES-GCM implementation in aws-lc calls wrapper functions for AES encryption operations, so that all AES code is located together when passed through the delocator in the FIPS module. However, the SAW verification proofs were attempting to verify against the direct assembly implementations, causing a mismatch between the code being executed and the code being verified.
Solution Approach
The fix uses a two-stage verification strategy:
aes_hw_encryptandaes_hw_ctr32_encrypt_blocks)Changes
Patch Files
SAW/patch/noinline_aes_hw_encrypt_wrapper.patch: Adds__attribute__((noinline))toaes_hw_encrypt_wrapperto prevent inlining during verificationSAW/patch/noinline_aes_hw_ctr32_encrypt_blocks_wrapper.patch: Adds__attribute__((noinline))toaes_hw_ctr32_encrypt_blocks_wrapperto prevent inlining during verificationProof Updates
AES.saw
aes_hw_encrypt_asm_ovby verifying theaes_hw_encryptassembly implementationaes_hw_encrypt_in_place_asm_ovby verifying theaes_hw_encryptassembly with in-place specificationaes_hw_encrypt_wrapperusing the assembly overrideaes_hw_encrypt_wrapperwith in-place specification using the assembly overrideAES-CTR32.saw
aes_hw_ctr32_encrypt_blocksassembly implementation for each possible block count, creatingaes_hw_ctr32_encrypt_blocks_concrete_asm_ovsaes_hw_ctr32_encrypt_blocks_bounded_array_asm_ovby refining the assembly specificationsaes_hw_ctr32_encrypt_blocks_wrapperusing the assembly override to createaes_hw_ctr32_encrypt_blocks_bounded_array_ovAES-GCM.saw
aes_hw_encrypt_wrapperaes_hw_ctr32_encrypt_blocks_wrapperBuild Script
SAW/scripts/x86_64/entrypoint_check_aes_gcm.sh: Added patch applications for both wrapper noinline patchesSubmodule Updates
srcsubmodule to point to a branch with the wrapper function changes.gitmodulesconfigurationTesting
The changes have been tested with the AES-GCM verification suite and all proofs pass successfully.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.