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.
Issue #, if available:
TL;DR
Briefly, XAES-256-GCM is AES-256-GCM but with larger nonce size (20 to 24 bytes) instead of 12 bytes, and it is integrated with a key derivation function, which derives a subkey prior to encryption and decryption to use rather than directly using the main key for encryption/decryption. Therefore, all test cases that apply to AES-256-GCM also apply to XAES-256-GCM, although the output ciphertexts of the two will be different.
XAES-256-GCM
XAES-256-GCM is extended AES-GCM with a derived-key mode proposed by Filippo Valsorda in 2023, followed by a specification released in 2024. Benhamouda et al. provides a formal proof for the security of XAES-256-GCM beyond the birthday bound with$$2^{80}$$ encryptions without key rotation in the unique-key/block model, and Kampanakis et al. introduces an extension to additionally support CMAC-based Key Commitment. The trade-off compared to the standard AES-GCM is a small computation cost incurred by invoking a key derivation function (KDF) for each encryption. Specifically, it requires three AES invocations for key derivation (in which one can be precomputed), and three more for key commitment. XAES-256-GCM uses FIPS-approved algorithms (CMAC-based KDF in NIST SP 800-38B and AES-GCM in NIST SP 800-38D).
XAES-256-GCM is implemented in branch xaes-256-gcm of AWS-LC repo: https://github.com/aws/aws-lc/tree/xaes-256-gcm, for both EVP_CIPHER and EVP_AEAD APIs.
See PR: aws/aws-lc#2750
Description of changes
xaes_256_gcm.cpp, which is copied fromaes_gcm.cppwith a few modifications.XAes256GcmSpi.java, which is copied fromAesGcmSpi.javawith a few modifications for nonce size.XAes256GcmTest.java, which is copied fromAesTest.javawith a few modifications for nonce size, and added two cases for 20-byte and 23-byte nonce size. Different from the originalAesTest.javathat alternates executing AES-GCM cipher in AWS-LC library andjavax.crypto, XAES-256-GCM is only available in AWS-LC library.XAes256GcmKatTest.java, which is copied fromAesCfbTest.java, but added KATs from https://github.com/C2SP/C2SP/blob/main/XAES-256-GCM.md** Testing**
./gradlew singleTest -DSINGLE_TEST=com.amazon.corretto.crypto.provider.test.XAes256GcmTest./gradlew singleTest -DSINGLE_TEST=com.amazon.corretto.crypto.provider.test.XAes256GcmKatTestBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.