Subject: Re: [PATCH v2 net 1/7] secure_seq: use the 64 bits of the siphash for port offset calculation

From: "Jason A. Donenfeld" <[email-masked]>
Date: Fri, 29 Apr 2022 16:38:48 +0200

Hi Willy,

On Thu, Apr 28, 2022 at 02:39:55PM +0200, Willy Tarreau wrote:
> SipHash replaced MD5 in secure_ipv{4,6}_port_ephemeral() via commit
> 7cd23e5300c1 ("secure_seq: use SipHash in place of MD5"), but the output
> remained truncated to 32-bit only. In order to exploit more bits from the
> hash, let's make the functions return the full 64-bit of siphash_3u32().
> We also make sure the port offset calculation in __inet_hash_connect()
> remains done on 32-bit to avoid the need for div_u64_rem() and an extra
> cost on 32-bit systems.
> 
> Cc: Jason A. Donenfeld <[email-masked]>
> Cc: Moshe Kol <[email-masked]>
> Cc: Yossi Gilad <[email-masked]>
> Cc: Amit Klein <[email-masked]>
> Reviewed-by: Eric Dumazet <[email-masked]>
> Signed-off-by: Willy Tarreau <[email-masked]>
> ---
>  include/net/inet_hashtables.h |  2 +-
>  include/net/secure_seq.h      |  4 ++--
>  net/core/secure_seq.c         |  4 ++--
>  net/ipv4/inet_hashtables.c    | 10 ++++++----
>  net/ipv6/inet6_hashtables.c   |  4 ++--
>  5 files changed, 13 insertions(+), 11 deletions(-)

For the secure_seq parts:

Acked-by: Jason A. Donenfeld <[email-masked]> # For secure_seq.[ch]

Thanks,
Jason