Re: ipv4: Simplify ARP hash function.
From: David Miller <davem@davemloft.net>
Date: 2011-07-08 19:28:07
From: Roland Dreier <redacted> Date: Fri, 8 Jul 2011 12:26:17 -0700
On Fri, Jul 8, 2011 at 11:06 AM, David Miller [off-list ref] wrote:quoted
Ok, there was also an unintended bug in my original patch, I lost the bottom 8 bits in the fold, the hash function should instead be: +static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd) +{ + u32 val = key ^ dev->ifindex ^ hash_rnd; + + return val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24); +}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. Nobody has done this yet.