From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, fiona.trahe@intel.com,
Arek Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [dpdk-dev] [PATCH v4 4/5] test/crypto: add sessionless to asymmetric mod exp
Date: Tue, 22 Oct 2019 16:04:28 +0200 [thread overview]
Message-ID: <20191022140429.9008-5-arkadiuszx.kusztal@intel.com> (raw)
In-Reply-To: <20191022140429.9008-1-arkadiuszx.kusztal@intel.com>
This commit adds asymmetric sessionless tests to mod exp.
Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
app/test/test_cryptodev_asym.c | 73 ++++++++++++++++++++++++++++--------------
1 file changed, 49 insertions(+), 24 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 6cc2f97..ea3005b 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -283,7 +283,7 @@ test_cryptodev_asym_ver(union test_case_structure *data_tc,
static int
test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params,
union test_case_structure *data_tc,
- char *test_msg)
+ char *test_msg, int sessionless)
{
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL;
@@ -382,27 +382,31 @@ test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params,
goto error_exit;
}
- sess = rte_cryptodev_asym_session_create(ts_params->session_mpool);
- if (!sess) {
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u "
- "FAILED: %s", __LINE__,
- "Session creation failed");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- if (rte_cryptodev_asym_session_init(dev_id, sess, &xform_tc,
- ts_params->session_mpool) < 0) {
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u FAILED: %s",
- __LINE__, "unabled to config sym session");
- status = TEST_FAILED;
- goto error_exit;
- }
+ if (!sessionless) {
+ sess = rte_cryptodev_asym_session_create(ts_params->session_mpool);
+ if (!sess) {
+ snprintf(test_msg, ASYM_TEST_MSG_LEN,
+ "line %u "
+ "FAILED: %s", __LINE__,
+ "Session creation failed");
+ status = TEST_FAILED;
+ goto error_exit;
+ }
- rte_crypto_op_attach_asym_session(op, sess);
+ if (rte_cryptodev_asym_session_init(dev_id, sess, &xform_tc,
+ ts_params->session_mpool) < 0) {
+ snprintf(test_msg, ASYM_TEST_MSG_LEN,
+ "line %u FAILED: %s",
+ __LINE__, "unabled to config sym session");
+ status = TEST_FAILED;
+ goto error_exit;
+ }
+ rte_crypto_op_attach_asym_session(op, sess);
+ } else {
+ asym_op->xform = &xform_tc;
+ op->sess_type = RTE_CRYPTO_OP_SESSIONLESS;
+ }
RTE_LOG(DEBUG, USER1, "Process ASYM operation");
/* Process crypto operation */
@@ -433,7 +437,10 @@ test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params,
goto error_exit;
}
- snprintf(test_msg, ASYM_TEST_MSG_LEN, "PASS");
+ if (!sessionless)
+ snprintf(test_msg, ASYM_TEST_MSG_LEN, "PASS");
+ else
+ snprintf(test_msg, ASYM_TEST_MSG_LEN, "SESSIONLESS PASS");
error_exit:
if (sess != NULL) {
@@ -451,7 +458,7 @@ test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params,
}
static int
-test_one_case(const void *test_case)
+test_one_case(const void *test_case, int sessionless)
{
int status = TEST_SUCCESS;
char test_msg[ASYM_TEST_MSG_LEN + 1];
@@ -460,7 +467,8 @@ test_one_case(const void *test_case)
union test_case_structure tc;
memcpy(&tc, test_case, sizeof(tc));
- status = test_cryptodev_asym_op(&testsuite_params, &tc, test_msg);
+ status = test_cryptodev_asym_op(&testsuite_params, &tc, test_msg,
+ sessionless);
printf(" %u) TestCase %s %s\n", test_index++,
tc.modex.description, test_msg);
@@ -501,14 +509,31 @@ static int
test_one_by_one(void)
{
int status = TEST_SUCCESS;
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
uint32_t i = 0;
+ uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_cryptodev_info dev_info;
+ int sessionless = 0;
+
+ rte_cryptodev_info_get(dev_id, &dev_info);
+ if ((dev_info.feature_flags &
+ RTE_CRYPTODEV_FF_ASYM_SESSIONLESS)) {
+ sessionless = 1;
+ }
/* Go through all test cases */
test_index = 0;
for (i = 0; i < test_vector.size; i++) {
- if (test_one_case(test_vector.address[i]) != TEST_SUCCESS)
+ if (test_one_case(test_vector.address[i], 0) != TEST_SUCCESS)
status = TEST_FAILED;
}
+ if (sessionless) {
+ for (i = 0; i < test_vector.size; i++) {
+ if (test_one_case(test_vector.address[i], 1)
+ != TEST_SUCCESS)
+ status = TEST_FAILED;
+ }
+ }
TEST_ASSERT_EQUAL(status, 0, "Test failed");
return status;
--
2.1.0
next prev parent reply other threads:[~2019-10-22 14:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 14:04 [dpdk-dev] [PATCH v4 0/5] Add session-less, RSA, RSA-CRT to QAT Arek Kusztal
2019-10-22 14:04 ` [dpdk-dev] [PATCH v4 1/5] crypto/qat: add sessionless implementation to asym pmd Arek Kusztal
2019-10-22 14:04 ` [dpdk-dev] [PATCH v4 2/5] crypto/qat: add rsa " Arek Kusztal
2019-10-22 14:04 ` [dpdk-dev] [PATCH v4 3/5] crypto/qat: add rsa crt " Arek Kusztal
2019-10-22 14:04 ` Arek Kusztal [this message]
2019-10-22 14:04 ` [dpdk-dev] [PATCH v4 5/5] test/crypto: add rsa tests to qat and openssl with no padding Arek Kusztal
2019-10-23 13:42 ` [dpdk-dev] [PATCH v4 0/5] Add session-less, RSA, RSA-CRT to QAT Akhil Goyal
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=20191022140429.9008-5-arkadiuszx.kusztal@intel.com \
--to=arkadiuszx.kusztal@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.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;
as well as URLs for NNTP newsgroup(s).