Skip to content

AEAD lifecycle/API: tag after Done, EncodeAuthenticated, CCM via Done - #10

Closed
omonien wants to merge 1 commit into
developmentfrom
cursor/feat-aead-lifecycle-api-2915
Closed

omonien wants to merge 1 commit into
developmentfrom
cursor/feat-aead-lifecycle-api-2915

Conversation

@omonien

@omonien omonien commented Sep 15, 2026

Copy link
Copy Markdown
Owner

Follow-up to #102, split as requested (“Gerne in 2 PR”).

Companion PR: CCM multi-chunk / spec (points 2 and 4).

Please merge this PR against MHumm/DelphiEncryptionCompendium:development as omonien:cursor/feat-aead-lifecycle-api-2915. This listing is on the fork because the agent token cannot open PRs on MHumm.

This PR covers Markus’s lifecycle/API points from MHumm#102:

# Request This PR
1 Accessing CalculatedAuthenticationTag / CalculatedAuthenticationResult before Done must raise a clear exception (hard check, not Assert) TAuthenticatedCipherModesBase getter raises EDECCipherException until Done
3 Rename/unify protected EncodeGCM / EncodeCCM toward EncodeAuthenticated Protected EncodeAuthenticated / DecodeAuthenticated; all call sites updated (including empty-buffer GCM/CCM in DECCipherFormats). Public API unchanged
5 CCM must finish via Done like GCM CBC-MAC still runs in Encode/Decode; tag (T XOR S_0) is materialized in TCCM.Done
6 GetStandardAuthenticationTagBitLengths: no prescribed lengths → empty array, documented in XMLDOC Base implementation already returned []; XMLDOC now states that. Non-authenticated modes on TDECCipherModes still return [0] (existing public contract)

Lifecycle (now shared by GCM and CCM)

Init → set AAD / tag length / expected tag → Encode/Decode* → Done → read tag
  • Reading the tag before Done raises (educates callers).
  • Done is idempotent.
  • Encode/Decode after Done raises until Init.

Tests

  • GCM: TestCalculatedAuthenticationResultBeforeDoneRaises
  • CCM: same, plus TestEncodeAfterDoneRejected, TestDoneIdempotent
  • RFC 3610 CCM vectors now call Done before reading the tag

Out of scope

Open in Web Open in Cursor 

Follow-up to PR MHumm#102 (points 1, 3, 5, 6). Reading CalculatedAuthenticationTag
before Done now raises EDECCipherException. Protected EncodeGCM/EncodeCCM
are unified as EncodeAuthenticated (Decode counterpart too). CCM materializes
the authentication tag in Done so GCM and CCM share one lifecycle. Modes
without prescribed tag lengths document returning an empty array.

Co-authored-by: Olaf Monien <omonien@users.noreply.github.com>
@omonien

omonien commented Sep 15, 2026

Copy link
Copy Markdown
Owner Author

Opened upstream as MHumm#105 — closing this fork listing as duplicate.

@omonien omonien closed this Sep 15, 2026
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.

2 participants