patch 'crypto/cnxk: fix minimal input normalization' has been queued to stable release 23.11.2
Xueming Li
xuemingl at nvidia.com
Mon Aug 12 14:48:18 CEST 2024
Hi,
FYI, your patch has been queued to stable release 23.11.2
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/14/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=fbb350108ffb8cc68c6bf96178f17d33fb7eaa3d
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From fbb350108ffb8cc68c6bf96178f17d33fb7eaa3d Mon Sep 17 00:00:00 2001
From: Gowrishankar Muthukrishnan <gmuthukrishn at marvell.com>
Date: Wed, 26 Jun 2024 15:48:18 +0530
Subject: [PATCH] crypto/cnxk: fix minimal input normalization
Cc: Xueming Li <xuemingl at nvidia.com>
[ 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 <gmuthukrishn at marvell.com>
---
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 a843d6b5ef..ef9cb5eb91 100644
--- a/drivers/crypto/cnxk/cnxk_ae.h
+++ b/drivers/crypto/cnxk/cnxk_ae.h
@@ -49,13 +49,22 @@ 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;
}
*data += i;
@@ -72,8 +81,8 @@ cnxk_ae_fill_modex_params(struct cnxk_ae_sess *sess,
uint8_t *exp = xform->modex.exponent.data;
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))
return -EINVAL;
@@ -288,7 +297,7 @@ cnxk_ae_modex_prep(struct rte_crypto_op *op, struct roc_ae_buf_ptr *meta_buf,
struct rte_crypto_mod_op_param mod_op;
uint64_t total_key_len;
union cpt_inst_w4 w4;
- uint32_t base_len;
+ size_t base_len;
uint32_t dlen;
uint8_t *dptr;
@@ -296,8 +305,11 @@ 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;
+ }
}
total_key_len = mod_len + exp_len;
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-08-12 20:44:03.280194139 +0800
+++ 0021-crypto-cnxk-fix-minimal-input-normalization.patch 2024-08-12 20:44:01.935069263 +0800
@@ -1 +1 @@
-From 42ebfb0380cfc5e7c82555648b2ce064a9f4a3ad Mon Sep 17 00:00:00 2001
+From fbb350108ffb8cc68c6bf96178f17d33fb7eaa3d Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 42ebfb0380cfc5e7c82555648b2ce064a9f4a3ad ]
@@ -9 +11,0 @@
-Cc: stable at dpdk.org
More information about the stable
mailing list