[Git][NTPsec/ntpsec][master] ntp.packet: Shim mode6 alignment to 4 & use it.

Hal Murray (@hal.murray) gitlab at mg.gitlab.com
Sun Dec 10 00:26:24 UTC 2023



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
a7accd96 by James Browning at 2023-12-09T07:29:23-08:00
ntp.packet: Shim mode6 alignment to 4 & use it.

- - - - -


1 changed file:

- pylib/packet.py


Changes:

=====================================
pylib/packet.py
=====================================
@@ -257,7 +257,7 @@ MAX_KEYID = 0xFFFF
 MODE_SIX_HEADER_LENGTH = 12
 MINIMUM_MAC_LENGTH = 16
 KEYID_LENGTH = 4
-MODE_SIX_ALIGNMENT = 8
+MODE_SIX_ALIGNMENT = 4
 MAX_BARE_MAC_LENGTH = 20
 
 
@@ -936,7 +936,7 @@ class ControlSession:
         # Pad out packet to a multiple of 8 octets to be sure
         # receiver can handle it. Note: these pad bytes should
         # *not* be counted in the header count field.
-        while ((ControlPacket.HEADER_LEN + len(pkt.extension)) & 7):
+        while ((ControlPacket.HEADER_LEN + len(pkt.extension)) & (MODE_SIX_ALIGNMENT - 1)):
             pkt.extension += b"\x00"
 
         # Do the MAC compuation.



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/a7accd9627e746a994cdad48949437c71d9c77a5

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/a7accd9627e746a994cdad48949437c71d9c77a5
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20231210/0eb0d44a/attachment-0001.htm>


More information about the vc mailing list