wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
From: Hristo Georgiev <hristo.metal@gmail.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Nonce in out-of-order messages
Date: Sun, 1 Sep 2019 11:10:27 +0300	[thread overview]
Message-ID: <A87199A2-CE44-4B4A-8843-ABD0085D77BE@gmail.com> (raw)
In-Reply-To: <CAHmME9rPiyV73jUF9p=nQ+_8JswON1usWbOKpaT6SavsOokpdA@mail.gmail.com>

Thank you for the answer Jason, I appreciate your time and excellent work.
After deep dive I’ve found transport messages and RFC6479 replay detection implementation.

Cheers,
Hristo

> On 25 Aug 2019, at 18:56, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> 
> On Sun, Aug 25, 2019 at 9:36 AM Hristo Georgiev <hristo.metal@gmail.com> wrote:
>> 
>> Hello
>> I’m working on file transfer protocol inspired by Noise and Wireguard over UDP  with static keys so the handshake pattern is going to be Noise_IK_25519_ChaChaPoly_BLAKE2s  or KK. In general i’m trying to follow NoiseSocket spec but adapted to UDP and i was wondering where to place the ‘nonce’ into packet to extend the protocol as described into p.11.4 in NoiseProtocol spec http://www.noiseprotocol.org/noise.html#out-of-order-transport-messages .  So I had a look into WireGuard implementation (which I use a lot in multiple sites, mostly on EdgeRouters)
>> so what i found in noise.c line 445 message_decrypt:
>> 
>> chacha20poly1305_decrypt(dst_plaintext, src_ciphertext, src_len,
>>                                      hash, NOISE_HASH_LEN,
>>                                      0 /* Always zero for Noise_IK */, key))
>> 
>> Correct me if I’m mistaken, I’m not C programer nor cryptographer, I think this zero here is the Nonce. If that’s the case what security sacrifices and the chance for replay attacks are?
>> Would it be Ok if I also hardcode the Nonce to 0 in my implementation?
> 
> This isn't the nonce used as part of the transport object, but rather
> a single encryption/decryption that happens with a unique key as part
> of the handshake. It being zero is a natural consequence of the
> protocol flow.
> 
> Don't hardcode a zero nonce in transport messages.

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

      reply	other threads:[~2019-09-01  8:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 10:05 Nonce in out-of-order messages Hristo Georgiev
2019-08-25 15:56 ` Jason A. Donenfeld
2019-09-01  8:10   ` Hristo Georgiev [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=A87199A2-CE44-4B4A-8843-ABD0085D77BE@gmail.com \
    --to=hristo.metal@gmail.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).