-
Notifications
You must be signed in to change notification settings - Fork 1k
Ensure close_notify is sent after user_canceled during quiet shutdown #11225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -808,6 +808,10 @@ int wolfSSL_SendUserCanceled(WOLFSSL* ssl) | |
|
|
||
| if (ssl != NULL) { | ||
| ssl->error = SendAlert(ssl, alert_warning, user_canceled); | ||
| if ((ssl->error == 0) || | ||
| (ssl->error == WC_NO_ERR_TRACE(WANT_WRITE))) { | ||
| ssl->options.sentUserCanceled = 1; | ||
| } | ||
| if (ssl->error < 0) { | ||
| WOLFSSL_ERROR(ssl->error); | ||
| } | ||
|
|
@@ -1030,10 +1034,20 @@ int wolfSSL_shutdown(WOLFSSL* ssl) | |
| if (ssl == NULL) { | ||
| ret = WOLFSSL_FATAL_ERROR; | ||
| } | ||
| else if (ssl->options.quietShutdown) { | ||
| else if (ssl->options.quietShutdown && (!ssl->options.sentUserCanceled)) { | ||
| WOLFSSL_MSG("quiet shutdown, no close notify sent"); | ||
| ret = WOLFSSL_SUCCESS; | ||
| } | ||
| else if (ssl->options.quietShutdown) { | ||
| /* A "user_canceled" alert has gone out so we need a "close_notify" to | ||
| * follow it per RFC 9846 Section 6.1. */ | ||
| if (!wolfssl_shutdown_flush_alert(ssl, &ret)) { | ||
| (void)wolfssl_shutdown_send_close_notify(ssl, &ret); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quiet-shutdown user_canceled path returns WOLFSSL_FATAL_ERROR with no error code set · TLS protocol issues In the new Related known finding #10650 (similar but distinct): Both are in wolfSSL_shutdown's quiet-shutdown handling, but #10650 concerns omission of a required close_notify; this finding concerns the new user_canceled no-op path retaining an initial fatal return without setting ssl->error. The faulting operations, root causes, and required patches differ. Fix: Handle the no-op case explicitly: return WOLFSSL_SUCCESS when close_notify was already sent, and set |
||
| } | ||
| if (ret == WC_NO_ERR_TRACE(WOLFSSL_SHUTDOWN_NOT_DONE)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quiet-shutdown user_canceled branch returns WOLFSSL_FATAL_ERROR with no error recorded · Incorrect error handling When Related known finding #10650 (similar but distinct): Both affect wolfSSL_shutdown's quiet-shutdown path and close-notify handling, but #10650 faults by suppressing a required TLS 1.3 close_notify while this finding returns an unrecorded fatal error after the send helper takes no action. The root causes and required patches differ. Fix: Decide |
||
| ret = WOLFSSL_SUCCESS; | ||
| } | ||
| } | ||
| else { | ||
| int done; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.