Development discussion of WireGuard
 help / color / mirror / Atom feed
From: John Huttley <john@mib-infotech.co.nz>
To: wireguard@lists.zx2c4.com
Subject: Re: Odd length headers and alignment
Date: Thu, 8 Dec 2016 07:17:59 +1300	[thread overview]
Message-ID: <e1f43ccf-85eb-8ad5-9bde-8332218fe3f8@mib-infotech.co.nz> (raw)
In-Reply-To: <CAHmME9q_HCBTx9K47LQxQcS8qCSfecudG=haMeuBAzJDvoOOEg@mail.gmail.com>

I think an extra byte would be a great idea.
We can use that in the future to implement a user space
IUnknown/O_PONIES  end to end negotiation

--John



On 8/12/2016 7:11 a.m., Jason A. Donenfeld wrote:
> Hey guys,
> 
> Wireguard data packets have a 1 byte type, a 4 byte index, an 8 byte
> nonce, the ciphertext, and then a 16 byte auth tag. Having 13 bytes in
> the beginning means that when we do in-place decryption, the plaintext
> winds up starting at an odd-byte, transferring misalignment down to
> the rest of the stack.
> 
> Now, in my testing on alignment-sensitive MIPS boxes, I've only had
> alignment exceptions with this regarding the first byte, which is the
> version number of the IP header. Since this is just a single byte, the
> alignment doesn't actually matter. But in practice, the compiler
> generates a 16-bit load instead of an 8-bit load, which sucks. I may
> be able to work around this though. Beyond that, I haven't actually
> observed exceptions from elsewhere in the stack regarding
> misalignment.
> 
> So, how much of a problem do you suppose this is? Would it be
> worthwhile to stick an _extra byte_ in the header, just to get even
> alignment? Or an extra three bytes to get 16-byte alignment? Or do you
> suppose this isn't really worth the bloat and MTU loss?
> 
> Just something to think about...
> 
> Jason
> _______________________________________________
> WireGuard mailing list
> WireGuard@lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/wireguard
> 

  reply	other threads:[~2016-12-07 18:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07 18:11 Jason A. Donenfeld
2016-12-07 18:17 ` John Huttley [this message]
2016-12-07 18:28   ` Dave Taht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1f43ccf-85eb-8ad5-9bde-8332218fe3f8@mib-infotech.co.nz \
    --to=john@mib-infotech.co.nz \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).