From: Andrew Lunn <andrew@lunn.ch>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Netdev <netdev@vger.kernel.org>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
David Miller <davem@davemloft.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH net-next v8 28/28] net: WireGuard secure network tunnel
Date: Fri, 26 Oct 2018 00:53:44 +0200 [thread overview]
Message-ID: <20181025225344.GD6276@lunn.ch> (raw)
In-Reply-To: <CAHmME9qMf=n7mnE-bsx86SVFBs1LrvHoc+nWrpr12vtYAgze+g@mail.gmail.com>
> > > +static void kdf(u8 *first_dst, u8 *second_dst, u8 *third_dst, const u8 *data,
> > > + size_t first_len, size_t second_len, size_t third_len,
> > > + size_t data_len, const u8 chaining_key[NOISE_HASH_LEN])
> > > +{
> > > + u8 output[BLAKE2S_HASH_SIZE + 1];
> > > + u8 secret[BLAKE2S_HASH_SIZE];
> > > +
> > > + WARN_ON(IS_ENABLED(DEBUG) &&
> > > + (first_len > BLAKE2S_HASH_SIZE ||
> > > + second_len > BLAKE2S_HASH_SIZE ||
> > > + third_len > BLAKE2S_HASH_SIZE ||
> > > + ((second_len || second_dst || third_len || third_dst) &&
> > > + (!first_len || !first_dst)) ||
> > > + ((third_len || third_dst) && (!second_len || !second_dst))));
> >
> > Maybe split this up into a number of WARN_ON()s. At the moment, if it
> > fires, you have little idea why, there are so many comparisons. Also,
> > is this on the hot path? I guess not, since this is keys, not
> > packets. Do you need to care about DEBUG here?
>
> This is on the hot path, actually. Well, it's not on path of data
> packets, but I do consider handshake packets to be fairly "warm".
Hi Jason
So for me, hot path is something called 10 million timers per
second. How often do handshake packets happen?
> I'm not especially keen on splitting that up into multiple warn_ons,
> mostly because if that is ever hint, something is seriously wrong,
> and the whole flow would likely then need auditing anyway.
On the flip side, if you think this is so unlikely, it probably means
it is hard to reproduce. And then you will wish you knew exactly which
triggered. If you can get the disassembly and stack trace you might be
able to figure it out, but have a print could be a lot easier.
Anyway, it was just a suggestion. No worries.
Andrew
next prev parent reply other threads:[~2018-10-25 22:53 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 14:56 [PATCH net-next v8 00/28] WireGuard: Secure Network Tunnel Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 01/28] ARM: makefile: use ARMv3M mode for RiscPC Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 02/28] asm: simd context helper API Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 03/28] zinc: introduce minimal cryptography library Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 04/28] zinc: ChaCha20 generic C implementation and selftest Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 05/28] zinc: import Andy Polyakov's ChaCha20 x86_64 implementation Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 06/28] zinc: " Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 07/28] zinc: import Andy Polyakov's ChaCha20 ARM and ARM64 implementations Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 08/28] zinc: port " Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 09/28] zinc: " Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 10/28] zinc: ChaCha20 MIPS32r2 implementation Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 11/28] zinc: Poly1305 generic C implementations and selftest Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 12/28] zinc: import Andy Polyakov's Poly1305 x86_64 implementation Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 13/28] zinc: " Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 14/28] zinc: import Andy Polyakov's Poly1305 ARM and ARM64 implementations Jason A. Donenfeld
2018-10-18 14:56 ` [PATCH net-next v8 15/28] zinc: " Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 16/28] zinc: import Andy Polyakov's Poly1305 MIPS64 implementation Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 17/28] zinc: Poly1305 MIPS32r2 and MIPS64 implementations Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 18/28] zinc: ChaCha20Poly1305 construction and selftest Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 19/28] zinc: BLAKE2s generic C implementation " Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 20/28] zinc: BLAKE2s x86_64 implementation Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 21/28] zinc: Curve25519 generic C implementations and selftest Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 22/28] zinc: Curve25519 x86_64 implementation Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 23/28] zinc: import Bernstein and Schwabe's Curve25519 ARM implementation Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 24/28] zinc: " Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 25/28] crypto: port Poly1305 to Zinc Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 26/28] crypto: port ChaCha20 " Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 27/28] security/keys: rewrite big_key crypto to use Zinc Jason A. Donenfeld
2018-10-18 14:57 ` [PATCH net-next v8 28/28] net: WireGuard secure network tunnel Jason A. Donenfeld
2018-10-20 22:47 ` Andrew Lunn
2018-10-25 14:43 ` Jason A. Donenfeld
2018-10-25 22:37 ` Andrew Lunn
2018-10-25 23:59 ` Jason A. Donenfeld
2018-10-25 22:44 ` Andrew Lunn
2018-10-25 23:47 ` Jason A. Donenfeld
2018-10-26 13:09 ` Theodore Y. Ts'o
2018-10-26 14:38 ` Jason A. Donenfeld
2018-10-25 22:53 ` Andrew Lunn [this message]
2018-10-26 0:00 ` Jason A. Donenfeld
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=20181025225344.GD6276@lunn.ch \
--to=andrew@lunn.ch \
--cc=Jason@zx2c4.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).