Skip to content

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

Merged
MHumm merged 1 commit into
MHumm:developmentfrom
omonien:cursor/feat-aead-lifecycle-api-2915
Sep 16, 2026
Merged

MHumm merged 1 commit into
MHumm:developmentfrom
omonien:cursor/feat-aead-lifecycle-api-2915

Conversation

@omonien

@omonien omonien commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

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

Companion: CCM multi-chunk / spec (open after this merges).

# Request This PR
1 Tag/CalculatedAuthenticationResult before Done must raise (hard check, not Assert) Raises EDECCipherException until Done
3 Unify protected EncodeGCM/EncodeCCMEncodeAuthenticated Protected encode/decode unified; public API unchanged
5 CCM finish via Done like GCM Tag (T XOR S_0) materialized in TCCM.Done
6 No prescribed tag lengths → empty array + XMLDOC Documented; non-auth modes still return [0]

Lifecycle: Init → AAD/tag length → Encode/Decode* → Done → read tag

Tests added for before-Done raises and Done idempotency; RFC 3610 CCM vectors call Done before reading the tag.

Out of scope: ChaCha/Poly1305 (#90); CCM multi-chunk / InitMode 128-bit (companion PR).

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>
@MHumm

MHumm commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Brauchen wir bei den GCM Unit Tests auch einen Idempotenz Test?

@MHumm
MHumm merged commit 5eb0b4b into MHumm:development Sep 16, 2026
@omonien

omonien commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Hallo Markus,

danke fürs Mergen!

Den Idempotenz-Test für GCM gibt es bereits: TestDoneIdempotent in TestDECCipherModesGCM.pas — zweimal Done, CalculatedAuthenticationResult muss gleich bleiben. Dazu noch TestEncodeAfterDoneRejected / TestDecodeAfterDoneRejected und der Before-Done-Raise-Test.

Wenn du etwas anderes meintest (z. B. Idempotenz von Encode-Chunks), sag Bescheid.

Viele Grüße
Olaf

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.

3 participants