Add AES-ECB/CTR/OFB/CCM/CMAC/GMAC#129
Merged
rlm2002 merged 14 commits intowolfSSL:masterfrom Jul 23, 2025
Merged
Conversation
24286d5 to
09ee61c
Compare
There was a problem hiding this comment.
Pull Request Overview
Adds support for new AES modes and MAC algorithms (ECB, CTR, OFB, CCM, CMAC, GMAC) to both the JNI and JCE layers, along with comprehensive JUnit coverage.
- Updates the test suite to register and run new AES mode tests.
- Refines parameter‐checking in
AesTestto throwWolfCryptExceptioninstead ofNullPointerException. - Introduces new test classes for AES‐OFB, ECB, CTR, CCM, CMAC, and GMAC modes, and extends the JCE MAC tests to cover
AESCMACandAESGMAC.
Reviewed Changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/wolfssl/wolfcrypt/test/WolfCryptTestSuite.java | Registers the new AES mode test classes in the test suite. |
| src/test/java/com/wolfssl/wolfcrypt/test/AesTest.java | Changes catch blocks to expect WolfCryptException. |
| src/test/java/com/wolfssl/wolfcrypt/test/AesOfbTest.java | New tests for AES-OFB mode. |
| src/test/java/com/wolfssl/wolfcrypt/test/AesGmacTest.java | New tests for AES-GMAC algorithm. |
| src/test/java/com/wolfssl/wolfcrypt/test/AesEcbTest.java | New tests for AES-ECB mode. |
| src/test/java/com/wolfssl/wolfcrypt/test/AesCtrTest.java | New tests for AES-CTR mode. |
| src/test/java/com/wolfssl/wolfcrypt/test/AesCmacTest.java | New tests for AES-CMAC algorithm. |
| src/test/java/com/wolfssl/wolfcrypt/test/AesCcmTest.java | New tests for AES-CCM mode. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptMacTest.java | Extends JCE MAC tests to include AESCMAC and AESGMAC. |
Comments suppressed due to low confidence (2)
src/test/java/com/wolfssl/wolfcrypt/test/AesCcmTest.java:51
- [nitpick] Variable names like k3, k2, k1 are ambiguous—consider renaming to key128, key192, key256 (and similarly for iv and data arrays) to improve readability.
byte[] k3 = new byte[] {
src/test/java/com/wolfssl/provider/jce/test/WolfCryptMacTest.java:70
- [nitpick] The JCE tests register only the "AESGMAC" name; if the provider also supports the alias "AES-GMAC", consider adding it to enabledAlgos so consumers can use either form.
"AESGMAC"
…new JNI method declarations
rlm2002
approved these changes
Jul 23, 2025
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.
This PR adds new AES support to both JNI and JCE layers, including:
AES/ECB/NoPaddingandAES/ECB/PKCS5Paddingcipher supportAES/CTR/NoPaddingcipher supportAES/OFB/NoPaddingcipher supportAES/CCM/NoPaddingcipher supportAESCMACMAC algorithm support (also aliased toAES-CMAC)AESGMACMAC algorithm support (also aliased toAES-GMAC)New JNI-level classes have been added to support these. New JUnit tests have been added to test all new algorithms and modes.