Commit 74a8154
Fix ChaCha20-Poly1305 Final() to allow empty plaintext and AAD
wc_ChaCha20Poly1305_Final() rejected CHACHA20_POLY1305_STATE_READY
with BAD_STATE_E, which occurs when neither UpdateAad nor UpdateData
has been called (both AAD and plaintext are empty). RFC 8439 Section
2.8 permits this and produces a well-defined authentication tag.
Add CHACHA20_POLY1305_STATE_READY to the allowed states in Final().
When state is READY, aadLen and dataLen are both 0, so the existing
Poly1305_Pad, Poly1305_EncodeSizes, and Poly1305Final calls produce
the correct tag.
Fixes: #10040
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 922d04b commit 74a8154
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
| |||
0 commit comments