lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110708.105430.2072718553430519147.davem@davemloft.net>
Date:	Fri, 08 Jul 2011 10:54:30 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	mj@....cz
Cc:	netdev@...r.kernel.org
Subject: Re: ipv4: Simplify ARP hash function.

From: David Miller <davem@...emloft.net>
Date: Fri, 08 Jul 2011 10:47:39 -0700 (PDT)

> From: Martin Mares <mj@....cz>
> Date: Fri, 8 Jul 2011 19:40:55 +0200
> 
>> The hash function is linear, so it can be reduced to:
>> 
>> 	a = key ^ dev->ifindex
>> 	return (a >> 8) ^ (a >> 16) ^ (a >> 24)				// (1)
>> 	     ^ (hash_rnd >> 8) ^ (hash_rnd >> 16) ^ (hash_rnd >> 24)	// (2)
> 
> Is this really the same?  The inclusion of a full 32-bit xor
> with hash_rnd before folding was intentional, so that the
> final folding occurs on a completely "random" value.

For example, try out this test program.  Run as "./x ${RANDOM_VALUE}",
it shows that the attacker cannot simply just iterate by the number of
hash table slots to create collisions, assuming a hash table size of
256 slots:

--------------------
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argp)
{
	int i, rnd;

	rnd = atoi(argp[1]);
	for (i = 1; i < (64 * 1024); i += 256) {
		int x = (i ^ rnd);

		x ^= (x >> 8) ^ (x << 16) ^ (x >> 24);

		x &= 0xff;

		printf("%d\n", x);
	}
	return 0;
}

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ