From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E9BEA45B51; Wed, 16 Oct 2024 17:48:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B044E40150; Wed, 16 Oct 2024 17:48:30 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by mails.dpdk.org (Postfix) with ESMTP id 7CDD1400D6 for ; Wed, 16 Oct 2024 17:48:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729093710; x=1760629710; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=yvBVWDBCTFyEvLRKTgDmzr6o1jhzVHPYh9P0r2z8tD8=; b=haS2yJlKD5Olt9tF70rT5XdyQjtKDNWY4ff9v1oz/Jn2B4qma2fJa1M8 rALIWBqFRSYhZdHIOHpgq4Np1T5MIKPOIcKnG8G7XkQHNp20R4cTKWYsZ Q8UWyLHF/xO+mmejCuES6o5gxdJ/mpcICmDViYPdyHK7XA6UrD0xFZdjr vHcE2H6+o4b4xFIIVQklrBBkb4tKLyDz/E0ROlFLI2uCpdJNUwbOKHs+V m6I8+obkSTHskzJB+nOaU8eEe3qIilS4RKCg7R3zLsUUERM7nVyPhvFBs ZEh8tpsMR3lb138kqqGr/tRyZM5uGfPjRsBLVx4WArxkF8QtwYbJPo35G w==; X-CSE-ConnectionGUID: Ytvr1VR/SzSAqO7zUBLYtg== X-CSE-MsgGUID: e+59H/JBRQiDk3ITKXFiUw== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="39669706" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="39669706" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 08:48:29 -0700 X-CSE-ConnectionGUID: Ps5/oiCfRHiw7yQf8VLPjg== X-CSE-MsgGUID: dYyCZ7PhTmWrK5uQOslVug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,208,1725346800"; d="scan'208";a="83029575" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orviesa005.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 16 Oct 2024 08:48:29 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 16 Oct 2024 08:48:28 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 16 Oct 2024 08:48:28 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 16 Oct 2024 08:48:28 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.40) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 16 Oct 2024 08:48:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SDJU4oeA2P0VgiyLKwltKqMjBKBakRXXUh3HfcyCN01KT+cKBe7wn8rm+UBKr4BgpiqHdhDIRrQ8oY3U3ooImyxtjNytSnUP+vBPkoCKkYga6p1wgUAbc83sUR5dgAuTXGJcXDKB85/VAM7LCemYjbLXn811I47Mz0q+25zZb6XVQHViqr9bD7FUcP6Dyoa0ZBc2SJ+Hb0Pa/6KO3Kf9ETJphB8EYbdAUol/dRF6VDqzKIzSzFHO9CCnMADUluhrlA6pCIk9//0ry5R0bQrIuDIn8FShHvkd7bBeOjvs3rUG6soRMtiHfGjMjODxXgfVPlwvG2d7XI5EOwnxHryHlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1AYeR1KZpjUs+vISJ8rDzFh34W5ESIpR2At8a5zPAP8=; b=Ogad3989lIwNB1ytlcWQTqahkXCIPO0dknWqhRXtHdGX0N2KFa2p0J3eluPb5kgQC03zDQ5ZwzPMyweqY2IspNAeIcrEHFrioF4/0iNtRjIk5KfLva94Yz0UxaDSjMrLMuTVvoPdA4ZuSH+JciIRsL2Va2SFDPMkv+tCxHmAVPnVXwNCPf8U2MRNedhnFHNiYSTw+rtvIM4KndkjaRcUQ7Z4l0wkqyBbAwyKZU6nW1lST1VANYIOg3nJAamLdg6y7a879tYRQ0GpLkf212flQ4x2Q0B/Ni0cbkvSCPGtMZrdtdaM2JPEoHyEXjIzJ1LCN3n9pxoXD9eUJ/Uy3w4e4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH7PR11MB5765.namprd11.prod.outlook.com (2603:10b6:510:139::7) by LV3PR11MB8727.namprd11.prod.outlook.com (2603:10b6:408:20d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Wed, 16 Oct 2024 15:48:18 +0000 Received: from PH7PR11MB5765.namprd11.prod.outlook.com ([fe80::fcf5:d65c:4fdd:4a2a]) by PH7PR11MB5765.namprd11.prod.outlook.com ([fe80::fcf5:d65c:4fdd:4a2a%3]) with mapi id 15.20.8048.020; Wed, 16 Oct 2024 15:48:18 +0000 Message-ID: <93e1fd04-5246-4ee6-bfeb-2d82091cff06@intel.com> Date: Wed, 16 Oct 2024 16:48:12 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6] lib/hash: add siphash To: Stephen Hemminger , "dev@dpdk.org" CC: "Wang, Yipeng1" , "Gobriel, Sameh" , "Richardson, Bruce" References: <20240227174012.343004-1-stephen@networkplumber.org> <20240801153130.63407-1-stephen@networkplumber.org> Content-Language: en-US From: "Medvedkin, Vladimir" In-Reply-To: <20240801153130.63407-1-stephen@networkplumber.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MI1P293CA0030.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:3::17) To PH7PR11MB5765.namprd11.prod.outlook.com (2603:10b6:510:139::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR11MB5765:EE_|LV3PR11MB8727:EE_ X-MS-Office365-Filtering-Correlation-Id: 62ad3358-60cc-4321-74e1-08dcedf9f433 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?B?T1JlVXhpSU5lU2w5YndhdWEvaWt2b002VHo1MmkxWm84Y01QSWZZL0g3Y1Nu?= =?utf-8?B?RCt3QmtMZUtLMDBQU0hLMHRLQ2J5YjFaUEtJcFN6bGVWVFo2ZHR0azBaZjNr?= =?utf-8?B?akgzTHpTbDlQaTVCK09hWU9SaC9RMlpTQ00xOThVa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lg2ZG12RVN3ekc2OWJsRitEZVZKN1hNRDFW?= =?utf-8?B?eXZNaCtkT25hVGdubTN4TlFTUDJtUEFlaWVJMHJPUmhKYTNtWlQ4UmppMTRw?= =?utf-8?B?a2FLdlFFS0VTMFdIeUIwYXlrK0gvM05FblBkYTU2dUVOQ081QUVmRUo2U2cy?= =?utf-8?B?aTB0UnBRejNhbWM5c214QUdnZ1hBMmFnZUx0R2s1WXZCUjAxMk9WR0N2VVFp?= =?utf-8?B?YzdpVjlGRmdBREkyWU56SzBIaUl2NVdlK1dFeDg1clozczNHYzZ5dHlHeW5M?= =?utf-8?B?VjBNTzFJemZTN2hPMHFiRUlHN3UvQTFrMHRaMjJEMTJUTW9raVg1V1F6TlZB?= =?utf-8?B?VTJBc0hPZHdkNnYrUno1algxc21NSXBtbDhJVFdCaW9TSVBLOThpdndPcEJo?= =?utf-8?B?YSsvRmkyMG5CMDRqOUhnemdmMW1kZTJpVHFMeTRkcW1SSFNoRVVWRm16cGVR?= =?utf-8?B?dXR3Z1R0SnRnVFRuNVFMejdCd0pCd3ZVRlliS1d2N201ZVkrL2dobXpERzlV?= =?utf-8?B?blZSdzRqNmtBYU4vdzRUNDVXc2VzcUJYbENDL0Z3U3NDYUY0YUhjU2NkY21z?= =?utf-8?B?TllIcnYvWUFaVzEySHFsOSszbmxVaWM5d0RDUTVIempCYXE5Ull0OFVHVUl0?= =?utf-8?B?VDFNSEJycHNXeEQ3R0J5OXlGWTZkN0Q5QUplT1YxR1ZZSlUzUHB4dEtnPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR11MB5765.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K05KUU9yWGJMaG0zTFUvbkhRY0ds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?= =?utf-8?B?QkQ3TUZUczNCdXBaSEpsdjhMOTN3NTg3Nkx3RGFuaHRpWk1kT3Vwa0Q5Tml6?= =?utf-8?B?R3NEZ1dVUkVoRVl2akFnV00zWkV6WTJPcGk0NkFtUWxKaDNQbTJsQTJHSzFQ?= =?utf-8?B?Z0Ezd25wOElHZ0g1bE54RWJDNzRLYlBCU0Zlb0xHbjIzTWk1RXVUc2xQaXRq?= =?utf-8?B?NzRtZ0JPTUxlVFpwdTcrcEltNjZXa0ozYTBCdnZSenNIZU13OERIbTBqaU9P?= =?utf-8?B?UGlITk9FVTM0bEtEMlhyZmhUdmd1YU4vZXQ1VTFkMTlFT0p3YlJZaytEL2lY?= =?utf-8?B?ODVadGUrU08rU1JiQUpYM1hUZmV4b05yUER3d3ovamJJQ1J5Snp4cE81TVlG?= =?utf-8?B?cmc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 62ad3358-60cc-4321-74e1-08dcedf9f433 X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB5765.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 15:48:18.2086 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dFa07TFVfOCJPc2Na9wCy2B+T6t4jRDRbLrsyGGIcEq1jfgRKxc+6FxqzCzZs1KiAvkd94D2dpqkCCpRBSwZo3yGclLlVmFPCwxwr6bp+EA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR11MB8727 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Stephen, Thanks for introducing this hash function. I have just a few nits: On 01/08/2024 16:31, Stephen Hemminger wrote: > The existing hash functions in DPDK are not cryptographically > secure and can be subject to carefully crafted packets causing > DoS attack. Currently in DPDK we have 3 hash functions, 2 of them can be used with our cuckoo hash table implementation: 1. CRC - Very weak, do not use with hash table if you don't fully control all keys to install into a hash table. 2. Toeplitz - keyed hash function, not used with hash tables, fastest if you have GFNI, level of diffusion fully depends on the hash key, weak against differential crypto analysis. Technically may be used with hash tables in number of usecases. 3. Jenkins hash (lookup3) - and here I can not say that it is not secure and it is subject to collisions. I'm not aware on any successful attacks on it, it has a great diffusion (see https://doi.org/10.1002/spe.2179). It is also keyed with the same size of the key as rte_hsiphash(). So I won't agree with this sentence. > > Add SipHash which is a fast and cryptographicly sound hash > created by Jean-Philippe Aumasson and Daniel J. Bernstein. > Siphash is widely used by Linux, FreeBSD, OpenBSD and other > projects because it is fast and resistant to DoS attacks. > This version is designed to be useful as alternative hash > with cuckoo hash in DPDK. > > Implementation is based of the public domain and Creative > Common license reference version as well as some optimizations > from the GPL-2 or BSD-3 licensed version in Linux. > > Signed-off-by: Stephen Hemminger > --- > v6 - rebase to 24.07 > > app/test/test_hash_functions.c | 75 +++++++++++++- > lib/hash/meson.build | 2 + > lib/hash/rte_siphash.c | 176 +++++++++++++++++++++++++++++++++ > lib/hash/rte_siphash.h | 87 ++++++++++++++++ > lib/hash/version.map | 4 + > 5 files changed, 340 insertions(+), 4 deletions(-) > create mode 100644 lib/hash/rte_siphash.c > create mode 100644 lib/hash/rte_siphash.h > + return (v0 ^ v1) ^ (v2 ^ v3); do we need parentheses here? XOR is associative and commutative, the compiler must figure out by itself in which order it will be better to add them together Also please add release notes. Apart from it - LGTM. Acked-by: Vladimir Medvedkin -- Regards, Vladimir