From c87795163ff17965593f764d156a2f0e82266d32 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 12 Dec 2014 18:15:52 +0000 Subject: convert some hash tables (the easy ones) to siphash. ok benno. --- usr.sbin/bgpd/rde_rib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'usr.sbin/bgpd/rde_rib.c') diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index d1cc5430508..8844802e2ba 100644 --- a/usr.sbin/bgpd/rde_rib.c +++ b/usr.sbin/bgpd/rde_rib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_rib.c,v 1.139 2014/10/08 16:15:37 deraadt Exp $ */ +/* $OpenBSD: rde_rib.c,v 1.140 2014/12/12 18:15:51 tedu Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker @@ -22,6 +22,7 @@ #include #include +#include #include "bgpd.h" #include "rde.h" @@ -357,9 +358,11 @@ static void path_link(struct rde_aspath *, struct rde_peer *); struct path_table pathtable; +SIPHASH_KEY pathtablekey; + /* XXX the hash should also include communities and the other attrs */ #define PATH_HASH(x) \ - &pathtable.path_hashtbl[hash32_buf((x)->data, (x)->len, HASHINIT) & \ + &pathtable.path_hashtbl[SipHash24(&pathtablekey, (x)->data, (x)->len) & \ pathtable.path_hashmask] void @@ -377,6 +380,7 @@ path_init(u_int32_t hashsize) LIST_INIT(&pathtable.path_hashtbl[i]); pathtable.path_hashmask = hs - 1; + arc4random_buf(&pathtablekey, sizeof(pathtablekey)); } void -- cgit v1.2.3