-
Notifications
You must be signed in to change notification settings - Fork 970
tls.c: send missing_extension alert on TLS 1.3 SNI absence #10332
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 |
|---|---|---|
|
|
@@ -2595,7 +2595,10 @@ static int TLSX_SNI_VerifyParse(WOLFSSL* ssl, byte isRequest) | |
| continue; | ||
| } | ||
|
|
||
| SendAlert(ssl, alert_fatal, handshake_failure); | ||
| SendAlert(ssl, alert_fatal, | ||
| IsAtLeastTLSv1_3(ssl->version) | ||
| ? missing_extension | ||
| : handshake_failure); | ||
| WOLFSSL_ERROR_VERBOSE(SNI_ABSENT_ERROR); | ||
| return SNI_ABSENT_ERROR; | ||
| } | ||
|
|
@@ -2606,7 +2609,10 @@ static int TLSX_SNI_VerifyParse(WOLFSSL* ssl, byte isRequest) | |
| if (ssl_sni->status != WOLFSSL_SNI_NO_MATCH) | ||
| continue; | ||
|
|
||
| SendAlert(ssl, alert_fatal, handshake_failure); | ||
| SendAlert(ssl, alert_fatal, | ||
| IsAtLeastTLSv1_3(ssl->version) | ||
| ? missing_extension | ||
| : handshake_failure); | ||
|
Comment on lines
+2612
to
+2615
|
||
| WOLFSSL_ERROR_VERBOSE(SNI_ABSENT_ERROR); | ||
| return SNI_ABSENT_ERROR; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TLS-version-dependent alert selection logic is duplicated across both error branches. To reduce repetition and keep future protocol tweaks consistent, consider computing the chosen alert once (e.g., a local
int alert = ...) and reusing it in both places, or extracting a small helper for 'SNI required' alert selection.