netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: Jason@zx2c4.com
Cc: ebiggers3@gmail.com, jeanphilippe.aumasson@gmail.com,
	gregkh@linuxfoundation.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, ak@linux.intel.com,
	David.Laight@aculab.com, tom@herbertland.com,
	hannes@stressinduktion.org, eric.dumazet@gmail.com
Subject: Re: [PATCH v2 net-next 3/4] secure_seq: use SipHash in place of MD5
Date: Sat, 07 Jan 2017 16:37:36 -0500 (EST)	[thread overview]
Message-ID: <20170107.163736.2224609477435674963.davem@davemloft.net> (raw)
In-Reply-To: <20170107144057.15432-4-Jason@zx2c4.com>

From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sat,  7 Jan 2017 15:40:56 +0100

> This gives a clear speed and security improvement. Siphash is both
> faster and is more solid crypto than the aging MD5.
> 
> Rather than manually filling MD5 buffers, for IPv6, we simply create
> a layout by a simple anonymous struct, for which gcc generates
> rather efficient code. For IPv4, we pass the values directly to the
> short input convenience functions.
> 
> 64-bit x86_64:
> [    1.683628] secure_tcpv6_sequence_number_md5# cycles: 99563527
> [    1.717350] secure_tcp_sequence_number_md5# cycles: 92890502
> [    1.741968] secure_tcpv6_sequence_number_siphash# cycles: 67825362
> [    1.762048] secure_tcp_sequence_number_siphash# cycles: 67485526
> 
> 32-bit x86:
> [    1.600012] secure_tcpv6_sequence_number_md5# cycles: 103227892
> [    1.634219] secure_tcp_sequence_number_md5# cycles: 94732544
> [    1.669102] secure_tcpv6_sequence_number_siphash# cycles: 96299384
> [    1.700165] secure_tcp_sequence_number_siphash# cycles: 86015473
> 
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

This and the next patch are a real shame, performance wise, on cpus
that have single-instruction SHA1 and MD5 implementations.  Sparc64
has both, and I believe x86_64 can do SHA1 these days.

It took so long to get those instructions into real silicon, and then
have software implemented to make use of them as well.

Who knows when we'll see SipHash widely deployed in any instruction
set, if at all, right?  And by that time we'll possibly find out that
"Oh shit, this SipHash thing has flaws!" and we'll need
DIPPY_DO_DA_HASH and thus be forced back to a software implementation
again.

I understand the reasons why these patches are being proposed, I just
thought I'd mention the issue of cpus that implement secure hash
algorithm instructions.

  reply	other threads:[~2017-01-07 21:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-07 14:40 [PATCH v2 net-next 0/4] Introduce The SipHash PRF Jason A. Donenfeld
2017-01-07 14:40 ` [PATCH v2 net-next 1/4] siphash: add cryptographically secure PRF Jason A. Donenfeld
2017-01-07 14:40 ` [PATCH v2 net-next 2/4] siphash: implement HalfSipHash1-3 for hash tables Jason A. Donenfeld
2017-01-07 14:40 ` [PATCH v2 net-next 3/4] secure_seq: use SipHash in place of MD5 Jason A. Donenfeld
2017-01-07 21:37   ` David Miller [this message]
2017-01-07 22:09     ` Eric Biggers
2017-01-08  1:42       ` David Miller
2017-01-09 13:18       ` David Laight
2017-01-08 12:23     ` Jason A. Donenfeld
2017-01-07 14:40 ` [PATCH v2 net-next 4/4] syncookies: use SipHash in place of SHA1 Jason A. Donenfeld
2017-01-07 19:54 ` [PATCH v2 net-next 0/4] Introduce The SipHash PRF Eric Biggers
2017-01-08 12:41   ` 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=20170107.163736.2224609477435674963.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=David.Laight@aculab.com \
    --cc=Jason@zx2c4.com \
    --cc=ak@linux.intel.com \
    --cc=ebiggers3@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@stressinduktion.org \
    --cc=jeanphilippe.aumasson@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.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).