Fix NTP Authenticator parsing for non-MD5 digests (SHA1, SHA256, SHA512)#4917
Closed
Fix NTP Authenticator parsing for non-MD5 digests (SHA1, SHA256, SHA512)#4917
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4917 +/- ##
=======================================
Coverage 80.10% 80.10%
=======================================
Files 370 370
Lines 91727 91727
=======================================
Hits 73477 73477
Misses 18250 18250 🚀 New features to boost your workflow:
|
Copilot
AI
changed the title
[WIP] Check if oldest issues are still present in current master
Fix NTP Authenticator parsing for non-MD5 digests (SHA1, SHA256, SHA512)
Feb 14, 2026
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
11 tasks
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.
NTP Authenticator fields were hardcoded to MD5's 16-byte digest size, causing misaligned parsing for SHA1/SHA256/SHA384/SHA512 MACs. The
_NTPAuthenticatorPaddingFieldalways assumed a 20-byte tail (4 key_id + 16 MD5 digest), so for e.g. SHA1 (24 bytes total), the first 4 bytes of digest were consumed as padding, key_id read digest bytes, and dgst was truncated._NTPAuthenticatorPaddingField: Computes tail size dynamically by matching against known valid MAC sizes (20/24/36/52/68) instead of hardcoding_NTP_AUTH_MD5_TAIL_SIZENTPAuthenticator.dgst: Changed fromXStrFixedLenFieldwith fixed 16-byte length toXStrFieldto consume all remaining bytes afterkey_idNTPExtPacketListField.getfield(): Same dynamic tail size detection when splitting extensions from MACNTPHeader.guess_payload_class(): Added SHA384 (48-byte) digest to the recognized sizesNTPExtensions:_NTPAuthenticatorPaddingFieldalso updated to use dynamic sizing via a new_ntp_auth_tail_size()helperAdded tests for SHA1 (24-byte) and SHA256 (36-byte) NTP authenticator dissection and round-trip build/parse.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.