rekey: trigger highwater on per-key packet count#963
Open
ejohnstown wants to merge 1 commit intowolfSSL:masterfrom
Open
rekey: trigger highwater on per-key packet count#963ejohnstown wants to merge 1 commit intowolfSSL:masterfrom
ejohnstown wants to merge 1 commit intowolfSSL:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds per-key-epoch packet counters and a configurable packet-count “highwater” threshold to trigger the existing highwater callback (typically causing a rekey), aligning with RFC 4344 guidance on limiting packets per key.
Changes:
- Track
txMsgCount/rxMsgCountper key epoch and reset them onNEWKEYS. - Extend
HighwaterCheck()to also fire the highwater callback when the per-key packet count reachesmsgHighwaterMark(default2^31). - Add public APIs to set/get the message highwater mark:
wolfSSH_CTX_SetMsgHighwater(),wolfSSH_SetMsgHighwater(),wolfSSH_GetMsgHighwater().
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| wolfssh/ssh.h | Adds public API declarations for configuring per-key packet-count highwater marks. |
| wolfssh/internal.h | Adds msg-highwater defaults and new per-key packet counters/flags to internal structs. |
| src/ssh.c | Implements the new msg-highwater set/get APIs. |
| src/internal.c | Integrates msg-count checks into HighwaterCheck() and resets/increments msg counters across key epochs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Track txMsgCount/rxMsgCount per key epoch and reset on NEW_KEYS; seq/peerSeq still wrap freely per RFC 4253 Sec 6.4. - Extend HighwaterCheck to fire highwaterCb when packet count crosses msgHighwaterMark (default 2^31, RFC 4344 Sec 3.1). - Add wolfSSH_CTX_SetMsgHighwater / SetMsgHighwater / GetMsgHighwater. Issue: F-246
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.
Issue: F-246