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 A0142456A2; Wed, 24 Jul 2024 16:44:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E33943467; Wed, 24 Jul 2024 16:44:25 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 21EF840B97; Wed, 24 Jul 2024 16:44:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721832263; x=1753368263; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=aqCDSCa6mFHbdjItYtumwUxrDgCrm69BDViufMJhAZ0=; b=EECxAnTJXiNJAgKhKbvZXUqoDldtQXowjMJ2vQBqeHIRJxI3NIS26Kk2 diJ9jvjh9YwGroNJ7697kuWzkVpTeymHyEcOmhijJNOf7i25QK6bPoVYh 199wYiKO/L01LOWOeAGfL6mtXZkKv92pA32aIXJH4TbRqDt2Ohv6DXyGB fEQxZbYCxGlS5BnicJdLLgxVj6o3KJqQR+xowQLbNX1dmI/XOd1ZR6fxQ eqACnoLO+pEiQIjZUfjmMDLSi6Rs2gopYqTHrLQBm8eEEds4DT7puJcaT pphOwJVHoKqe84kVcegBc+dcIlHnk8fs7+6g5wHyWdQOfh5HFs9/WUyvw Q==; X-CSE-ConnectionGUID: wawxqfJXTG60ZXbykBIDNw== X-CSE-MsgGUID: t6iIW/AZQI6+pKKDmKOMwg== X-IronPort-AV: E=McAfee;i="6700,10204,11143"; a="19209536" X-IronPort-AV: E=Sophos;i="6.09,233,1716274800"; d="scan'208";a="19209536" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2024 07:44:20 -0700 X-CSE-ConnectionGUID: 3WL617u8TPqwmMLlCfVf0Q== X-CSE-MsgGUID: Q3ZUxKCEQL27R6T3hcM3vQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,233,1716274800"; d="scan'208";a="52679712" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmviesa010.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 24 Jul 2024 07:44:17 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 24 Jul 2024 07:44:19 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) 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, 24 Jul 2024 07:44:19 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 24 Jul 2024 07:44:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ab+RCeU5whq23Ei/9s9BjcO8l9WBYCHyBgXr+x2DJ2le1NKuBujOO/vcvoUyrROavCW64hmI5P6EB8CAHgmux9L+vGmlWvl9W+96FjtJmLjXHfuwc26CJ04ulfqBzUG0TAeaRlgwct92bOEYbU0EuQUiNglw59ANaS9D4AmZzEoZWsKmEvT2YW5kcI6bElcAm9lS8XsmPbZEkRQO/aiqhuRAa5iRZwb2VckxF36bSxhPckWEbNr1rra0GTzsSsBMt7xQQC6EzXo/+cBt6CtEAUDj0KshQXAFkb7YAhOOR2cOZx1yVCSazDEwfa9RrZy6ErN3MKAwebdM5CiccFDmEg== 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=O9BPatD+0oGVnpKxc7KKnZJydei6KoMfJhPF34u9OoE=; b=BeUOf1bAg6H3qbXixCAdBnxNnhXxPl/nMpMaTqdXJNdx/QEzycriV/HJLSW7M/OIUlUdgSI5BkLdm7xnGQSpygXgw3eFrxzOyx80fYnN/67X4O18N6dJ/52roGabE0n+A2pbsTq7mXFTZGkODRmRAjnm/9elYxfjpfLaNl/jbC6bkGoD5Bb1uRWhVaKmDs/Ih8L8GO+o+zypH/1M0zDUNPZxz2LuFFgjLOM0BDRofT00dnXWek3vuswRmIOTpQxw17SBeBSfNhv69ixX9pFtF8NfHjVT0bkbiPRYoBJVpKWzGFvkL4dkfAyydTpM9ELNHlQjHKMjkENi11UlpLwRJA== 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 DM8PR11MB5653.namprd11.prod.outlook.com (2603:10b6:8:25::8) by MN2PR11MB4711.namprd11.prod.outlook.com (2603:10b6:208:24e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.17; Wed, 24 Jul 2024 14:44:16 +0000 Received: from DM8PR11MB5653.namprd11.prod.outlook.com ([fe80::2962:1efd:f912:a5a3]) by DM8PR11MB5653.namprd11.prod.outlook.com ([fe80::2962:1efd:f912:a5a3%5]) with mapi id 15.20.7784.020; Wed, 24 Jul 2024 14:44:16 +0000 Message-ID: Date: Wed, 24 Jul 2024 15:44:09 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [EXTERNAL] [PATCH v2] examples/ipsec-secgw: fix SA salt endianness problem To: Akhil Goyal , "Medvedkin, Vladimir" , Chaoyong He , "dev@dpdk.org" , Anoob Joseph , "Nithin Kumar Dabilpuram" , Gagandeep Singh , Kai Ji , Brian Dooley , Jack Bond-Preston , "pablo.de.lara.guarch@intel.com" , "hemant.agrawal@nxp.com" , "suanmingm@nvidia.com" CC: "oss-drivers@corigine.com" , Shihong Wang , "stable@dpdk.org" References: <20240311024939.2523778-2-chaoyong.he@corigine.com> <20240314020052.3107549-1-chaoyong.he@corigine.com> <7c690dcb-8824-452e-85d5-7f665ff56246@intel.com> <4494141c-268a-4b41-8582-37ca96ddaf0a@intel.com> <7d006696-9a40-4c23-824d-1e984743632a@intel.com> Content-Language: en-US From: Radu Nicolau In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DB7PR05CA0031.eurprd05.prod.outlook.com (2603:10a6:10:36::44) To DM8PR11MB5653.namprd11.prod.outlook.com (2603:10b6:8:25::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM8PR11MB5653:EE_|MN2PR11MB4711:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a0930fb-e253-4f7e-bc3a-08dcabef17a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|7416014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?B?SGFqTThhdE5NaENmV0F2TDNXN2pJTWJudTNQeE5GOFg5Q1dnRWkyQ0pKM2Zu?= =?utf-8?B?eUtFdWxDeDZuYnkvZ29KOE9zMFhZTHBMSXpBd0FLa1dDYWV0b0VUR2I0WU9R?= =?utf-8?B?Z2ZNUVRVVHg0T1gyUVVpNzdZ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NSPM; H:DM8PR11MB5653.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7416014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SmZlcmdQYVR2WmhkTVRlbXovZXJsSUdRLytpV1BHekhKUWhXRWJ6UDhVdldp?= =?utf-8?B?bXBNQkd4Q2tKN21kK1BQekZTRklwY1BCVnJsOG1lQ0VRVE5hWG1wU2gxK0pT?= =?utf-8?B?MFBZREcyOEdFalpmQzl0TXlDcDNsSXpkOXE2L1VlaE90UmFOS2xvaGxWNjN2?= =?utf-8?B?RVQ1QmRycDgvR0o3Vjhuc0xMejVaNWxhRm92bmFrUEZVTlZmTzlaRHlGRWtU?= =?utf-8?B?clZhcWVZNHBydlZaZ0JKb3hNa0R0VjJLWUJlaU1hQ3hiKzNHbmZCcTMwQ21K?= =?utf-8?B?clRiQ2xaQ25ySEdwakZXSFZjYldrRVVRNTdVOEVlWmhhOGpJYkNGb1R3bThu?= =?utf-8?B?ZXlnTXNNNTVvenBOWi9BdnJYRmJ3SlBUNEJlTnhFQmVLZVVXU1dNRU0rV3NF?= =?utf-8?B?QWYxTWZGUEpzWm9VS2x1RFQwQnRONWFwQzBEOWI0Y3IwMEpWUnlzNG1vZGEr?= =?utf-8?B?RVNUVGVYUVhKb1JYN0JHOU53anczTkp0Q3FtZkdnVlpEWmkxSk1LdW91OHRy?= =?utf-8?B?OHJsbnFVQUtsK2NpbW9QVFNrdnE2NGdBYytUYXZGMzNFUDJOMEt2d3JpeTU3?= =?utf-8?B?V3diMmc5dTFKTmJueGFMdkdwejlXcXBaWHpiNDJwOW5hdHdseEg1STF0NXJu?= =?utf-8?B?YjFnTURMckR2VElRMUduU0JIQnhlSUd4Vkd2WWFxM0NoNnlSTDd4aU1ReHgy?= =?utf-8?B?WHVXV3h1ZUlFTUhheEVWZ1JCOTd1bFNMcUhY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YTnpxRlNYUXdxSmVEVGN5WXNVZTBuNnNpK1VXdE9x?= =?utf-8?B?Zkd5dS9HM1FIdG9NOUxnbzEvNXlpTG85cFpueEcyNWloV2FTakxyY3Rpb2Ny?= =?utf-8?B?QWxMTEdFUmdpZm5pY2lyK2ZBL2c0dndRZlFtdVo5Y01MbWNrNElyQVpPMjNH?= =?utf-8?B?QTJ6NlNkQlgzeng3SDNqQU5JSnZESjRKSGQ5MEJiWlZKUUF1aEdVckthN0FS?= =?utf-8?B?K2U0cElBdkN4RE4yTVZWc2J5VG11RGxQUEpDa01aZktHMkgzZkp3M1dFTzE1?= =?utf-8?B?MzRWc3IvelRuSDBVNE4yZzJuRGtmVkRtRHVKYWdHR2lVZHVSTExiUE9jZWpT?= =?utf-8?B?dG5Xc256TG9BREswVWdTalFLUDMrRXB2MmVPMEROb1pONkoxaFJxZEtTZ1ZN?= =?utf-8?B?VGEwTU0welRsSFNWM0hqT3pTclJCNzZiQytSR0NrRFNXK3hUMC9wUUJhRitn?= =?utf-8?B?V2NBUFdNdDhHNzZFcTRCdnd4NE1aVTRkaUFHTVBoYUREeDJYeUNwTktHNVFP?= =?utf-8?B?bkE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 7a0930fb-e253-4f7e-bc3a-08dcabef17a9 X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5653.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 14:44:16.3916 (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: ih+v8PZKzduGv/a+YKOpvWSvpgNsMCCVBjEfQ0FrafoEVY/pW6Jiy07sleMuDEk1uv2KbeC+xBOSWiqfZTNVgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4711 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 On 24-Jul-24 2:04 PM, Akhil Goyal wrote: >> On 24-Jul-24 12:20 PM, Akhil Goyal wrote: >>>> On 23-Jul-24 5:57 PM, Akhil Goyal wrote: >>>>>> Hi all, >>>>>> >>>>>> This patch breaks ipsec tests with ipsec-secgw: >>>>>> >>>>>> >>>>>> ./examples/ipsec-secgw/test/run_test.sh -4 trs_aesctr_sha1 >>>>>> ... >>>>>> ERROR: ./examples/ipsec-secgw/test/linux_test.sh failed for >>>> dst=192.168.31.14, >>>>>> sz=1 >>>>>> test IPv4 trs_aesctr_sha1 finished with status 1 >>>>>> ERROR test trs_aesctr_sha1 FAILED >>>>>> >>>>> The patch seems to be correct. >>>>> Please check endianness in the PMD you are testing. >>>> In my opinion salt should not be affected by endianness and it should be >>>> used as it is in the key parameter. I think the patch is wrong to make >>>> it CPU endianness dependent before being passed to the PMDs, any PMD >>>> that needs the endianness swapped should do it in the PMD code. Indeed >>>> it's passed around as a 32 bit integer but it's not used as such, and >>>> when it's actually used it should be evaluated as a byte array. >>>> >>> As per the rfc, it should be treated as byte order(i.e. big endian). >>> But here the problem is we treat it as uint32_t which makes it CPU endian >> when stored in ipsec_sa struct. >>> The keys are stored as an array of uint8_t, so keys are stored in byte order(Big >> endian). >>> So either we save salt as "uint8_t salt[4]" or do a conversion of cpu_to_be >>> So that when it is stored in PMD/HW, and we convert it from uint32_t to uint_8 >> *, there wont be issue. >> >> RFC treats it as a "four octet value" - there is no endianness until >> it's treated like an integer, which it never is. Even if it code it's >> being stored and passed as an unsigned 32bit integer it is never >> evaluated as such so its endianness doesn't matter. > The endianness matters the moment it is stored as uint32_t in ipsec_sa > It means the value is stored in CPU endianness in that integer unless it is specified. What matters is that the four byte value in the key ends up in the memory in the same order, and that was always the case before the patch, regardless of the endianness of the CPU because load and store operations are not affected by endianness. With the patch the same four bytes from the configuration file will be stored differently in memory depending on the CPU. There is no need to fix the endianness of the salt, just as there is no need to fix the byte order of the key itself. > > Now looking at the code again, I see the patch is incomplete for the case of lookaside crypto > Where the salt is copied as cnt_blk in the mbuf priv without conversion. > > So, this patch can be reverted and a simple fix can be added to mark ipsec_sa-> salt as rte_be32_t > diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h > index a83fd2283b..1fe6b97168 100644 > --- a/examples/ipsec-secgw/ipsec.h > +++ b/examples/ipsec-secgw/ipsec.h > @@ -117,7 +117,7 @@ struct __rte_cache_aligned ipsec_sa { > uint32_t spi; > struct cdev_qp *cqp[RTE_MAX_LCORE]; > uint64_t seq; > - uint32_t salt; > + rte_be32_t salt; > uint32_t fallback_sessions; > enum rte_crypto_cipher_algorithm cipher_algo; > enum rte_crypto_auth_algorithm auth_algo; > > Can you verify and send the patch? > And this may be updated in cryptodev and security lib as well in next release. > > >> I agree that we should have it everywhere as "uint8_t salt[4]" but that >> implies API changes and it doesn't change how the bytes are stored, so >> the patch will still be wrong. >> >> >>>>>> On 03/07/2024 18:58, Akhil Goyal wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -----Original Message----- >>>>>> From: Akhil Goyal >>>>>> >>>>>> Sent: Friday, March 15, 2024 12:42 AM >>>>>> To: Akhil Goyal >>>>>> ; Chaoyong He >>>>>> >>>>>> ; dev@dpdk.org >> >>>>>> Cc: oss-drivers@corigine.com >>>>> drivers@corigine.com> ; Shihong Wang >>>>>> ; >>>>>> stable@dpdk.org >>>>>> Subject: RE: [EXTERNAL] [PATCH v2] examples/ipsec-secgw: fix >>>>>> SA salt >>>>>> endianness problem >>>>>> >>>>>> >>>>>> Subject: RE: [EXTERNAL] [PATCH v2] examples/ipsec- >>>>>> secgw: fix SA salt >>>>>> endianness problem >>>>>> >>>>>> >>>>>> From: Shihong Wang >>>>>> >>>>>> >>>>>> The SA salt of struct ipsec_sa is a CPU-endian >>>>>> u32 variable, but it’s >>>>>> value is stored in an array of encryption or >>>>>> authentication keys >>>>>> according to big-endian. So it maybe need to >>>>>> convert the endianness >>>>>> order to ensure that the value assigned to the >>>>>> SA salt is CPU-endian. >>>>>> >>>>>> Fixes: 50d75cae2a2c ("examples/ipsec-secgw: >>>>>> initialize SA salt") >>>>>> Fixes: 9413c3901f31 ("examples/ipsec-secgw: >>>>>> support additional algorithms") >>>>>> Fixes: 501e9c226adf ("examples/ipsec-secgw: >>>>>> add AEAD parameters") >>>>>> Cc: stable@dpdk.org >>>>>> >>>>>> Signed-off-by: Shihong Wang >>>>>> >>>>>> Reviewed-by: Chaoyong He >>>>>> >>>>>> >>>>>> >>>>>> Acked-by: Akhil Goyal >>>>>> >>>>>> >>>>>> Applied to dpdk-next-crypto >>>>>> >>>>>> >>>>>> The patch is pulled back from dpdk-next-crypto. >>>>>> This change may cause all the PMDs to fail these cases. >>>>>> Would need acks from PMDs. >>>>>> >>>>>> >>>>>> Applied to dpdk-next-crypto >>>>>> No update from PMD owners. >>>>>> Applying it before RC2 so that we have time for fixes if needed. >>>>>> >>>>>> >>>>>> -- >>>>>> Regards, >>>>>> Vladimir