From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>, Fan Zhang <fanzhang.oss@gmail.com>
Cc: Vidya Sagar Velumuri <vvelumuri@marvell.com>,
Anoob Joseph <anoobj@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 1/4] test/crypto: add asymmetric sessionless test case
Date: Tue, 16 Jun 2026 16:51:10 +0530 [thread overview]
Message-ID: <20260616112113.73680-2-ktejasree@marvell.com> (raw)
In-Reply-To: <20260616112113.73680-1-ktejasree@marvell.com>
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Add test for sessionless asymmetric operation
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
app/test/test_cryptodev_asym.c | 106 +++++++++++++++++++++++++++++++--
1 file changed, 100 insertions(+), 6 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index bf1a1fc417..e7cc5a79e2 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -558,6 +558,13 @@ testsuite_setup(void)
"Failed to configure cryptodev %u with %u qps",
dev_id, ts_params->conf.nb_queue_pairs);
+ ts_params->session_mpool = rte_cryptodev_asym_session_pool_create(
+ "test_asym_sess_mp", TEST_NUM_SESSIONS, 0, 0,
+ SOCKET_ID_ANY);
+
+ TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+ "session mempool allocation failed");
+
/* configure qp */
ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
@@ -569,12 +576,6 @@ testsuite_setup(void)
qp_id, dev_id);
}
- ts_params->session_mpool = rte_cryptodev_asym_session_pool_create(
- "test_asym_sess_mp", TEST_NUM_SESSIONS, 0, 0,
- SOCKET_ID_ANY);
-
- TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
- "session mempool allocation failed");
/* >8 End of device, op pool and session configuration for asymmetric crypto section. */
return TEST_SUCCESS;
}
@@ -1181,6 +1182,98 @@ test_mod_inv(void)
return status;
}
+static int
+test_mod_exp_sessionless(void)
+{
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+ const struct rte_cryptodev_asymmetric_xform_capability *capability;
+ struct rte_mempool *op_mpool = ts_params->op_mpool;
+ struct rte_crypto_op *op = NULL, *result_op = NULL;
+ struct rte_cryptodev_asym_capability_idx cap_idx;
+ uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_crypto_asym_op *asym_op = NULL;
+ uint8_t result[sizeof(mod_p)] = { 0 };
+ uint8_t input[TEST_DATA_SIZE] = {0};
+ struct rte_cryptodev_info info;
+ int status = TEST_SUCCESS;
+ int ret = 0;
+
+ rte_cryptodev_info_get(dev_id, &info);
+ if (!(info.feature_flags & RTE_CRYPTODEV_FF_ASYM_SESSIONLESS))
+ return TEST_SKIPPED;
+
+ if (rte_cryptodev_asym_get_xform_enum(&modex_xform.xform_type, "modexp") < 0) {
+ RTE_LOG(ERR, USER1, "Invalid ASYM algorithm specified\n");
+ return -1;
+ }
+
+ /* check for modlen capability */
+ cap_idx.type = modex_xform.xform_type;
+ capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
+
+ if (capability == NULL) {
+ RTE_LOG(INFO, USER1, "Device doesn't support MOD EXP. Test Skipped\n");
+ return TEST_SKIPPED;
+ }
+
+ if (rte_cryptodev_asym_xform_capability_check_modlen(capability,
+ modex_xform.modex.modulus.length)) {
+ RTE_LOG(ERR, USER1, "Unsupported MODULUS length specified\n");
+ return TEST_SKIPPED;
+ }
+
+ /* Create op and process packets. */
+ op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
+ if (!op) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Failed to allocate asymmetric crypto operation struct");
+ return TEST_FAILED;
+ }
+
+ asym_op = op->asym;
+ memcpy(input, base, sizeof(base));
+ asym_op->modex.base.data = input;
+ asym_op->modex.base.length = sizeof(base);
+ asym_op->modex.result.data = result;
+ asym_op->modex.result.length = sizeof(result);
+ asym_op->xform = &modex_xform;
+ op->sess_type = RTE_CRYPTO_OP_SESSIONLESS;
+
+ RTE_LOG(DEBUG, USER1, "Process ASYM operation");
+ /* Process crypto operation */
+ if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
+ RTE_LOG(ERR, USER1,
+ "line %u FAILED: %s",
+ __LINE__, "Error sending packet for operation");
+ status = TEST_FAILED;
+ goto error_exit;
+ }
+
+ while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
+ rte_pause();
+
+ if (result_op == NULL) {
+ RTE_LOG(ERR, USER1,
+ "line %u FAILED: %s",
+ __LINE__, "Failed to process asym crypto op");
+ status = TEST_FAILED;
+ goto error_exit;
+ }
+
+ ret = verify_modexp(mod_exp, result_op);
+ if (ret) {
+ RTE_LOG(ERR, USER1, "operation verification failed\n");
+ status = TEST_FAILED;
+ }
+
+error_exit:
+ rte_crypto_op_free(op);
+
+ TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+ return status;
+}
+
static int
test_mod_exp(void)
{
@@ -5309,6 +5402,7 @@ static struct unit_test_suite cryptodev_asym_mod_ex_testsuite = {
"Modular Exponentiation (mod=128, base=20, exp=3, res=128)",
ut_setup_asym, ut_teardown_asym,
modular_exponentiation, &modex_test_case_m128_b20_e3),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp_sessionless),
TEST_CASES_END()
}
};
--
2.34.1
next prev parent reply other threads:[~2026-06-16 11:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 11:21 [PATCH 0/4] test/crypto: update CN20K and sessionless coverage Tejasree Kondoj
2026-06-16 11:21 ` Tejasree Kondoj [this message]
2026-06-16 11:21 ` [PATCH 2/4] test/crypto: add asym autotest support for cn20k Tejasree Kondoj
2026-06-16 11:21 ` [PATCH 3/4] test/crypto: add " Tejasree Kondoj
2026-06-16 11:21 ` [PATCH 4/4] test/crypto: add unit test for Rx inject multi seg Tejasree Kondoj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260616112113.73680-2-ktejasree@marvell.com \
--to=ktejasree@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
--cc=vvelumuri@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox