Fix TLS1.2 error code correction#10764
Draft
embhorn wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates TLS 1.3 client ServerHello parsing so that a syntactically valid TLS 1.2 ServerHello lacking extensions (i.e., no supported_versions) is treated as a version negotiation failure (mapping to protocol_version) rather than a decode error, aligning behavior with RFC 8446 §6.2 and the linked issue (#10761).
Changes:
- In
DoTls13ServerHello, returnVERSION_ERROR(instead ofBUFFER_ERROR) when the ServerHello ends immediately after the compression method (no extensions field at all) and downgrade is disabled. - Preserve
BUFFER_ERRORbehavior for genuinely malformed messages where the extensions length field is truncated (partial). - Add API tests that assert the resulting fatal alert is
protocol_versionfor the no-extensions case anddecode_errorfor the truncated-length case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/api.c | Adds manual-memio tests to validate alert mapping for “no extensions” vs “truncated extensions length” ServerHello inputs. |
| src/tls13.c | Refines the no-extensions/no-downgrade branch to distinguish “absent extensions field” (version mismatch) from “truncated length” (decode error). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10764
Scan targets checked: wolfssl-bugs, wolfssl-src
No new issues found in the changed files. ✅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In
DoTls13ServerHello, the no-extensions / no-downgrade branch now returnsVERSION_ERRORinstead ofBUFFER_ERROR. The caller's existingTranslateErrorToAlert()maps that toprotocol_version.Fixes #10761
Testing
Added tests
test_tls13_no_ext_sh_alerttest_tls13_trunc_ext_sh_alertChecklist