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 68C2945804 for ; Fri, 23 Aug 2024 18:21:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 62C014337C; Fri, 23 Aug 2024 18:21:55 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 953EA4338D for ; Fri, 23 Aug 2024 18:21:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724430113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tMkhG564hBDVA5iqe6S2UJNln0fCmajAMrDNqQrSTfY=; b=AWiCLDNZGFQsPH2wq+P0rBcWNsy2H0FbErm3jWMHntysvvuPJfeK7xl2RxFKmY9C7Bd/dM jq725GRLmduEh8J+laQg/5goOLVgSpecTs/KUlmRg1n+iJG7RbgaVO+QLze+QxHZxuXaY8 /9dNUUHtedwtwg4BI+PdJK5HIoOuDlk= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-279-7qjLVhAkOD2ziAgCKKspYg-1; Fri, 23 Aug 2024 12:21:50 -0400 X-MC-Unique: 7qjLVhAkOD2ziAgCKKspYg-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D8C331955F45; Fri, 23 Aug 2024 16:21:49 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.193.224]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6F88E1956053; Fri, 23 Aug 2024 16:21:48 +0000 (UTC) From: Kevin Traynor To: Gowrishankar Muthukrishnan Cc: dpdk stable Subject: patch 'crypto/cnxk: fix minimal input normalization' has been queued to stable release 21.11.8 Date: Fri, 23 Aug 2024 17:18:09 +0100 Message-ID: <20240823161929.1004778-61-ktraynor@redhat.com> In-Reply-To: <20240823161929.1004778-1-ktraynor@redhat.com> References: <20240823161929.1004778-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.8 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/28/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://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/87bdd9a583f3a3a947cb505476eff31746a10911 Thanks. Kevin --- >From 87bdd9a583f3a3a947cb505476eff31746a10911 Mon Sep 17 00:00:00 2001 From: Gowrishankar Muthukrishnan Date: Wed, 26 Jun 2024 15:48:18 +0530 Subject: [PATCH] crypto/cnxk: fix minimal input normalization [ upstream commit 42ebfb0380cfc5e7c82555648b2ce064a9f4a3ad ] Fix modex to nomalize input only when MSW is zero. Fixes: 5a3513caeb45 ("crypto/cnxk: add asymmetric session") Signed-off-by: Gowrishankar Muthukrishnan --- drivers/crypto/cnxk/cnxk_ae.h | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h index 6222171fe6..16d67a8153 100644 --- a/drivers/crypto/cnxk/cnxk_ae.h +++ b/drivers/crypto/cnxk/cnxk_ae.h @@ -26,11 +26,20 @@ struct cnxk_ae_sess { static __rte_always_inline void -cnxk_ae_modex_param_normalize(uint8_t **data, size_t *len) +cnxk_ae_modex_param_normalize(uint8_t **data, size_t *len, size_t max) { + uint8_t msw_len = *len % 8; + uint64_t msw_val = 0; size_t i; - /* Strip leading NUL bytes */ - for (i = 0; i < *len; i++) { - if ((*data)[i] != 0) + if (*len <= 8) + return; + + memcpy(&msw_val, *data, msw_len); + if (msw_val != 0) + return; + + for (i = msw_len; i < *len && (*len - i) < max; i += 8) { + memcpy(&msw_val, &(*data)[i], 8); + if (msw_val != 0) break; } @@ -49,6 +58,6 @@ cnxk_ae_fill_modex_params(struct cnxk_ae_sess *sess, uint8_t *mod = xform->modex.modulus.data; - cnxk_ae_modex_param_normalize(&mod, &mod_len); - cnxk_ae_modex_param_normalize(&exp, &exp_len); + cnxk_ae_modex_param_normalize(&mod, &mod_len, SIZE_MAX); + cnxk_ae_modex_param_normalize(&exp, &exp_len, mod_len); if (unlikely(exp_len == 0 || mod_len == 0)) @@ -223,5 +232,5 @@ cnxk_ae_modex_prep(struct rte_crypto_op *op, struct roc_ae_buf_ptr *meta_buf, uint64_t total_key_len; union cpt_inst_w4 w4; - uint32_t base_len; + size_t base_len; uint32_t dlen; uint8_t *dptr; @@ -231,6 +240,9 @@ cnxk_ae_modex_prep(struct rte_crypto_op *op, struct roc_ae_buf_ptr *meta_buf, base_len = mod_op.base.length; if (unlikely(base_len > mod_len)) { - op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; - return -ENOTSUP; + cnxk_ae_modex_param_normalize(&mod_op.base.data, &base_len, mod_len); + if (base_len > mod_len) { + op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; + return -ENOTSUP; + } } -- 2.46.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-08-23 17:18:11.671036042 +0100 +++ 0061-crypto-cnxk-fix-minimal-input-normalization.patch 2024-08-23 17:18:09.724430119 +0100 @@ -1 +1 @@ -From 42ebfb0380cfc5e7c82555648b2ce064a9f4a3ad Mon Sep 17 00:00:00 2001 +From 87bdd9a583f3a3a947cb505476eff31746a10911 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 42ebfb0380cfc5e7c82555648b2ce064a9f4a3ad ] + @@ -9 +10,0 @@ -Cc: stable@dpdk.org @@ -17 +18 @@ -index a843d6b5ef..ef9cb5eb91 100644 +index 6222171fe6..16d67a8153 100644 @@ -20 +21 @@ -@@ -50,11 +50,20 @@ struct cnxk_ae_sess { +@@ -26,11 +26,20 @@ struct cnxk_ae_sess { @@ -45 +46 @@ -@@ -73,6 +82,6 @@ cnxk_ae_fill_modex_params(struct cnxk_ae_sess *sess, +@@ -49,6 +58,6 @@ cnxk_ae_fill_modex_params(struct cnxk_ae_sess *sess, @@ -54 +55 @@ -@@ -289,5 +298,5 @@ cnxk_ae_modex_prep(struct rte_crypto_op *op, struct roc_ae_buf_ptr *meta_buf, +@@ -223,5 +232,5 @@ cnxk_ae_modex_prep(struct rte_crypto_op *op, struct roc_ae_buf_ptr *meta_buf, @@ -61 +62 @@ -@@ -297,6 +306,9 @@ cnxk_ae_modex_prep(struct rte_crypto_op *op, struct roc_ae_buf_ptr *meta_buf, +@@ -231,6 +240,9 @@ cnxk_ae_modex_prep(struct rte_crypto_op *op, struct roc_ae_buf_ptr *meta_buf,