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 21301A0543 for ; Tue, 21 Jun 2022 10:03:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB4F940E0F; Tue, 21 Jun 2022 10:03:22 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) by mails.dpdk.org (Postfix) with ESMTP id CBA8840151 for ; Tue, 21 Jun 2022 10:03:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y/KyVs8yCdAmq917wjMp//r0GYtU64tG1q2l2U/r1mDCkzMjn5Dx2Z77lzUThvMHoQmBks5er3QjqksC4uVA/qr6pgO5fWwT1qroaPBF0weqW6cB4VWrnG3gMADIXLy9+RLqeJqF9MMNhcCJ2sv+x9k9aaMMr0tRJ1y3X1z0c01J6qmDm1/cP19q91TeNv10NOVHNi2rnn91SO0udIMhtwCTTLFg/qR6rgdqf2PpEdCZZFno1DYEY5/lqZlge3TwYqRMlj35679xSBxX/8QpdG/bNTJPk5JCB2V3A8slXbZtvyC5SEE75VVTarOOorfzBnJRUe2AXFx2qGNr7sHv+w== 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=yEzHBZQsxW/hMOAW9qWJw8+64rAa2T3pa6w+7Zo0pjU=; b=F74y6ZYR260zSmc6U9vSe+T/j34AciXaZJeBvKOnF/g6i77C3FZImtEyvjA+835FnGh6ezO9o/o1NbbrMfNqayVlHO8TtRYA7/US58Iks/layVohv2NHcEao4bIdfxYBOxQwWqQGPeSmzyBPtqf1LvFqQzPXAtmVwo9Hw4Fw1Ezla0/P/PfoDBI+NDAyWThkhzs2PGDXusSTRvZkxPMfeShaQYuLlm/Ll8W+zKdB4NnNgJTr6p5xwvrefM5P5vGxTN3S2auqJ71YUiZxAGxWA5zzPgULUCrJQEsfUKXie/Sf2qZkFMb0/cgfAZERDX/uMKe3+6DO1lMy3rM+buTYpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=dpdk.org 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 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=yEzHBZQsxW/hMOAW9qWJw8+64rAa2T3pa6w+7Zo0pjU=; b=M4tmAAQd8WqGcC0zqifiNqEUXsIV+6GYm3kKAg+ncLCLalduBkDWesrwV2MlPH6iIUqu/3BM8k4SdyXjOHcdQqx725qSLHKHMuV0+rlWuBJ/Wk9wGosgStrMQ9F7+Xj2dw6jcNsv6NuUJ9q7MxwKu5rAbrtSIV2MHvzja2us9G/RKrThpTlWIcP5xPngGjXkk93jgq4iaU1ATKbpiXkAmvx861W6qr9fMLolIIqwZ+degvnOcRDH5z95yWVI+R2cqHcAMLTEBSmx423dsMcfUghR4iP6PSNaC6+yBqu0eX7gS2oWUvJ9zsgrhgm9Dn4HZ8DNYjwUvzKVSXfTp9idaw== Received: from DM6PR02CA0134.namprd02.prod.outlook.com (2603:10b6:5:1b4::36) by DM6PR12MB2810.namprd12.prod.outlook.com (2603:10b6:5:41::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.18; Tue, 21 Jun 2022 08:03:19 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::16) by DM6PR02CA0134.outlook.office365.com (2603:10b6:5:1b4::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.18 via Frontend Transport; Tue, 21 Jun 2022 08:03:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.238) by DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Tue, 21 Jun 2022 08:03:19 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 21 Jun 2022 08:03:18 +0000 Received: from nvidia.com (10.126.230.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.986.22; Tue, 21 Jun 2022 01:03:17 -0700 From: Xueming Li To: Pablo de Lara CC: dpdk stable Subject: patch 'crypto/ipsec_mb: fix length and offset settings' has been queued to stable release 20.11.6 Date: Tue, 21 Jun 2022 11:01:07 +0300 Message-ID: <20220621080301.2315720-2-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220621080301.2315720-1-xuemingl@nvidia.com> References: <20220621080301.2315720-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 16254265-314e-4a8e-30f1-08da535c8131 X-MS-TrafficTypeDiagnostic: DM6PR12MB2810:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ry/BGT16OFaDFFGcaLbQBtzUmnKs3omfbmGsYKG2ccSt1yKh+bpjUTMtRnzg3ZjkriKaOPk/RBS7rwQUo+c1nztsj9GWJFA2PZZ4vtqr2BkZQXnkolnDRNWHMJMKUPPMX5oZb5H5tCqVgHKBnXsaze69Tk3ngydY7LqLpYRdQ8oRl632IYBLGLRoiFvSpWfdSvL6F5Ju1v0xjaTDfu3VGUOCFVnk4qPdlORjQePbvrTAEbH2ComK4V25KyWCE5RoXtMxyas41PDiGsddwbbrbLboK8Mg6EFpJCWJTZCtrQlAq1zJ9JenLal7HZtu2YBWopSQrEiBJb9s3LzIHxp9jVNvMkkAoyAA8iTECeRyU+V46k2ZVyLVmOebXACV5EZyNH9VoCpv7KL0zf3bqKys6fyux4Lvyu0frhA2PTkb02gkHQBUDnudDL/N5gLJWAJ7PUhZmHPqdQkrKyLQx+mAYSGzNluXjl8SgPkokrZszBQcKH548qg0C6BzG7XXEp458ggNGDTuKd/yqpWSTWpMS6wwv/hecw4kpgFjSORigy6VKAY8y1BuoraJQKVurjJ4mbbyLWqrQvBiO2FGSodKEIpTTKhsnX3tbSHATPY8I6EpJVdGBHSYigMfwgJbf7rw0XbBWvtcmxe4KPNDaHN3fEtp45Gf66s3qWk92KEVz3q8JFrd3Kgk43LIhex+tY6jj7mQSDxHEU+iN/dTWKDjROFY/ZmyQUOPMuMjmyJ4YWpW1UdhsTx9QW3ggZO0QZR9nNk7lH0HgFRijoJvClz7AA8ShZEgclrorrjcZwS0kad4FZJnZAXuqfyrptk7xPcY+QI2hRCs5bT2VYL4rrLSmfPvaLI7os1EfjAH/HvgZUL+WWae2yeKzAX1urXi4n1J4o/fsJzGnj9y82fnFFsX2ziCTwY0JDM+tBw1fp7fo2M= X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(396003)(376002)(39860400002)(346002)(136003)(36840700001)(46966006)(40470700004)(30864003)(478600001)(40140700001)(70206006)(5660300002)(86362001)(40460700003)(8676002)(8936002)(966005)(4326008)(70586007)(55016003)(36860700001)(41300700001)(426003)(1076003)(336012)(47076005)(53546011)(6666004)(40480700001)(2906002)(186003)(2616005)(83380400001)(356005)(7696005)(82740400003)(6286002)(82310400005)(81166007)(316002)(6916009)(36756003)(16526019)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 08:03:19.4521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16254265-314e-4a8e-30f1-08da535c8131 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2810 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 20.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/23/22. 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://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/0fb580b1c018649febad807b13f3bcba2efc1b21 Thanks. Xueming Li --- >From 0fb580b1c018649febad807b13f3bcba2efc1b21 Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Tue, 22 Mar 2022 13:39:09 +0000 Subject: [PATCH] crypto/ipsec_mb: fix length and offset settings Cc: Xueming Li [ upstream commit a501609ea6466ed8526c0dfadedee332a4d4a451 ] KASUMI, SNOW3G and ZUC require lengths and offsets to be set in bits or bytes depending on the algorithm. There were some algorithms that were mixing these two, so this commit is fixing this issue. Fixes: ae8e085c608d ("crypto/aesni_mb: support KASUMI F8/F9") Fixes: 6c42e0cf4d12 ("crypto/aesni_mb: support SNOW3G-UEA2/UIA2") Fixes: fd8df85487c4 ("crypto/aesni_mb: support ZUC-EEA3/EIA3") Signed-off-by: Pablo de Lara --- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 126 +++++++++++++++------ 1 file changed, 90 insertions(+), 36 deletions(-) diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index f4ffb21e10..ab9864739d 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -1057,7 +1057,9 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op) static inline uint64_t auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, - uint32_t oop) + uint32_t oop, const uint32_t auth_offset, + const uint32_t cipher_offset, const uint32_t auth_length, + const uint32_t cipher_length) { struct rte_mbuf *m_src, *m_dst; uint8_t *p_src, *p_dst; @@ -1066,7 +1068,7 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, /* Only cipher then hash needs special calculation. */ if (!oop || session->chain_order != CIPHER_HASH) - return op->sym->auth.data.offset; + return auth_offset; m_src = op->sym->m_src; m_dst = op->sym->m_dst; @@ -1074,24 +1076,23 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, p_src = rte_pktmbuf_mtod(m_src, uint8_t *); p_dst = rte_pktmbuf_mtod(m_dst, uint8_t *); u_src = (uintptr_t)p_src; - u_dst = (uintptr_t)p_dst + op->sym->auth.data.offset; + u_dst = (uintptr_t)p_dst + auth_offset; /** * Copy the content between cipher offset and auth offset for generating * correct digest. */ - if (op->sym->cipher.data.offset > op->sym->auth.data.offset) - memcpy(p_dst + op->sym->auth.data.offset, - p_src + op->sym->auth.data.offset, - op->sym->cipher.data.offset - - op->sym->auth.data.offset); - + if (cipher_offset > auth_offset) + memcpy(p_dst + auth_offset, + p_src + auth_offset, + cipher_offset - + auth_offset); /** * Copy the content between (cipher offset + length) and (auth offset + * length) for generating correct digest */ - cipher_end = op->sym->cipher.data.offset + op->sym->cipher.data.length; - auth_end = op->sym->auth.data.offset + op->sym->auth.data.length; + cipher_end = cipher_offset + cipher_length; + auth_end = auth_offset + auth_length; if (cipher_end < auth_end) memcpy(p_dst + cipher_end, p_src + cipher_end, auth_end - cipher_end); @@ -1246,7 +1247,12 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, struct rte_mbuf *m_src = op->sym->m_src, *m_dst; struct aesni_mb_session *session; uint32_t m_offset, oop; - +#if IMB_VERSION(0, 53, 3) <= IMB_VERSION_NUM + uint32_t auth_off_in_bytes; + uint32_t ciph_off_in_bytes; + uint32_t auth_len_in_bytes; + uint32_t ciph_len_in_bytes; +#endif session = get_session(qp, op); if (session == NULL) { op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION; @@ -1362,6 +1368,7 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, if (job->cipher_mode == IMB_CIPHER_ZUC_EEA3) { job->aes_enc_key_expanded = session->cipher.zuc_cipher_key; job->aes_dec_key_expanded = session->cipher.zuc_cipher_key; + m_offset >>= 3; } else if (job->cipher_mode == IMB_CIPHER_SNOW3G_UEA2_BITLEN) { job->enc_keys = &session->cipher.pKeySched_snow3g_cipher; m_offset = 0; @@ -1418,9 +1425,6 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, switch (job->hash_alg) { case AES_CCM: - job->cipher_start_src_offset_in_bytes = - op->sym->aead.data.offset; - job->msg_len_to_cipher_in_bytes = op->sym->aead.data.length; job->hash_start_src_offset_in_bytes = op->sym->aead.data.offset; job->msg_len_to_hash_in_bytes = op->sym->aead.data.length; @@ -1430,19 +1434,11 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, case AES_GMAC: if (session->cipher.mode == GCM) { - job->cipher_start_src_offset_in_bytes = - op->sym->aead.data.offset; job->hash_start_src_offset_in_bytes = op->sym->aead.data.offset; - job->msg_len_to_cipher_in_bytes = - op->sym->aead.data.length; job->msg_len_to_hash_in_bytes = op->sym->aead.data.length; } else { - job->cipher_start_src_offset_in_bytes = - op->sym->auth.data.offset; - job->hash_start_src_offset_in_bytes = - op->sym->auth.data.offset; job->msg_len_to_cipher_in_bytes = 0; job->msg_len_to_hash_in_bytes = 0; } @@ -1453,10 +1449,7 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, #if IMB_VERSION(0, 54, 3) <= IMB_VERSION_NUM case IMB_AUTH_CHACHA20_POLY1305: - job->cipher_start_src_offset_in_bytes = op->sym->aead.data.offset; job->hash_start_src_offset_in_bytes = op->sym->aead.data.offset; - job->msg_len_to_cipher_in_bytes = - op->sym->aead.data.length; job->msg_len_to_hash_in_bytes = op->sym->aead.data.length; @@ -1464,26 +1457,87 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, session->iv.offset); break; #endif - default: - /* For SNOW3G, length and offsets are already in bits */ - job->cipher_start_src_offset_in_bytes = - op->sym->cipher.data.offset; - job->msg_len_to_cipher_in_bytes = op->sym->cipher.data.length; +#if IMB_VERSION(0, 53, 3) <= IMB_VERSION_NUM + /* ZUC and SNOW3G require length in bits and offset in bytes */ + case IMB_AUTH_ZUC_EIA3_BITLEN: + case IMB_AUTH_SNOW3G_UIA2_BITLEN: + auth_off_in_bytes = op->sym->auth.data.offset >> 3; + ciph_off_in_bytes = op->sym->cipher.data.offset >> 3; + auth_len_in_bytes = op->sym->auth.data.length >> 3; + ciph_len_in_bytes = op->sym->cipher.data.length >> 3; job->hash_start_src_offset_in_bytes = auth_start_offset(op, - session, oop); + session, oop, auth_off_in_bytes, + ciph_off_in_bytes, auth_len_in_bytes, + ciph_len_in_bytes); + job->msg_len_to_hash_in_bits = op->sym->auth.data.length; + + job->iv = rte_crypto_op_ctod_offset(op, uint8_t *, + session->iv.offset); + break; + + /* KASUMI requires lengths and offset in bytes */ + case IMB_AUTH_KASUMI_UIA1: + auth_off_in_bytes = op->sym->auth.data.offset >> 3; + ciph_off_in_bytes = op->sym->cipher.data.offset >> 3; + auth_len_in_bytes = op->sym->auth.data.length >> 3; + ciph_len_in_bytes = op->sym->cipher.data.length >> 3; + + job->hash_start_src_offset_in_bytes = auth_start_offset(op, + session, oop, auth_off_in_bytes, + ciph_off_in_bytes, auth_len_in_bytes, + ciph_len_in_bytes); + job->msg_len_to_hash_in_bytes = auth_len_in_bytes; + + job->iv = rte_crypto_op_ctod_offset(op, uint8_t *, + session->iv.offset); + break; +#endif + + default: + job->hash_start_src_offset_in_bytes = auth_start_offset(op, + session, oop, op->sym->auth.data.offset, + op->sym->cipher.data.offset, + op->sym->auth.data.length, + op->sym->cipher.data.length); job->msg_len_to_hash_in_bytes = op->sym->auth.data.length; job->iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset); } + switch (job->cipher_mode) { #if IMB_VERSION(0, 53, 3) <= IMB_VERSION_NUM - if (job->cipher_mode == IMB_CIPHER_ZUC_EEA3) - job->msg_len_to_cipher_in_bytes >>= 3; - else if (job->hash_alg == IMB_AUTH_KASUMI_UIA1) - job->msg_len_to_hash_in_bytes >>= 3; + /* ZUC requires length and offset in bytes */ + case IMB_CIPHER_ZUC_EEA3: + job->cipher_start_src_offset_in_bytes = + op->sym->cipher.data.offset >> 3; + job->msg_len_to_cipher_in_bytes = + op->sym->cipher.data.length >> 3; + break; + /* ZUC and SNOW3G require length and offset in bits */ + case IMB_CIPHER_SNOW3G_UEA2_BITLEN: + case IMB_CIPHER_KASUMI_UEA1_BITLEN: + job->cipher_start_src_offset_in_bits = + op->sym->cipher.data.offset; + job->msg_len_to_cipher_in_bits = + op->sym->cipher.data.length; + break; +#endif + case CCM: + case GCM: +#if IMB_VERSION(0, 54, 3) <= IMB_VERSION_NUM + case IMB_CIPHER_CHACHA20_POLY1305: #endif + job->cipher_start_src_offset_in_bytes = + op->sym->aead.data.offset; + job->msg_len_to_cipher_in_bytes = op->sym->aead.data.length; + break; + default: + job->cipher_start_src_offset_in_bytes = + op->sym->cipher.data.offset; + job->msg_len_to_cipher_in_bytes = op->sym->cipher.data.length; + } /* Set user data to be crypto operation data struct */ job->user_data = op; -- 2.35.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-21 15:37:49.365082886 +0800 +++ 0001-crypto-ipsec_mb-fix-length-and-offset-settings.patch 2022-06-21 15:37:48.951117611 +0800 @@ -1 +1 @@ -From a501609ea6466ed8526c0dfadedee332a4d4a451 Mon Sep 17 00:00:00 2001 +From 0fb580b1c018649febad807b13f3bcba2efc1b21 Mon Sep 17 00:00:00 2001 @@ -3 +3 @@ -Date: Wed, 23 Feb 2022 16:01:16 +0000 +Date: Tue, 22 Mar 2022 13:39:09 +0000 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit a501609ea6466ed8526c0dfadedee332a4d4a451 ] @@ -14,2 +16,0 @@ -Fixes: 8c835018de84 ("crypto/ipsec_mb: support ZUC-256 for aesni_mb") -Cc: stable@dpdk.org @@ -19,2 +20,2 @@ - drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 122 +++++++++++++++++-------- - 1 file changed, 86 insertions(+), 36 deletions(-) + drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 126 +++++++++++++++------ + 1 file changed, 90 insertions(+), 36 deletions(-) @@ -22,5 +23,5 @@ -diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c -index 0111c6f540..c974886032 100644 ---- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c -+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c -@@ -930,7 +930,9 @@ error_exit: +diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +index f4ffb21e10..ab9864739d 100644 +--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c ++++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +@@ -1057,7 +1057,9 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op) @@ -37 +38 @@ -@@ -939,7 +941,7 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, +@@ -1066,7 +1068,7 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, @@ -40 +41 @@ - if (!oop || session->chain_order != IMB_ORDER_CIPHER_HASH) + if (!oop || session->chain_order != CIPHER_HASH) @@ -46 +47 @@ -@@ -947,24 +949,24 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, +@@ -1074,24 +1076,23 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, @@ -61,0 +63 @@ +- @@ -67 +68,0 @@ - @@ -79,2 +80,2 @@ -@@ -1111,6 +1113,10 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, - struct aesni_mb_qp_data *qp_data = ipsec_mb_get_qp_private_data(qp); +@@ -1246,7 +1247,12 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, + struct rte_mbuf *m_src = op->sym->m_src, *m_dst; @@ -82,0 +84,2 @@ +- ++#if IMB_VERSION(0, 53, 3) <= IMB_VERSION_NUM @@ -87,2 +90,2 @@ - - session = ipsec_mb_get_session_private(qp, op); ++#endif + session = get_session(qp, op); @@ -90 +93,2 @@ -@@ -1219,6 +1225,7 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, + op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION; +@@ -1362,6 +1368,7 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, @@ -92,2 +96,2 @@ - job->enc_keys = session->cipher.zuc_cipher_key; - job->dec_keys = session->cipher.zuc_cipher_key; + job->aes_enc_key_expanded = session->cipher.zuc_cipher_key; + job->aes_dec_key_expanded = session->cipher.zuc_cipher_key; @@ -98 +102 @@ -@@ -1276,9 +1283,6 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, +@@ -1418,9 +1425,6 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, @@ -101 +105 @@ - case IMB_AUTH_AES_CCM: + case AES_CCM: @@ -108 +112 @@ -@@ -1288,19 +1292,11 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, +@@ -1430,19 +1434,11 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, @@ -110,2 +114,2 @@ - case IMB_AUTH_AES_GMAC: - if (session->cipher.mode == IMB_CIPHER_GCM) { + case AES_GMAC: + if (session->cipher.mode == GCM) { @@ -128,2 +132 @@ -@@ -1310,43 +1306,97 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, - break; +@@ -1453,10 +1449,7 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, @@ -130,0 +134 @@ + #if IMB_VERSION(0, 54, 3) <= IMB_VERSION_NUM @@ -132,4 +136,2 @@ -- job->cipher_start_src_offset_in_bytes = -- op->sym->aead.data.offset; - job->hash_start_src_offset_in_bytes = - op->sym->aead.data.offset; +- job->cipher_start_src_offset_in_bytes = op->sym->aead.data.offset; + job->hash_start_src_offset_in_bytes = op->sym->aead.data.offset; @@ -141 +143 @@ - job->iv = rte_crypto_op_ctod_offset(op, uint8_t *, +@@ -1464,26 +1457,87 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, @@ -143,0 +146 @@ + #endif @@ -148,0 +152 @@ ++#if IMB_VERSION(0, 53, 3) <= IMB_VERSION_NUM @@ -151 +154,0 @@ -+ case IMB_AUTH_ZUC256_EIA3_BITLEN: @@ -157,2 +160,3 @@ -+ -+ job->hash_start_src_offset_in_bytes = auth_start_offset(op, + + job->hash_start_src_offset_in_bytes = auth_start_offset(op, +- session, oop); @@ -174,3 +178,2 @@ - - job->hash_start_src_offset_in_bytes = auth_start_offset(op, -- session, oop); ++ ++ job->hash_start_src_offset_in_bytes = auth_start_offset(op, @@ -184,0 +188 @@ ++#endif @@ -198,0 +203,5 @@ + #if IMB_VERSION(0, 53, 3) <= IMB_VERSION_NUM +- if (job->cipher_mode == IMB_CIPHER_ZUC_EEA3) +- job->msg_len_to_cipher_in_bytes >>= 3; +- else if (job->hash_alg == IMB_AUTH_KASUMI_UIA1) +- job->msg_len_to_hash_in_bytes >>= 3; @@ -214,2 +223,4 @@ -+ case IMB_CIPHER_CCM: -+ case IMB_CIPHER_GCM: ++#endif ++ case CCM: ++ case GCM: ++#if IMB_VERSION(0, 54, 3) <= IMB_VERSION_NUM @@ -216,0 +228 @@ + #endif @@ -226,6 +237,0 @@ -+ - if (job->cipher_mode == IMB_CIPHER_NULL && oop) { - memcpy(job->dst + job->cipher_start_src_offset_in_bytes, - job->src + job->cipher_start_src_offset_in_bytes, - job->msg_len_to_cipher_in_bytes); - } @@ -233,5 +238,0 @@ -- if (job->cipher_mode == IMB_CIPHER_ZUC_EEA3) -- job->msg_len_to_cipher_in_bytes >>= 3; -- else if (job->hash_alg == IMB_AUTH_KASUMI_UIA1) -- job->msg_len_to_hash_in_bytes >>= 3; -- @@ -240 +240,0 @@ -