Send close_notify after user_canceled even under quiet shutdown - #11264
Send close_notify after user_canceled even under quiet shutdown#11264night1rider wants to merge 2 commits into
Conversation
Clear quiet shutdown across the shutdown call in wolfSSL_SendUserCanceled so the RFC 9846 paired close_notify is emitted, and cover it in test_wolfSSL_SendUserCanceled.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11264
Scan targets checked: wolfssl-bugs, wolfssl-src
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
|
Can one of the admins verify this patch? |
Guard the quiet-shutdown setter against a NULL ssl_s and assert quietShutdown is restored after SendUserCanceled, per PR wolfSSL#11264 review.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11264
Scan targets checked: wolfssl-bugs, wolfssl-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
| int quietShutdown = ssl->options.quietShutdown; | ||
| ssl->options.quietShutdown = 0; | ||
| ret = wolfSSL_shutdown(ssl); | ||
| ssl->options.quietShutdown = quietShutdown; |
There was a problem hiding this comment.
Restored quiet shutdown blocks the retry that flushes a buffered close_notify · Logic errors
When wolfSSL_shutdown leaves the close_notify in the output buffer (SendAlert returns WANT_WRITE, ssl_api_rw.c:921), restoring quietShutdown makes the caller's retry short-circuit at ssl_api_rw.c:1041 and never reach wolfssl_shutdown_flush_alert, so the alert is never sent yet shutdown reports success. Adjacent to known finding #10650, on the retry path.
Related known finding #10650 (similar but distinct): Both involve wolfSSL_SendUserCanceled and quietShutdown preventing the required close_notify, but #10650 is the initial shutdown short-circuit before any send attempt. This finding concerns a later WANT_WRITE retry after close_notify was buffered and quietShutdown was restored; it requires preserving the override through alert flushing, a distinct operation and patch.
Fix: Skip the restore while the alert is still unflushed (e.g. when ssl->error == WANT_WRITE), restoring it once the shutdown reaches a decision.
|
Clear quiet shutdown across the shutdown call in wolfSSL_SendUserCanceled so the RFC 9846 paired close_notify is emitted, and cover it in test_wolfSSL_SendUserCanceled.