From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Baptiste Jonglez <baptiste@bitsofnetworks.org>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Introduction of XChaCha20Poly1305 (Was: [ANNOUNCE] Snapshot `0.0.20161223` Available)
Date: Sun, 25 Dec 2016 23:55:46 +0100 [thread overview]
Message-ID: <CAHmME9rpN9vRT7gv7tiGkBHB0DwKjSxz_N_y+YDYzU66xU87rQ@mail.gmail.com> (raw)
In-Reply-To: <20161225224225.GA5081@lud.home>
On Sun, Dec 25, 2016 at 11:42 PM, Baptiste Jonglez
<baptiste@bitsofnetworks.org> wrote:
> - Is this backwards compatible?
No, but I'm 99% sure you've never hit the code path for which this is
actually used.
> - Could you provide references describing XChaCha20Poly1305 and the
> differences with ChaCha20Poly1305?
Mentioned in the references of
https://www.wireguard.io/papers/wireguard.pdf, it's got a security
proof:
https://cr.yp.to/snuffle/xsalsa-20110204.pdf
The basic issue is that with chapoly's aead construction, you never
want to reuse the same key with the same nonce. Before, I used to do
this:
salt = random(32bytes)
derived_key = blake2s(key=real_key, salt)
chacha20poly1305(key=derived_key, nonce=0, payload)
This works fine and is secure, since blake2 is a PRF, but it's not as
optimal as it could be. The new construction is instead:
nonce = random(24bytes)
xchacha20poly1305(key=real_key, nonce=nonce, payload)
Which is a lot more similar. Under the hood, xchacha20poly1305 expands
to basically the same thing:
derived_key = hchacha20(key=key, nonce=nonce[0:16])
chacha20poly1305(key=derived_key, nonce=none[16:24], payload)
Where in this case, hchacha20 is basically:
key_material = chacha20(key=key, nonce=nonce[0:16)
return key_material[0:16] + key_material[48:64]
In other words, we trade a computation of blake2s for a single
chacha20 core function.
The advantage is not only speed and simplicity, but also the existence
of the xchacha20pol1305 aead in libraries:
https://github.com/jedisct1/libsodium/blob/master/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c
> - What part of the protocol does this change? Is it just the initial key
> exchange?
It's for cookie encryption, part 5.4.7 of the paper.
prev parent reply other threads:[~2016-12-25 22:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-23 20:15 [ANNOUNCE] Snapshot `0.0.20161223` Available Jason A. Donenfeld
2016-12-23 20:19 ` Dave Taht
2016-12-23 20:22 ` Jason A. Donenfeld
2016-12-25 22:42 ` Introduction of XChaCha20Poly1305 (Was: [ANNOUNCE] Snapshot `0.0.20161223` Available) Baptiste Jonglez
2016-12-25 22:55 ` Jason A. Donenfeld [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=CAHmME9rpN9vRT7gv7tiGkBHB0DwKjSxz_N_y+YDYzU66xU87rQ@mail.gmail.com \
--to=jason@zx2c4.com \
--cc=baptiste@bitsofnetworks.org \
--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).