Skip to content

Add AES-ECB/CTR/OFB/CCM/CMAC/GMAC#129

Merged
rlm2002 merged 14 commits intowolfSSL:masterfrom
cconlon:aesModes
Jul 23, 2025
Merged

Add AES-ECB/CTR/OFB/CCM/CMAC/GMAC#129
rlm2002 merged 14 commits intowolfSSL:masterfrom
cconlon:aesModes

Conversation

@cconlon
Copy link
Member

@cconlon cconlon commented Jul 14, 2025

This PR adds new AES support to both JNI and JCE layers, including:

  • AES/ECB/NoPadding and AES/ECB/PKCS5Padding cipher support
  • AES/CTR/NoPadding cipher support
  • AES/OFB/NoPadding cipher support
  • AES/CCM/NoPadding cipher support
  • AESCMAC MAC algorithm support (also aliased to AES-CMAC)
  • AESGMAC MAC algorithm support (also aliased to AES-GMAC)

New JNI-level classes have been added to support these. New JUnit tests have been added to test all new algorithms and modes.

@cconlon cconlon self-assigned this Jul 14, 2025
@cconlon cconlon requested a review from Copilot July 14, 2025 23:11

This comment was marked as outdated.

@cconlon cconlon force-pushed the aesModes branch 4 times, most recently from 24286d5 to 09ee61c Compare July 15, 2025 21:11
@cconlon cconlon requested a review from Copilot July 15, 2025 21:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 AesTest to throw WolfCryptException instead of NullPointerException.
  • Introduces new test classes for AES‐OFB, ECB, CTR, CCM, CMAC, and GMAC modes, and extends the JCE MAC tests to cover AESCMAC and AESGMAC.

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"

@cconlon cconlon self-assigned this Jul 17, 2025
@rlm2002 rlm2002 merged commit 6229858 into wolfSSL:master Jul 23, 2025
117 of 119 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.

5 participants