patch 'test/crypto: fix RSA decrypt validation' has been queued to stable release 22.11.9
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Mon Jun 30 14:25:48 CEST 2025
Hi,
FYI, your patch has been queued to stable release 22.11.9
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/02/25. 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/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/a7791e525b02ca0343549971ccf43ce8c4472a94
Thanks.
Luca Boccassi
---
>From a7791e525b02ca0343549971ccf43ce8c4472a94 Mon Sep 17 00:00:00 2001
From: Gowrishankar Muthukrishnan <gmuthukrishn at marvell.com>
Date: Fri, 20 Jun 2025 13:49:18 +0530
Subject: [PATCH] test/crypto: fix RSA decrypt validation
[ upstream commit 9af3fa536ec23d254d15fea4ec0e58442e56409e ]
Following RSA encrypt op, same plaintext buffer is used as output
buffer for decrypt op, hence comparing plaintext buffer against
same buffer pointer in crypto op always succeed irrespective of
whether decrypt op succeeds or not. This patch fixes this issue
with a local buffer for crypto op.
Fixes: 5ae36995f10f ("test/crypto: move RSA enqueue/dequeue into functions")
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn at marvell.com>
---
app/test/test_cryptodev_asym.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 4c86a2bcec..cce7b48626 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -168,7 +168,10 @@ queue_ops_rsa_enc_dec(void *sess)
struct rte_crypto_op *op, *result_op;
struct rte_crypto_asym_op *asym_op;
uint8_t cipher_buf[TEST_DATA_SIZE] = {0};
- int ret, status = TEST_SUCCESS;
+ uint8_t msg_buf[TEST_DATA_SIZE] = {0};
+ int ret, status;
+
+ memcpy(msg_buf, rsaplaintext.data, rsaplaintext.len);
/* Set up crypto op data structure */
op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
@@ -183,7 +186,7 @@ queue_ops_rsa_enc_dec(void *sess)
/* Compute encryption on the test vector */
asym_op->rsa.op_type = RTE_CRYPTO_ASYM_OP_ENCRYPT;
- asym_op->rsa.message.data = rsaplaintext.data;
+ asym_op->rsa.message.data = msg_buf;
asym_op->rsa.cipher.data = cipher_buf;
asym_op->rsa.cipher.length = 0;
asym_op->rsa.message.length = rsaplaintext.len;
@@ -220,6 +223,7 @@ queue_ops_rsa_enc_dec(void *sess)
asym_op->rsa.message.length = 0;
asym_op->rsa.op_type = RTE_CRYPTO_ASYM_OP_DECRYPT;
asym_op->rsa.padding.type = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
+ memset(asym_op->rsa.message.data, 0, asym_op->rsa.message.length);
/* Process crypto operation */
if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
@@ -236,11 +240,20 @@ queue_ops_rsa_enc_dec(void *sess)
status = TEST_FAILED;
goto error_exit;
}
- status = TEST_SUCCESS;
+
+ if (result_op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
+ RTE_LOG(ERR, USER1, "Expected crypto op to succeed\n");
+ status = TEST_FAILED;
+ goto error_exit;
+ }
+
ret = rsa_verify(&rsaplaintext, result_op);
- if (ret)
+ if (ret) {
status = TEST_FAILED;
+ goto error_exit;
+ }
+ status = TEST_SUCCESS;
error_exit:
rte_crypto_op_free(op);
--
2.47.2
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2025-06-30 13:21:22.441684225 +0100
+++ 0018-test-crypto-fix-RSA-decrypt-validation.patch 2025-06-30 13:21:21.759057628 +0100
@@ -1 +1 @@
-From 9af3fa536ec23d254d15fea4ec0e58442e56409e Mon Sep 17 00:00:00 2001
+From a7791e525b02ca0343549971ccf43ce8c4472a94 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 9af3fa536ec23d254d15fea4ec0e58442e56409e ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
-index 87c26322d0..20afb5e98b 100644
+index 4c86a2bcec..cce7b48626 100644
@@ -24 +25 @@
-@@ -175,7 +175,10 @@ queue_ops_rsa_enc_dec(void *sess)
+@@ -168,7 +168,10 @@ queue_ops_rsa_enc_dec(void *sess)
@@ -36 +37 @@
-@@ -190,7 +193,7 @@ queue_ops_rsa_enc_dec(void *sess)
+@@ -183,7 +186,7 @@ queue_ops_rsa_enc_dec(void *sess)
@@ -43 +44 @@
- asym_op->rsa.cipher.length = RTE_DIM(rsa_n);
+ asym_op->rsa.cipher.length = 0;
@@ -45,3 +46,2 @@
-@@ -225,6 +228,7 @@ queue_ops_rsa_enc_dec(void *sess)
- asym_op = result_op->asym;
- asym_op->rsa.message.length = RTE_DIM(rsa_n);
+@@ -220,6 +223,7 @@ queue_ops_rsa_enc_dec(void *sess)
+ asym_op->rsa.message.length = 0;
@@ -48,0 +49 @@
+ asym_op->rsa.padding.type = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
@@ -53 +54 @@
-@@ -241,11 +245,20 @@ queue_ops_rsa_enc_dec(void *sess)
+@@ -236,11 +240,20 @@ queue_ops_rsa_enc_dec(void *sess)
More information about the stable
mailing list