Skip to content

F-19177: Keep WANT_WRITE resume count in SendData until used - #12296

Open
julek-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
julek-wolfssl:f-19177-senddata-resume
Open

julek-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
julek-wolfssl:f-19177-senddata-resume

Conversation

@julek-wolfssl

Copy link
Copy Markdown
Member

When a write blocked with WANT_WRITE, the count of bytes to resume with was applied only if the retry itself flushed the output buffer. The count was lost in two cases: another message flushed the record first, or the retry flushed it and then blocked on a pending alert or the deferred KeyUpdate. The retry then sent the data again.

Changes:

  • Apply the count after those steps, whoever sent the record.
  • For a grouped early data write, flush a counted record instead of building it again.
  • Reset the count in wolfSSL_clear().

The count of a blocked write was only applied when the retry itself
flushed the output buffer. It was lost when another message flushed the
record first, or when the retry flushed it and then blocked on a pending
alert or the deferred KeyUpdate. The retry then sent the data again.

Apply the count after those steps, whoever sent the record. Flush a
counted record of a grouped early data write instead of building it
again. Reset the count in wolfSSL_clear().
Copilot AI balanced review requested due to automatic review settings November 27, 2026 12:39
@julek-wolfssl julek-wolfssl self-assigned this Nov 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified in the nonblocking write-resumption changes.

No open issues 🎉

What changed in this PR

Fixes nonblocking write resumption so application data already sent after WANT_WRITE is not transmitted again.

Changes:

  • Preserve resume counts until buffered output, pending alerts, and deferred KeyUpdate handling complete.
  • Flush previously buffered grouped early data instead of rebuilding it.
  • Clear resume state in wolfSSL_clear() and add regression tests for retries and connection reuse.
File Description
tests/​api/​test_tls13.h Declares and registers the new TLS 1.3 regression tests.
tests/​api/​test_tls13.c Tests deferred KeyUpdate retries and grouped early-data retries.
tests/​api/​test_ssl_rw.h Declares and registers write-retry and clear-state tests.
tests/​api/​test_ssl_rw.c Tests retries after another message flushes output and writes after connection reuse.
src/​ssl.c Resets pending-write counts in wolfSSL_clear().
src/​internal.c Delays resume-count consumption and flushes counted grouped records before retrying.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

zephyr-frdm_rw612

  • FLASH: datas +16 B, log_const_area -8 B, rodata +108 B, text +14,152 B (+5.1%, 296,732 B / 67,108,864 B, total: 0% used)
  • RAM: bss +49 B, datas +16 B (+0.1%, 58,423 B / 983,040 B, total: 6% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

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