Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the Ascon AEAD128 API by rejecting repeated calls to wc_AsconAEAD128_SetAD(), aligning its state-machine behavior with wc_AsconAEAD128_SetKey() and wc_AsconAEAD128_SetNonce() to prevent producing non-conformant authentication tags without error.
Changes:
- Add an
adSetone-shot guard towc_AsconAEAD128_SetAD()returningBAD_STATE_Eon repeat calls. - Update API tests to assert a repeated
SetADcall is rejected. - Update Doxygen documentation and add a ChangeLog entry describing the behavior change/fix.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| wolfcrypt/src/ascon.c | Adds a state guard to reject repeated associated-data absorption. |
| tests/api/test_ascon.c | Extends decision-coverage tests to verify the new BAD_STATE_E behavior on repeat SetAD. |
| doc/dox_comments/header_files/ascon.h | Documents the new BAD_STATE_E return case for repeated SetAD. |
| ChangeLog.md | Records the fix and its impact for release notes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11314
Scan targets checked: wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
|
Can one of the admins verify this patch? |
|
retest this please |
|
@miyazakh please fix merge conflicts |
7c0a463 to
1a442e4
Compare
|
retest this please |
philljj
left a comment
There was a problem hiding this comment.
This looks and tests fine, but the changelog.md has a merge conflict.
1a442e4 to
4046cfe
Compare
Summary(f7399)
wc_AsconAEAD128_SetKey()andwc_AsconAEAD128_SetNonce()reject a second call withBAD_STATE_E, butwc_AsconAEAD128_SetAD()did not.SetADis not a plain field setter: it runs the key/nonce absorption permutation, XORs the key into the state, absorbs the AD blocks, and applies domain separation. Calling it twice re-runs that sequence on the already-advanced state, and both calls return0. A caller that split associated data across two buffers would get a tag that authenticates under no conforming Ascon implementation, with no error reported anywhere.Associated data must be supplied in a single call. This adds the missing
if (a->adSet) return BAD_STATE_E;guard, matching the two sibling functions.Changes
wolfcrypt/src/ascon.c: returnBAD_STATE_Efromwc_AsconAEAD128_SetAD()when the associated data has already been set.doc/dox_comments/header_files/ascon.h: document the new return case.tests/api/test_ascon.c: assert the repeat call is rejected.ChangeLog.md: add entry under Fixes.Testing
./configure --enable-ascon --enable-experimental && make./wolfcrypt/test/testwolfcrypt— ASCON AEAD test passes./tests/unit.testascon group (tests 377-381) — all passChecklist