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 F3BFF45E41 for ; Sat, 7 Dec 2024 09:02:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ECA8B40E64; Sat, 7 Dec 2024 09:02:12 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2076.outbound.protection.outlook.com [40.107.244.76]) by mails.dpdk.org (Postfix) with ESMTP id 3DF1C40281 for ; Sat, 7 Dec 2024 09:02:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DfrPpBAoZyw1UyKuveQiQfWGcpuBHRzFpRxM4AL68S4cV55IP/8k+JKSDrJFAgYkcBnxzzCaDu/boxGcHpADbLNuENqnwPyHKnS4y4tzRYy3H6kd0xy+q27ZO5HTfvCohyEqSOG/ZjLF7qaNw3ZLwusbJqUMhZXap1N8NSSM5BfLzwQwdpfCh9A9KLr/rKVSS9YXpNXRFoqDcGh9SUQNpUAbzrU1JIJRjfstPmiiO93Qys8op/v8upW8DQ2NifZvO7UJEoUoN88ViEqD/E+GfUpT7yhgs3DsZP80ntxY0Rpp99FX998+wW5yAaP5p1Dbr6zgws4QSyi4IFiyQ3pleA== 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=5kZssqjCoIz0ZU1Is8ehVc3dtfDp9PB1/ps7fOKBmtI=; b=txGgiwTO1yhynuSWiNFelZi3cy8LBy2jxKEN2PqUW00bl68UyoILBMhRuLN+Kb/LNEMgWkjEMh9pz4rcodcWXvu0XanOpJnZOR4xZEZM8ZWLQJDhnXTrm9z6oLEO6k13eiot5J2pXeweAw77IDlrZo5it8qq7Pv9A7sATakGHdiZy9eiOZ1MA0xBGCXXA0IXxV4ye/SDNlU7Xub1+8Wdeuxqj0HdL8GQ3uB3VIGprqPlbU7Hid0IA1rahPLjKERKTfL6cv1WAQ1chvnNTreBtwkhB/XGhrHBHFS4dFPL7xLcGBC1G6fhB8x/51y6oJxHEhQ9z2/V3gSDVhtG31U56Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5kZssqjCoIz0ZU1Is8ehVc3dtfDp9PB1/ps7fOKBmtI=; b=ZaBE/YiJMlHWZZnro06ZiQtiDAz7FIngsBH5dEn2uXhj/SO7YjpdyJZWC/HEZv2KMGcuPW2+lfs2eMJ9lbqig2jSYhA4o3/y0v1nJYTjKuvmFxBLo3kNBhhaG9t38fQ+mA1sNwCxWZadDClZk0WXfvRM22CWHzCCPMAo3MFFSpz5vxNBgZWBVUN1dDPLVTrK+GWwZF5hovQBxfd7gDxtprHxQ60H+kVfRVn2jeOIE8Ewqb9Rr5GwLIXACydmOVmciFOyo2SqybQL0S5zlOD8mrXHjAdrzLGgietuPb4Cj67udQK/Qx0MODlcFsCcguuJ9R8TdfXLuSSdm9ZiM92DCw== Received: from PH7P220CA0091.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32d::10) by BY5PR12MB4097.namprd12.prod.outlook.com (2603:10b6:a03:213::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Sat, 7 Dec 2024 08:02:04 +0000 Received: from CY4PEPF0000E9D8.namprd05.prod.outlook.com (2603:10b6:510:32d:cafe::41) by PH7P220CA0091.outlook.office365.com (2603:10b6:510:32d::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.12 via Frontend Transport; Sat, 7 Dec 2024 08:02:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CY4PEPF0000E9D8.mail.protection.outlook.com (10.167.241.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Sat, 7 Dec 2024 08:02:03 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sat, 7 Dec 2024 00:01:49 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sat, 7 Dec 2024 00:01:47 -0800 From: Xueming Li To: David Marchand CC: Xueming Li , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Hemant Agrawal , "dpdk stable" Subject: patch 'crypto/openssl: fix 3DES-CTR with big endian CPUs' has been queued to stable release 23.11.3 Date: Sat, 7 Dec 2024 15:59:26 +0800 Message-ID: <20241207080055.488538-9-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241207080055.488538-1-xuemingl@nvidia.com> References: <20241111062847.216344-122-xuemingl@nvidia.com> <20241207080055.488538-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D8:EE_|BY5PR12MB4097:EE_ X-MS-Office365-Filtering-Correlation-Id: d28eb4ea-f7c2-4a4d-1c21-08dd16956fd7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?UGoyNjYxQmgrQThJMXRUZzgvR0xWMkwyZW5ld3F4dEVYVTkzdzR5c0dZc2Mz?= =?utf-8?B?cUE5VitqZTRtOVdRaU1nRVNqRmltellFQVZuczZFQ1NLL3E3MVF2M0YzRHE1?= =?utf-8?B?ZVhiN2MvN2xyZjF6WEdRelVDdXQxMW5xODVESHczdXhYWkJ6S29XcEE4TzNI?= =?utf-8?B?U041aGt4T3ZzZGFCdWRLM3J1MGxKN0FleXNBcGhaVXgrVXoyU1V3NmcwNTlX?= =?utf-8?B?VEcyYXhYR0oyVXZmMGlqSCtPQmlZeExnSTlXSUxDOCtmSEJRUWZNbS81WHJW?= =?utf-8?B?ZVM5dHlyUFVrZVEramVLeGxKdk5rbytrOEJXS0RRdGJMS1pmbnhhV0Z3ZEs3?= =?utf-8?B?NkIxRWpPSXY4UXZSaGRISStMeVVkMC9qNHF1NERKMFY0QmdBZnZxWkdqV2Nu?= =?utf-8?B?RDdxWFpoR2hHSS8vSkdEZGNSTHc2NE1GNXQ0Ykw4bWh1b05XbDVEcG9vVk1n?= =?utf-8?B?d3NnUWJXeHlIVGNWM1REU1pBZ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?ZTJYREpmQTZVVnJpSC82VlZiVEloRk9vVzZXcE05cDdxNUVPYmZzMXpiRitu?= =?utf-8?B?bFR4NHdaMGZSZDRSQ2RhVnRNeTl0a3BUR244MHkrNmU4dTlVRGg1OHZFNzRv?= =?utf-8?B?VjZBdjNSdWRycmpnMFhqOGxTVTJ6ejNlSnVFcGNlRGhvUTZXUm9Bakh2MzJE?= =?utf-8?B?VzQ4bExHZW9IVzNqOVBWSWUrVWdXTnhDV05BTXlCV05EWitiUXpqVnZRUWNC?= =?utf-8?B?WVBhUjVYM2lwQ0dkbWg5aTc4QXJjU3c4L21NSENLWjJQNURqd0pNenhWOGtV?= =?utf-8?B?RnQ1Qi96aXlieDYzdzVGeUNUcGY4ZStRL3FhekgxUTd0ZWJqY1liVWlZSWVs?= =?utf-8?B?VjJsTlVDaXVFQkxmQXYycjk4RkpsSFErZnY1b3FLV2RiNTZnVEtSYjRJcnda?= =?utf-8?B?MGI5RXBrTlJ1NUV1RjZWYnMvUGhHV0UvYmU0YTFtbFFyTFQwSlZVNVBTclFG?= =?utf-8?B?ZUtOTHV3b0R6anRCYUR5RTIzTzkrczlVL3RudVlOczBhSlFjeGt6Z3RQUnZ5?= =?utf-8?Q?5xR2QCUNJXGLROTc+NEbCjnNhjqFOG0S?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013)(7053199007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2024 08:02:03.7535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d28eb4ea-f7c2-4a4d-1c21-08dd16956fd7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D8.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4097 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/10/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=e594df339a8fd538e82b506a6a2c36dd71228ad0 Thanks. Xueming Li --- >From e594df339a8fd538e82b506a6a2c36dd71228ad0 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Fri, 25 Oct 2024 09:04:21 +0200 Subject: [PATCH] crypto/openssl: fix 3DES-CTR with big endian CPUs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Xueming Li [ upstream commit 97afd07ca79c7270480a65febd7f616a4c0b07ca ] Caught by code review. Don't byte swap unconditionally (assuming that CPU is little endian is wrong). Instead, convert from big endian to cpu and vice versa. Besides, avoid unaligned accesses and remove the ctr_inc helper that is not used anywhere else. Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library") Signed-off-by: David Marchand Acked-by: Morten Brørup Acked-by: Hemant Agrawal --- drivers/crypto/openssl/rte_openssl_pmd.c | 28 ++++++++---------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index e10a172f46..7538ae2953 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -2,6 +2,7 @@ * Copyright(c) 2016-2017 Intel Corporation */ +#include #include #include #include @@ -99,22 +100,6 @@ digest_name_get(enum rte_crypto_auth_algorithm algo) static int cryptodev_openssl_remove(struct rte_vdev_device *vdev); -/*----------------------------------------------------------------------------*/ - -/** - * Increment counter by 1 - * Counter is 64 bit array, big-endian - */ -static void -ctr_inc(uint8_t *ctr) -{ - uint64_t *ctr64 = (uint64_t *)ctr; - - *ctr64 = __builtin_bswap64(*ctr64); - (*ctr64)++; - *ctr64 = __builtin_bswap64(*ctr64); -} - /* *------------------------------------------------------------------------------ * Session Prepare @@ -1192,7 +1177,8 @@ static int process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset, uint8_t *iv, int srclen, EVP_CIPHER_CTX *ctx) { - uint8_t ebuf[8], ctr[8]; + uint8_t ebuf[8]; + uint64_t ctr; int unused, n; struct rte_mbuf *m; uint8_t *src; @@ -1208,15 +1194,19 @@ process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst, src = rte_pktmbuf_mtod_offset(m, uint8_t *, offset); l = rte_pktmbuf_data_len(m) - offset; - memcpy(ctr, iv, 8); + memcpy(&ctr, iv, 8); for (n = 0; n < srclen; n++) { if (n % 8 == 0) { + uint64_t cpu_ctr; + if (EVP_EncryptUpdate(ctx, (unsigned char *)&ebuf, &unused, (const unsigned char *)&ctr, 8) <= 0) goto process_cipher_des3ctr_err; - ctr_inc(ctr); + cpu_ctr = rte_be_to_cpu_64(ctr); + cpu_ctr++; + ctr = rte_cpu_to_be_64(cpu_ctr); } dst[n] = *(src++) ^ ebuf[n % 8]; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-12-06 23:26:44.412295323 +0800 +++ 0008-crypto-openssl-fix-3DES-CTR-with-big-endian-CPUs.patch 2024-12-06 23:26:43.853044829 +0800 @@ -1 +1 @@ -From 97afd07ca79c7270480a65febd7f616a4c0b07ca Mon Sep 17 00:00:00 2001 +From e594df339a8fd538e82b506a6a2c36dd71228ad0 Mon Sep 17 00:00:00 2001 @@ -7,0 +8,3 @@ +Cc: Xueming Li + +[ upstream commit 97afd07ca79c7270480a65febd7f616a4c0b07ca ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org @@ -28 +30 @@ -index 9657b70c7a..0616383921 100644 +index e10a172f46..7538ae2953 100644