Repository navigation
write-dup: copy the PHA transcript to the read side from FINISHED_DONE - #12027
yosuke-wolfssl wants to merge 1 commit into
Conversation
- wolfSSL_connect_TLSv13() copies the write side's transcript into postHandshakeSyncedHashState in FINISHED_DONE when the new postHandshakeAuthPublish bit is set, via Tls13WriteDupPublishPhaHashes(). - wolfssl_write_dup_do_tls13_work() sets postHandshakeAuthPublish when it starts a PHA response, and no longer copies the transcript itself. - test_write_dup and test_write_dup_want_write run a second PHA round. - New test_write_dup_negotiate_pha calls wolfSSL_negotiate() on the write side before and after a PHA round.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the TLS 1.3 post-handshake authentication transcript synchronization change.
No open issues 🎉
What changed in this PR
This PR fixes transcript synchronization for TLS 1.3 post-handshake authentication with wolfSSL_write_dup() when a response completes across multiple calls, preventing later authentication rounds from using a stale transcript.
Changes:
- Moves transcript publication to
FINISHED_DONE, guarded by a flag set when a post-handshake authentication response starts. - Adds second-round regression coverage and verifies that unrelated
wolfSSL_negotiate()calls do not publish a transcript.
| File | Description |
|---|---|
wolfssl/internal.h |
Adds the pending transcript-publication flag. |
tests/api.c |
Extends repeated-authentication tests and adds negotiation isolation coverage. |
src/tls13.c |
Publishes the transcript at handshake completion, including resumed responses. |
src/ssl_api_rw.c |
Sets the publication flag and removes the single-call publication path. |
Review effort: Balanced
|
|
@claude review |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12027
Scan targets checked: wolfssl-src, wolfssl-bugs
Coverage: 4 of 4 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max
Problem
With
wolfSSL_write_dup(), the write side answers a TLS 1.3 post-handshake CertificateRequest and then copies its transcript to the read side. The read side hashes the next CertificateRequest onto that copy.The copy was made in
wolfssl_write_dup_do_tls13_work()only whenwolfSSL_connect_TLSv13()sent the whole response in one call. If the response hitWANT_WRITEorWC_PENDING_Eand finished on a laterwolfSSL_write(), no copy was made. The next PHA round was then hashed onto the old transcript, so the client's CertificateVerify/Finished did not match the server's, and every later PHA round on the connection failed.Fix (
src/tls13.c)postHandshakeAuthPublishis set bywolfssl_write_dup_do_tls13_work()when it starts a PHA response.Tls13WriteDupPublishPhaHashes()copies the transcript intodupWrite->postHandshakeSyncedHashStateinwolfSSL_connect_TLSv13()'sFINISHED_DONEstate while that bit is set.Tests
test_write_dupandtest_write_dup_want_writerun a second PHA round. Thewant_writecase covers a first response that blocked.test_write_dup_negotiate_phacallswolfSSL_negotiate()on the write side before and after a PHA round and checks that no copy is made.Verification
--enable-all --enable-writedup --enable-asynccrypt --enable-asynccrypt-sw: builds clean, and all three tests pass over TLS 1.3 and DTLS 1.3.test_write_dup_want_writefails on its second PHA round. The other two tests still pass there, so the second round oftest_write_dup_want_writeis the one that catches this bug.