Skip to content

Fix CMAC processing and add test coverage - #1

Merged
GtechGovind merged 1 commit into
masterfrom
agent/test-multiblock-cmac
Aug 8, 2026
Merged

GtechGovind merged 1 commit into
masterfrom
agent/test-multiblock-cmac

Conversation

@GtechGovind

Copy link
Copy Markdown
Owner

What changed

  • process every CMAC block instead of advancing the block index by 16
  • handle the empty-message CMAC case correctly
  • make xorVec safe when its output aliases either input
  • stop printing derived CMAC subkeys
  • add four truncated NIST SP 800-38B vectors covering empty, complete, partial, and multi-block inputs
  • expose the implementation as a CMake library with CTest integration
  • add bounded GitHub Actions CI, a complete README, and an MIT license

Why

The previous loop advanced a block counter by the AES block size, so messages longer than one block were not fully processed. The helper also cleared an aliased output before reading the input, which was undefined behavior and was detected under AddressSanitizer. Empty messages attempted to access a nonexistent final block.

Besides correcting those paths, this removes accidental cryptographic subkey output and gives contributors reproducible tests and build instructions.

Validation

  • c++ -std=c++17 -Wall -Wextra -Wpedantic ... build: pass
  • NIST AES-CMAC vectors, truncated to eight bytes: pass (4/4)
  • AddressSanitizer + UndefinedBehaviorSanitizer: pass
  • example executable build and run: pass
  • workflow YAML parse and git diff --check: pass

CMake is not installed in the local environment, so the equivalent direct compiler commands were used locally. The PR workflow runs the documented CMake/CTest path on Ubuntu.

@GtechGovind
GtechGovind marked this pull request as ready for review August 8, 2026 18:45
@GtechGovind
GtechGovind merged commit 586fdee into master Aug 8, 2026
1 of 2 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.

1 participant