mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 12:57:06 +09:00
inet: switch IP ID generator to siphash
commit df453700e8 upstream.
According to Amit Klein and Benny Pinkas, IP ID generation is too weak
and might be used by attackers.
Even with recent net_hash_mix() fix (netns: provide pure entropy for net_hash_mix())
having 64bit key and Jenkins hash is risky.
It is time to switch to siphash and its 128bit keys.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Amit Klein <aksecurity@gmail.com>
Reported-by: Benny Pinkas <benny@pinkas.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 4.9: adjust context]
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -21,6 +21,11 @@ typedef struct {
|
||||
u64 key[2];
|
||||
} siphash_key_t;
|
||||
|
||||
static inline bool siphash_key_is_zero(const siphash_key_t *key)
|
||||
{
|
||||
return !(key->key[0] | key->key[1]);
|
||||
}
|
||||
|
||||
u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key);
|
||||
#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <linux/uidgid.h>
|
||||
#include <net/inet_frag.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/siphash.h>
|
||||
|
||||
struct tcpm_hash_bucket;
|
||||
struct ctl_table_header;
|
||||
@@ -137,5 +138,6 @@ struct netns_ipv4 {
|
||||
int sysctl_fib_multipath_use_neigh;
|
||||
#endif
|
||||
atomic_t rt_genid;
|
||||
siphash_key_t ip_id_key;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user