From: Roland Dreier <roland@purestorage.com>
To: David Miller <davem@davemloft.net>
Cc: johnwheffner@gmail.com, mj@ucw.cz, netdev@vger.kernel.org
Subject: Re: ipv4: Simplify ARP hash function.
Date: Fri, 8 Jul 2011 13:44:42 -0700 [thread overview]
Message-ID: <CAL1RGDWTfchzBSv9rbgfg5DWvqB-Gi-RBpzDPGRUg96fNcf4Bw@mail.gmail.com> (raw)
In-Reply-To: <20110708.122742.1006323245708104141.davem@davemloft.net>
>> Doesn't seem to matter much -- this is now equivalent to
>>
>> a = key ^ dev->ifindex
>> return (a ^ (a >> 8) ^ (a >> 16) ^ (a >> 24)) // (1)
>> ^ (rnd ^ (rnd >> 8) ^ (rnd >> 16) ^ (rnd >> 24)) // (2)
>>
>> where again the attacker controls (1), and (2) is a constant.
> Right, but how can you attack it? Show me how you can grow
> a hash chain of arbitrary length by modulating the key in
> a deterministic way.
Well, if two things hash to different buckets with the full hash
function, then they already hashed to different buckets without
the extra randomness. So why bother with hash_rnd?
The answer is that you have to mix hash_rnd into the hash
in a nonlinear way, so that an attacker can't know if two values
end up in the same bucket or not.
With your hash function, the attacker can just compute the
hash (without hash_rnd) for all the values of key ^ ifindex
and then use all the values that end up in the same bucket.
- R.
next prev parent reply other threads:[~2011-07-08 20:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-08 17:10 ipv4: Simplify ARP hash function David Miller
2011-07-08 17:40 ` Martin Mares
2011-07-08 17:47 ` David Miller
2011-07-08 17:54 ` David Miller
2011-07-08 18:03 ` John Heffner
2011-07-08 18:06 ` David Miller
2011-07-08 19:26 ` Roland Dreier
2011-07-08 19:27 ` David Miller
2011-07-08 19:39 ` Michał Mirosław
2011-07-08 19:51 ` David Miller
2011-07-08 19:59 ` David Miller
2011-07-08 20:10 ` Michał Mirosław
2011-07-08 20:34 ` Michał Mirosław
2011-07-08 20:35 ` David Miller
2011-07-08 20:44 ` Roland Dreier [this message]
2011-07-08 22:32 ` David Miller
2011-07-08 23:11 ` Roland Dreier
2011-07-10 19:07 ` David Miller
2011-07-08 23:41 ` Stephen Hemminger
2011-07-08 23:47 ` David Miller
2011-07-09 3:08 ` Stephen Hemminger
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=CAL1RGDWTfchzBSv9rbgfg5DWvqB-Gi-RBpzDPGRUg96fNcf4Bw@mail.gmail.com \
--to=roland@purestorage.com \
--cc=davem@davemloft.net \
--cc=johnwheffner@gmail.com \
--cc=mj@ucw.cz \
--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).