Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Wei Chen <weichen302@zoho.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: wireguard@lists.zx2c4.com
Subject: Re: Iptables WireGuard obfuscation extension
Date: Sun, 2 Oct 2022 18:35:35 -0500	[thread overview]
Message-ID: <YzogR3aHYMVscIO7@tungsten> (raw)
In-Reply-To: <YzR3vcZhSjU2eRqB@zx2c4.com>

Hi Jason,

Thank you for the suggestions!

> - Instead of using siphash, if you can make use of 64 bytes of
>   randomness at a time, you might be able to get away with chacha8 (or
>   even lower). The input to chacha20 is typically a 256 bit key and a
>   nonce, but because we don't care about the cryptographic security here
>   -- wireguard handles that part -- we can play fast and lose, and make
>   our threat model, "would be too computationally complex to detect in
>   real time". Things become quite fun when you don't need real crypto.
>   To that end, we could perhaps get away with using chacha8 instead of
>   chacha20, and doing so with a 128-bit key. This then provides lots of
>   input to chacha:
> 

It does need more than 16 bytes. Currently it gets away with it by
borrowing one byte from where supposed to XOR with reserved field. If
the all zeros reserved field changes as WG protocol evolving, then this
siphash128 approach will stop working.

> - get_random_bytes() is slow if all you need is a byte at a time. That
>   computes 96 bytes and then throws away 88 bytes of it. Instead, you
>   can use get_random_u32(), which batches, and throw away 3 bytes. Or, I
>   think I'll add to kernel 6.1 get_random_u8(), which will waste
>   nothing.
> 
>   But actually, do you really need to do that? Can't you just run chacha
>   or siphash or whatever super fast non-cryptographic thing you have,
>   and just have an incrementing nonce? Or, better, since those keepalive
>   messages already have a suitably random poly1305 tag, just run siphash
>   on that, and discard if the resultant first byte is high/low/whatever.
> 

I have a feeling get_random_bytes() might not fast, but have no idea I
have wasted so many bytes. Thank you! I will try get_random_u32() first.

> - If this is to ever go upstream, you might want to add a `--obfs-type
>   N` parameter to the XT userspace library and the IPC struct, and make
>   it mandatory. To begin, everybody would use `--obfs-type 1`, since
> 

Added to todo list.


Wei

      parent reply	other threads:[~2022-10-02 23:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-10 11:34 Wei Chen
2022-09-28 11:33 ` Roman Mamedov
2022-10-02 23:13   ` Wei Chen
2022-09-28 16:35 ` Jason A. Donenfeld
2022-09-28 18:17   ` Jean-Philippe Aumasson
2022-10-02 23:35   ` Wei Chen [this message]

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=YzogR3aHYMVscIO7@tungsten \
    --to=weichen302@zoho.com \
    --cc=Jason@zx2c4.com \
    --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).