Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2671163iob; Sat, 30 Apr 2022 15:51:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcKxU5C+PKb0BKJVyGj6JzB6Lw/UgjfD+LRK0QhCTEiRo54XSVb4dGxvDQM6Z1GAEcDxDf X-Received: by 2002:a05:651c:a11:b0:24f:430d:c52e with SMTP id k17-20020a05651c0a1100b0024f430dc52emr3918634ljq.291.1651359061020; Sat, 30 Apr 2022 15:51:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651359061; cv=none; d=google.com; s=arc-20160816; b=ZE5Su4J9/FcfbYA4FFZQXQOGctw2zifPkIv/SjJyfYlK9AVb8p9y1LWDZQOT0KJNp2 HSQnZgE2PiV9D+ubo6NduqDX0w5BBTJ69FW+E+dkPc1CJzDAB7IuK35GiQZan3BJa9b6 jk4kzqL0kVuVbE9WnAV2qp8kiPyqV0q8q/sctC1i5LmZmvnZo39JZCftocS5+PHETzLf c00x6fIVi+HFmmGNEtdtXR1nsOZpK1rmPoqrulcvnzH5hhYA5zJCdjKt8c3nA7cinv/z j0BEL21mZMH5orLM/Eu1qFEbXYOTptNNSUjRtxodPGovW7sPPrjO4i0HtxRcB9EJvlo8 LdRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gBoINb6VqhxEFMDsy+tLJx5YYgkBz4j/E+7Q8RoDinA=; b=yhO4yQdHNEiX/1T48eXOsfXe9EE0LkMr8+ODXe+SnHVhTlfmqs4J0CnKLDb9RDipwi HxzWo9cDsZ+XRMuJ8kSU1i5PZdjmyBdLHim28ziVa8D5pWlzE3y8jEA3lY6cEUIJC/v7 PTLJYVrnggeMlilEiMWpdqxBJeW1HWOf/da3wEScNhjDREU/7oFMKFYTbvxtJVSb76yI /oe1tLB0PkLr5npl5UVPTfPwXc/HpMz2dHd2Tyee6R3IZv93I17tkfBlwGHpZoZVFDq5 4x1IK44AM3sZXn+i8q/NceoQwWYgMKoGQ/1Ob+/F0AQJLmYpqauTjOLSYT1F++wp+JLG AnTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=ob+GsNtH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t4-20020a199104000000b0047112fa48d2si10197694lfd.17.2022.04.30.15.50.34; Sat, 30 Apr 2022 15:51:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=ob+GsNtH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359819AbiD2Oob (ORCPT + 99 others); Fri, 29 Apr 2022 10:44:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377786AbiD2Onu (ORCPT ); Fri, 29 Apr 2022 10:43:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B19523616F; Fri, 29 Apr 2022 07:38:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E60DA612FD; Fri, 29 Apr 2022 14:38:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DE52C385A4; Fri, 29 Apr 2022 14:38:55 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="ob+GsNtH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1651243133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gBoINb6VqhxEFMDsy+tLJx5YYgkBz4j/E+7Q8RoDinA=; b=ob+GsNtHoyWGdvkaA9cg2Pz8kMCKqECfoiz6h3wRdusGHbnLaD1jUnRukJlDxitQMo+NH6 Mwz4CesyftB0ail99hig9dZd0eOnSXD0O+8ZXRB2r7PnXz1tp6b6C/YEEtBuRCTJBLjcCx JpKG0CaWe3BzL8bJK09H+42OOxiyOns= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 8d2000c9 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 29 Apr 2022 14:38:52 +0000 (UTC) Date: Fri, 29 Apr 2022 16:38:48 +0200 From: "Jason A. Donenfeld" To: Willy Tarreau Cc: netdev@vger.kernel.org, David Miller , Jakub Kicinski , Eric Dumazet , Moshe Kol , Yossi Gilad , Amit Klein , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 net 1/7] secure_seq: use the 64 bits of the siphash for port offset calculation Message-ID: References: <20220428124001.7428-1-w@1wt.eu> <20220428124001.7428-2-w@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220428124001.7428-2-w@1wt.eu> X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: Moshe Kol > Cc: Yossi Gilad > Cc: Amit Klein > Reviewed-by: Eric Dumazet > Signed-off-by: Willy Tarreau > --- > 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 # For secure_seq.[ch] Thanks, Jason