Fix NTP Authenticator parsing for non-MD5 digest types#4918
Draft
Fix NTP Authenticator parsing for non-MD5 digest types#4918
Conversation
- Add XStrField import - Add _ntp_auth_tail_size() helper for dynamic MAC size detection - Update _NTPAuthenticatorPaddingField to use dynamic tail size - Change NTPAuthenticator.dgst from XStrFixedLenField to XStrField - Update NTPExtPacketListField.getfield() for dynamic tail detection - Add SHA384 (48-byte) to NTPHeader.guess_payload_class() Co-authored-by: guedou <11683796+guedou@users.noreply.github.com>
- Add SHA1 (24-byte) authenticator parsing test with round-trip verification - Add SHA256 (36-byte) authenticator parsing test with round-trip verification - Update existing MD5 authenticator test to reflect correct SHA1 parsing for 24-byte payloads - Update NTPControl test to expect SHA1 parsing for 24-byte authenticator data Co-authored-by: guedou <11683796+guedou@users.noreply.github.com>
…ents - Define named constants for MAC sizes (_NTP_AUTH_MD5_SIZE, _NTP_AUTH_SHA1_SIZE, etc.) - Update _ntp_auth_tail_size() to use constants instead of hardcoded values - Clarify test comments to explain SHA1 vs MD5 parsing interpretation Co-authored-by: guedou <11683796+guedou@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix NTP Authenticator parsing for dynamic digest sizes
Fix NTP Authenticator parsing for non-MD5 digest types
Feb 14, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4918 +/- ##
=======================================
Coverage 80.10% 80.10%
=======================================
Files 370 370
Lines 91727 91739 +12
=======================================
+ Hits 73477 73488 +11
- Misses 18250 18251 +1
🚀 New features to boost your workflow:
|
Member
|
@copilot fix the code health error, please. |
- Remove trailing whitespace on blank lines (W293) - Remove trailing whitespace at end of line (W291) - Add extra blank line before class definition (E302) - Move comment to separate line to fix line length (E501) Co-authored-by: guedou <11683796+guedou@users.noreply.github.com>
Author
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.
Implementation Plan for NTP Authenticator Parsing Fix
Summary
Successfully fixed NTP Authenticator parsing to support multiple digest types (MD5, SHA1, SHA256, SHA384, SHA512) instead of being hardcoded to MD5's 16-byte digest size.
Changes:
_ntp_auth_tail_size()helperNTPAuthenticator.dgstfrom fixed-length to variable-length fieldTest Results:
Security Summary:
No security vulnerabilities detected by CodeQL analysis.
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.