Tighten MAC guards, boolean decode and KEX guess - #1284
Open
ejohnstown wants to merge 3 commits into
Open
ejohnstown wants to merge 3 commits into
ejohnstown wants to merge 3 commits into
Conversation
Wrap the ID_HMAC_SHA2_256 case in CreateMac() and each HMAC case in VerifyMac() in its WOLFSSH_NO_HMAC_* gate, so a build without a MAC drops that case in both directions. Issue: F-12545
GetBoolean() stores any nonzero wire byte as 1, per RFC 4251 section 5, so callers and callbacks such as hasSignature see only 0 or 1. - tests: add test_GetBoolean covering 0, 1 and other nonzero bytes Issue: F-12573
Every supported KEX method opens with a client message, so only the client can send a guessed packet (RFC 4253 section 7.1). DoKexInit() sets ignoreNextKexMsg only on the server and logs a server's flag on the client; DoKexDhReply() and DoKexDhGexGroup() no longer skip. - tests: client KEXINIT with a wrong-guess follows flag does not skip - tests: client KEXDH_REPLY and GEX_GROUP parse even with the flag set - tests: the skip case helper drives only the server Issue: F-10585
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The changes are internally consistent, appropriately guarded, and covered by focused tests.
Review effort: Balanced
Findings: None
What changed in this PR
Tightens SSH transport parsing and algorithm handling for standards compliance and selective builds.
Changes:
- Normalizes decoded SSH booleans.
- Limits guessed-KEX packet skipping to servers.
- Adds per-algorithm HMAC guards and regression tests.
| File | Description |
|---|---|
src/internal.c |
Updates boolean, KEX, and MAC handling. |
tests/unit.c |
Tests boolean normalization and bounds. |
tests/regress.c |
Tests endpoint-specific KEX guess behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Three small fixes in the transport and KEX code.