process/wg: do not check if transport data length is divisible by 16 #200
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.
This corrects an implementation flub where I assumed that the length of a WireGuard data packet would always be divisible by 16. That is verifiably false, and the receiving code of WireGuard does not assume that.
Zero-padding the message data to the multiples of 16 relates to memory alignment and is mainly a measure to "complicate traffic analysis". It does not always happen; the most common example is traffic approaching the inner MTU, which is set by default to 1420, but can be set to arbitrary values by the user.
1420 is not divisible by 16, and an IP packet of length 1420 is not padded any further by WireGuard. With additional 32 bytes of WireGuard headers and 32 bytes of UDP, IP and frame headers, the total frame length is 1494, which is, again, not divisible by 16.
So this check needs to go.
It may increase the number of false positives, I am going to do some tests about this.