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 8754C43C7F; Mon, 11 Mar 2024 03:50:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 962CA402DF; Mon, 11 Mar 2024 03:50:04 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2112.outbound.protection.outlook.com [40.107.237.112]) by mails.dpdk.org (Postfix) with ESMTP id 93D71402D8; Mon, 11 Mar 2024 03:50:02 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jV4/wdLghv1JBbeuJ3/1fZeytn8455zljPddgNYYhPefTd+fEA0JyqFbl7CW26C3g4H4SiZxudMpSv9lr+J/fdFPzsP3JMZSwZLQS2+Xez/Spq/6VoC06MdiFdNZBFNxrurQ8/2F4vf7VnkA5V9U1tO0Hf5DWca9+QxH52DsGZhDaG3Kb1SHFwInaucif49GbvxSXCCmVnf7bUE9awULNaQDiXY53XI8VvogpKlC7iPjxCjVmbwYTC0UWDvnhmtTWlXvEzq/HxM9goKFZ0ywq6gl9NOOXqHJ8e/401Kclv2y0C+cQVh9QZaFnwhM8g20lon4wnLVIrGynRw0opQETA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=jo/isiK0RbYpR/lKLIAOe9kkiaht5GCDZAQ5hdKoGLg=; b=LYJRXfdBmecjbqRAlFMJvrP9e+CixNo2GBwdUaOZ22zTeHQ4qU0efCt+CsJbSZD26GPK+e2xPFfWpc3lNJauou76n2VlFuYFkuPSUNX6Fvnvo9ldapR1ZRAYI0LUnY7EZJPab6LrWCPAtdztLNYJOdsr9eX07HNMSPyABGLDJScSl6y+yW10BE6hAJce4zkbCKhB7NG2FQsovT1K7cn+rk38z/5UCg/9cy21/90xEvJWDnyXiePPGJoNzjUDOthc/o4z0oVYjGfCsTXzL4FhkEj2Dre1l6NFDwRbMN5HPecV+EAPd+vulbnx52elwe/1hVNFiVcwpjOZL4HOndF3/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jo/isiK0RbYpR/lKLIAOe9kkiaht5GCDZAQ5hdKoGLg=; b=njH9jywFNMgR8q2xFCA4vnKZUCfpm0cqUad4aYuNIUBEcTxdSLghNbemvEXz1Z7uIvZZLvPGXubC/N2BWkmOOFY2faNrnVGY4Dvz7mmwoMlpMKO3ZnF2gKh6X5Kt4Wh7LiVofwk32wje+UdctdsZw7XuiKkWsoVqGMdkbmIx8oI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by PH7PR13MB6244.namprd13.prod.outlook.com (2603:10b6:510:247::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.33; Mon, 11 Mar 2024 02:50:00 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7339.035; Mon, 11 Mar 2024 02:50:00 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Shihong Wang , stable@dpdk.org, Chaoyong He Subject: [PATCH 1/2] examples/ipsec-secgw: fix SA salt endianness problem Date: Mon, 11 Mar 2024 10:49:38 +0800 Message-Id: <20240311024939.2523778-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240311024939.2523778-1-chaoyong.he@corigine.com> References: <20240311024939.2523778-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: PH1PEPF000132E8.NAMP220.PROD.OUTLOOK.COM (2603:10b6:518:1::28) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB6244:EE_ X-MS-Office365-Filtering-Correlation-Id: f8ea460e-95f0-494a-e61c-08dc4175f195 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pDbBqHOKpr+DRNiD4VEY1IJqx0vaOfCZ4kMvQ3HsaHHgpWmotaTzvTef1JaUrzfo8OzBBLHMMdeaeC/hXKZtOoXCqSztuRPUSySOa6M1psuk4bOmcIId4tI3+UFELRMuEI4VOLTROOBNObN3+Mu/CNUIQtXR3PDWj9x/6Thi7UNnehnhW82yLPAJqyfMcLiYiMck94u+ygm6+JIoFhfOX3F/QCr07NbkPSbBkKV6el2LAT+AgROzrRCZsnxycBUiaKTPVmVmyP47XxUA4Y/5TiieqQoc+HuwpCkheyaadbmyoL/oPVH/zkVj4BZs/6agj3f2oKzbp/fTYgJhpuIHn7n1tnicxGrJY7LYLHqlAzwMjrXTWsE75t081Rt/sDzisojcsUnkgJ6jFkiQkTUFCP0vE9VRZs5LaOd04xIXLLk3/UoUCXoHCQl+c0Pg+HpXnjFGyGSENZneRN66c0Q+G0qYULMu45ks/xtMELkHfUhT6qBq5gte03lI4UF0qoi/CScUuKsWEym9IwF7XcSL+8mSUlDMH6MSd+ekL3eQHnPtZNO15UFz/d+lJn85q4UDrwgs3cDzMHOyPoWiKYn6XU9TnNusUmjCEQQ/hzFzL/O1xbUE2j2Xd8X8VURHLm0OL00P1MAXi/0ay51s1/OLtxKa4YyS316c567Kc9UCHhS6jUKsVU2XY5cFRfaoqCk/IuFdsZkZ9yd+7axfsuJ668aqk7M8zIa8k+t9rECEmQ8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(52116005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MUtmL2RDeHNoYUc5SzV0aGZSWGV3b0VEOUltUlZDTlZBdFJYNlVhcTVXOFFu?= =?utf-8?B?ZEV5Ny84VFVLZHRNYmlqenlyNWFoSTRhcU5kNWUxYTJrZ1ZPR2pUckZRMHZS?= =?utf-8?B?WG1jWHJ4aHhUM1BVeE41RlRCeFRIVFJtUWw5OXVsVkxIeTcybVpCbkJqV0I1?= =?utf-8?B?SW1MR0J2ckdVNjcwTzQ2aWZQNVNwSDM1SXFaK2J3dVozZVpYbi81WjR2VVBH?= =?utf-8?B?S2N6dTJlTG4yeVNsZ0Y0bDZnK090ZGNjc2hRQTJmVFJaUEViMmFHWVlSeUpI?= =?utf-8?B?a0FoMEZKRElYUnRPWkNMM3p5UTE2MWZWWi9qdzZtZjhaRGF5OGVpY1NISUhO?= =?utf-8?B?K2Uyd1hxMElLdHBNTjdSb1NRK2dyTmNXMGI5RXY5TUhEbzdFdHpXaFZhbUFX?= =?utf-8?B?eFRjQkFBWk5HRU5MMlM2ODNCSk9Sa3psM3liR3paRUZUM0FsOE1WOFROVU9x?= =?utf-8?B?bEwxTkIzZ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8?B?OHAwVWRWeFpBVk1Ka0F2Z0ZEWlUrczcraVZzT2VhNmZsRWxETVFqTi9rbWlo?= =?utf-8?B?UDhWMEt5anIreVJDNEhqUERZdWN2cWhkL25GK1ZGRmxHK2F5KzQzNWQrK1M3?= =?utf-8?B?OWo2ZTJ6NmlFM0xjdWVscHlEZnVwbldBaEhwZGtqVFhlR1IxejBsS3dOb2VJ?= =?utf-8?B?VTBMZ3dQa3A4UDJiV0FDL2V1aUVDMi9rZWFrNi96bU0wMkdaV2pBaDQxNTVJ?= =?utf-8?B?ZEdKZXNQOE9yNndYRUFhWktVTE9LSjFjV0N6eW5HVmh0T1VlNHNyTUJYWG45?= =?utf-8?B?NHdnU1RhcUJWU0ZhS0pqU003YTRobTY0ZlExQklIMy9OUVd0VlB1TFpxZmdr?= =?utf-8?B?dVpzK2dFN1hiTTZJOTBzVi9KTnVvencvVVVLN3YvMDc5NFBjNkFnSk5Ra1Bt?= =?utf-8?B?VkxaQTRmY1NhUlVMT1hTZW1XU0FHSktvRWs0dURjZFprSzJNaXRLTmJhRHZM?= =?utf-8?B?d0ZkYXhvUFFyN1lVelVMUnF5WlJHVVdhbDNvM3dXLy8rbDJvdnNlWmZPVnNt?= =?utf-8?B?UTNpYXAxeFZ4MFhSY3FJSTArWUJtcitmZ045blVvMWhELzc0WHFLNlFqK0g1?= =?utf-8?B?cUs4QWRaQnJ6V1poT0tpdUdiOTB6VGh2TDY1UEl5UnZBcVR3Z0hLYlBGeE1h?= =?utf-8?B?U1pmeFp2Z1lhWEpXVXZBV1RxMW5IQzdXM1RJa2Nwb2dJcUE0M21ldlp0UzZp?= =?utf-8?B?TS9COUlta3V6Q2RpdHZvcW9lQmduOXNDMGlZL3FPandRVEZoOHRScjdyQkxU?= =?utf-8?B?R1E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8ea460e-95f0-494a-e61c-08dc4175f195 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 02:50:00.3177 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZE7niLe7yDbTDfp+5pdjWYg9fKyxFJIEWZDJfqTwgL7RGn7IDOOTujUXi3fLe7FrjRiqOv45OexJFHLP6GkGQ1R7rbcSAXmat87SaPTr9wA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB6244 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 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 --- examples/ipsec-secgw/sa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index c4bac17cd7..4018b0558a 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -374,6 +374,7 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, uint32_t ti; /*token index*/ uint32_t *ri /*rule index*/; struct ipsec_sa_cnt *sa_cnt; + rte_be32_t salt; /*big-endian salt*/ uint32_t cipher_algo_p = 0; uint32_t auth_algo_p = 0; uint32_t aead_algo_p = 0; @@ -508,8 +509,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, if (algo->algo == RTE_CRYPTO_CIPHER_AES_CTR) { key_len -= 4; rule->cipher_key_len = key_len; - memcpy(&rule->salt, + memcpy(&salt, &rule->cipher_key[key_len], 4); + rule->salt = rte_be_to_cpu_32(salt); } cipher_algo_p = 1; @@ -573,8 +575,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, key_len -= 4; rule->auth_key_len = key_len; rule->iv_len = algo->iv_len; - memcpy(&rule->salt, + memcpy(&salt, &rule->auth_key[key_len], 4); + rule->salt = rte_be_to_cpu_32(salt); } auth_algo_p = 1; @@ -632,8 +635,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, key_len -= 4; rule->cipher_key_len = key_len; - memcpy(&rule->salt, + memcpy(&salt, &rule->cipher_key[key_len], 4); + rule->salt = rte_be_to_cpu_32(salt); aead_algo_p = 1; continue; -- 2.39.1