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 BD9ED4301F for ; Thu, 10 Aug 2023 02:07:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B73A640DD8; Thu, 10 Aug 2023 02:07:48 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2059.outbound.protection.outlook.com [40.107.102.59]) by mails.dpdk.org (Postfix) with ESMTP id 129CA406B6 for ; Thu, 10 Aug 2023 02:07:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hnraMPpF6rrthHVZNJljFtZAVJgyfRy0g8gf9RimFKgBBX228rI62kGYrQXNhR+zRz4m2WTJNc++KYn3G83xL5mwBw2f43AJKRTOC0PlvFOfYnHG2T6PEmORjTEq7vlQQi+m3Qz88Zef+Ui0Gd2v9kqKIIgcI/hhkRaCkQXh+6C933GVcPXEAjinCiq9AvKiORgflP6JGiy5x5kV+zhmS9BKv12JN8gJATPNiecmIPbWSVgRi4q6zMHwe/92Aoi48bNLBy9InwynIl9O+adNVT/5eYr/RsFEGHFQXGpKnjJtoteyh0BHFplzI+5B70e7NLcvTitL2tnfZu9Edo+2Qg== 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=Zd5YWoHbq9MbppgvctQxFOoZ/kL35sYmhCOYEZMCOE0=; b=ORSbb7KPhSfVe5HDYnucneKcUu0Ry1MmzgVUWWv2Z8HIArfVgKvOZFsy2ZHeiXthCGOAoC0GEbUEd93CmMcQEBVBDQuh1xKMiUNdQ42Hjfp88hxN8ZDCxMs3JxtTKZHwMUk4ZXnrCSDpWk2jaPk/Pxuf0VdfjFlVLhQEKDYiVc5fZ8FhqaZ1hp5lWoDSn399YfilPpHSH2pJcu+sdSB742NQG4B4+y25Nrb04IGGiRqzP4k01EfeEd4yqE2X8UmJsv6f3lOJZx4VGX5bjp/h6EePOT2kjI2+mEkFPEkzM+BKsIM3bwi+gTZj5MRBo0a5xpgoSh14aSrdgsWSRd1l0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.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 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=Zd5YWoHbq9MbppgvctQxFOoZ/kL35sYmhCOYEZMCOE0=; b=k7dpZgtonITczuyjhaFFK4pTy5HzHOyA551jM1Os0+uRlmSNEjwifcKMgEo+E339v+4tt5YFwPeCBDc3eC+pR4tyAcUvUhCoJDEEK4i9IoezOgYwOT6kvmWhsfIRHSr2WUvcDyk1VuewgubRU/MaKzZUMkdqklUSf+gUKncUmw3ag2BdvHJZ1NsEjqzcHnKvix5QxJOE2a4p7DSAlXkJn9caunwPJRiIoXOyY5dL5+LijcMrUBvRQtZS1frgDsLAISVU0WMHSgvZ+i0nbOpyhNTZicVrSKhC7I5hGIX+8i7BlZo6psTqf7GKr8T2MoTmcWeJFXZkrIyTlT0bKyUtgg== Received: from CH2PR07CA0002.namprd07.prod.outlook.com (2603:10b6:610:20::15) by LV8PR12MB9136.namprd12.prod.outlook.com (2603:10b6:408:18e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Thu, 10 Aug 2023 00:07:45 +0000 Received: from CY4PEPF0000E9D9.namprd05.prod.outlook.com (2603:10b6:610:20:cafe::4b) by CH2PR07CA0002.outlook.office365.com (2603:10b6:610:20::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28 via Frontend Transport; Thu, 10 Aug 2023 00:07:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CY4PEPF0000E9D9.mail.protection.outlook.com (10.167.241.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.20 via Frontend Transport; Thu, 10 Aug 2023 00:07:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 9 Aug 2023 17:07:33 -0700 Received: from nvidia.com (10.126.230.37) 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.37; Wed, 9 Aug 2023 17:07:31 -0700 From: Xueming Li To: Ciara Power CC: Arkadiusz Kusztal , dpdk stable Subject: patch 'crypto/qat: fix null algorithm digest placement' has been queued to stable release 22.11.3 Date: Thu, 10 Aug 2023 08:06:42 +0800 Message-ID: <20230810000717.2191-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230625063544.11183-1-xuemingl@nvidia.com> References: <20230625063544.11183-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] 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-TrafficTypeDiagnostic: CY4PEPF0000E9D9:EE_|LV8PR12MB9136:EE_ X-MS-Office365-Filtering-Correlation-Id: dbc00e43-e87c-4ef3-bdfc-08db9935d275 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4XOjPXMcFCAKy4ZYq+kdbX8qbgKQpl3iZGZkd3CblfwBiX27EYJw3fUquuRpInL9oOHo2oQJVD83iOs3WzCZC2kf+mW2ChB3uE0BqyTsQbZSL+BZ03GxSZCeLSTMX3dMVpGv9SkxV6AMjNmhA59EpEjFvHw9b0uKv1NsOqwQJlwh+j9JsYBg9ELdtseBl8KN2mqR/eaa6ilcWi20aQoHlr6kRVGeTyOM/HEW2roay4LwBT73KyMqoYfTfr8aBkNSTI/u4PUNWSxD7JNIUnBBW8QpUi3ajjkC/FfXxTkn3ovBwM3vDGM5/LiTVwTFqXXx7/JPheHlFjYHzTBBxd3TpEnLC78/9fOyj7DWgxGgS3vKJpSd7z07rcpIMf6Zw2PbOrPYHE//fv+hEFCGBZfg6f6NUElf4n2q2vA4BIWMM6S0vnvsFTAqgHosdi1yijMgN175iT2DpRAVGJbS5U+3jjvuzzGYvfgMWfL7t4WTxc0uyWFCr9UTn2Br8E3l1Ou1kFSF1zTL3s9LK1FO/e6/z/qaHPtPAT8z4kf1GKnPXaDg785Dm/Amvm1ZInCPOdxek1XE6wfh8ih07ENfawphjo+bAU0y+XcvvQV6eDl7obZlfsx/WKOaM71B9e3XRYiXzijGLMDWv8BYONzypNNt6lX51dc5erJOuuZ8b6nCZ4RVAreFETjwq6jyjvOTMx/lYHb7pdLCfMn624S0BVjT7+3vjZwFgC3ybyQyyQY00C6C6lja9kEglR8ldovohmzKnJiWswACuNEseuJytwIpsg== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(346002)(376002)(396003)(1800799006)(186006)(451199021)(82310400008)(40470700004)(36840700001)(46966006)(40460700003)(55016003)(40480700001)(6286002)(6916009)(70586007)(54906003)(70206006)(336012)(16526019)(53546011)(1076003)(26005)(6666004)(478600001)(36756003)(83380400001)(47076005)(426003)(2616005)(36860700001)(41300700001)(316002)(966005)(4326008)(7696005)(2906002)(86362001)(82740400003)(356005)(7636003)(8676002)(8936002)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2023 00:07:44.4899 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbc00e43-e87c-4ef3-bdfc-08db9935d275 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9136 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 22.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 08/11/23. 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=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=60c1ca4fdefaca36eecba34e7b15ba907426543f Thanks. Xueming Li --- >From 60c1ca4fdefaca36eecba34e7b15ba907426543f Mon Sep 17 00:00:00 2001 From: Ciara Power Date: Fri, 23 Jun 2023 13:51:04 +0000 Subject: [PATCH] crypto/qat: fix null algorithm digest placement Cc: Xueming Li [ upstream commit 8b4618a7b453dec02ca8ea40871fb124100f98f4 ] QAT HW generates bytes of 0x00 digest, even when a digest of len 0 is requested for NULL. This caused test failures when the test vector had digest len 0, as the buffer has unexpected changed bytes. By placing the digest into the cookie for NULL authentication, the buffer remains unchanged as expected, and the digest is placed to the side, as it won't be used anyway. Fixes: db0e952a5c01 ("crypto/qat: add NULL capability") Signed-off-by: Ciara Power Acked-by: Arkadiusz Kusztal --- drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 2 +- drivers/crypto/qat/dev/qat_crypto_pmd_gens.h | 18 ++++++++++++++---- drivers/crypto/qat/dev/qat_sym_pmd_gen1.c | 4 ++-- drivers/crypto/qat/qat_sym.c | 5 +++++ drivers/crypto/qat/qat_sym.h | 2 ++ 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c index 2a0ddab8af..1f6f63c831 100644 --- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c +++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c @@ -407,7 +407,7 @@ qat_sym_build_op_auth_gen3(void *in_op, struct qat_sym_session *ctx, rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req)); ofs.raw = qat_sym_convert_op_to_vec_auth(op, ctx, &in_sgl, &out_sgl, - NULL, &auth_iv, &digest); + NULL, &auth_iv, &digest, op_cookie); if (unlikely(ofs.raw == UINT64_MAX)) { op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; return -EINVAL; diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h index 092265631b..7972c7cfeb 100644 --- a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h +++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h @@ -290,7 +290,8 @@ qat_sym_convert_op_to_vec_auth(struct rte_crypto_op *op, struct rte_crypto_sgl *in_sgl, struct rte_crypto_sgl *out_sgl, struct rte_crypto_va_iova_ptr *cipher_iv __rte_unused, struct rte_crypto_va_iova_ptr *auth_iv, - struct rte_crypto_va_iova_ptr *digest) + struct rte_crypto_va_iova_ptr *digest, + struct qat_sym_op_cookie *cookie) { uint32_t auth_ofs = 0, auth_len = 0; int n_src, ret; @@ -355,7 +356,11 @@ qat_sym_convert_op_to_vec_auth(struct rte_crypto_op *op, out_sgl->num = 0; digest->va = (void *)op->sym->auth.digest.data; - digest->iova = op->sym->auth.digest.phys_addr; + + if (ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_NULL) + digest->iova = cookie->digest_null_phys_addr; + else + digest->iova = op->sym->auth.digest.phys_addr; return 0; } @@ -366,7 +371,8 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, struct rte_crypto_sgl *in_sgl, struct rte_crypto_sgl *out_sgl, struct rte_crypto_va_iova_ptr *cipher_iv, struct rte_crypto_va_iova_ptr *auth_iv_or_aad, - struct rte_crypto_va_iova_ptr *digest) + struct rte_crypto_va_iova_ptr *digest, + struct qat_sym_op_cookie *cookie) { union rte_crypto_sym_ofs ofs; uint32_t max_len = 0; @@ -390,7 +396,11 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, auth_iv_or_aad->iova = rte_crypto_op_ctophys_offset(op, ctx->auth_iv.offset); digest->va = (void *)op->sym->auth.digest.data; - digest->iova = op->sym->auth.digest.phys_addr; + + if (ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_NULL) + digest->iova = cookie->digest_null_phys_addr; + else + digest->iova = op->sym->auth.digest.phys_addr; ret = qat_cipher_is_len_in_bits(ctx, op); switch (ret) { diff --git a/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c b/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c index 91d5cfa71d..2709b0ab04 100644 --- a/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c +++ b/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c @@ -274,7 +274,7 @@ qat_sym_build_op_auth_gen1(void *in_op, struct qat_sym_session *ctx, rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req)); ofs.raw = qat_sym_convert_op_to_vec_auth(op, ctx, &in_sgl, &out_sgl, - NULL, &auth_iv, &digest); + NULL, &auth_iv, &digest, op_cookie); if (unlikely(ofs.raw == UINT64_MAX)) { op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; return -EINVAL; @@ -368,7 +368,7 @@ qat_sym_build_op_chain_gen1(void *in_op, struct qat_sym_session *ctx, rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req)); ofs.raw = qat_sym_convert_op_to_vec_chain(op, ctx, &in_sgl, &out_sgl, - &cipher_iv, &auth_iv, &digest); + &cipher_iv, &auth_iv, &digest, cookie); if (unlikely(ofs.raw == UINT64_MAX)) { op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; return -EINVAL; diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index 2450f042c8..18f99089e8 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -51,6 +51,11 @@ qat_sym_init_op_cookie(void *op_cookie) rte_mempool_virt2iova(cookie) + offsetof(struct qat_sym_op_cookie, opt.spc_gmac.cd_cipher); + + cookie->digest_null_phys_addr = + rte_mempool_virt2iova(cookie) + + offsetof(struct qat_sym_op_cookie, + digest_null); } static __rte_always_inline int diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h index 9a4251e08b..a45bddf848 100644 --- a/drivers/crypto/qat/qat_sym.h +++ b/drivers/crypto/qat/qat_sym.h @@ -116,6 +116,8 @@ struct qat_sym_op_cookie { phys_addr_t cd_phys_addr; } spc_gmac; } opt; + uint8_t digest_null[4]; + phys_addr_t digest_null_phys_addr; }; struct qat_sym_dp_ctx { -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-08-09 21:51:20.586620100 +0800 +++ 0093-crypto-qat-fix-null-algorithm-digest-placement.patch 2023-08-09 21:51:18.264352000 +0800 @@ -1 +1 @@ -From 8b4618a7b453dec02ca8ea40871fb124100f98f4 Mon Sep 17 00:00:00 2001 +From 60c1ca4fdefaca36eecba34e7b15ba907426543f Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 8b4618a7b453dec02ca8ea40871fb124100f98f4 ] @@ -15 +17,0 @@ -Cc: stable@dpdk.org @@ -28 +30 @@ -index aeca1db4b8..bc71665a50 100644 +index 2a0ddab8af..1f6f63c831 100644 @@ -31 +33 @@ -@@ -444,7 +444,7 @@ qat_sym_build_op_auth_gen3(void *in_op, struct qat_sym_session *ctx, +@@ -407,7 +407,7 @@ qat_sym_build_op_auth_gen3(void *in_op, struct qat_sym_session *ctx, @@ -41 +43 @@ -index 1bafeb4a53..cab7e214c0 100644 +index 092265631b..7972c7cfeb 100644 @@ -44 +46 @@ -@@ -300,7 +300,8 @@ qat_sym_convert_op_to_vec_auth(struct rte_crypto_op *op, +@@ -290,7 +290,8 @@ qat_sym_convert_op_to_vec_auth(struct rte_crypto_op *op, @@ -54 +56 @@ -@@ -365,7 +366,11 @@ qat_sym_convert_op_to_vec_auth(struct rte_crypto_op *op, +@@ -355,7 +356,11 @@ qat_sym_convert_op_to_vec_auth(struct rte_crypto_op *op, @@ -67 +69 @@ -@@ -376,7 +381,8 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, +@@ -366,7 +371,8 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, @@ -77 +79 @@ -@@ -401,7 +407,11 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, +@@ -390,7 +396,11 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, @@ -91 +93 @@ -index 580c245482..70938ba508 100644 +index 91d5cfa71d..2709b0ab04 100644 @@ -94 +96 @@ -@@ -278,7 +278,7 @@ qat_sym_build_op_auth_gen1(void *in_op, struct qat_sym_session *ctx, +@@ -274,7 +274,7 @@ qat_sym_build_op_auth_gen1(void *in_op, struct qat_sym_session *ctx, @@ -113 +115 @@ -index 5c3cdd8183..936c2615e4 100644 +index 2450f042c8..18f99089e8 100644 @@ -129 +131 @@ -index 193281cd91..d19cadde86 100644 +index 9a4251e08b..a45bddf848 100644 @@ -132 +134 @@ -@@ -113,6 +113,8 @@ struct qat_sym_op_cookie { +@@ -116,6 +116,8 @@ struct qat_sym_op_cookie {