DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ayuj Verma <ayverma@marvell.com>
To: "pablo.de.lara.guarch@intel.com" <pablo.de.lara.guarch@intel.com>
Cc: "fiona.trahe@intel.com" <fiona.trahe@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>, Shally Verma <shallyv@marvell.com>,
	Sunila Sahu <ssahu@marvell.com>,
	Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>,
	Arvind Desai <adesai@marvell.com>,
	Ayuj Verma <ayverma@marvell.com>
Subject: [dpdk-dev] [PATCH 3/3] test/crypto: check for rsa capa for op-type
Date: Wed, 6 Feb 2019 11:16:42 +0000	[thread overview]
Message-ID: <20190206111405.30860-4-ayverma@marvell.com> (raw)
In-Reply-To: <20190206111405.30860-1-ayverma@marvell.com>

Add a rsa xform capability check in test functions,
to check for supported sign and decrypt op_types

Signed-off-by: Ayuj Verma <ayverma@marvell.com>
Signed-off-by: Shally Verma <shallyv@marvell.com>
---
 test/test/test_cryptodev_asym.c | 47 +++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c
index 0f6fc5767..ae1c76db7 100644
--- a/test/test/test_cryptodev_asym.c
+++ b/test/test/test_cryptodev_asym.c
@@ -52,10 +52,33 @@ test_rsa_sign_verify(void)
 	struct rte_crypto_asym_op *asym_op = NULL;
 	struct rte_crypto_op *op = NULL, *result_op = NULL;
 	struct rte_cryptodev_asym_session *sess = NULL;
+	struct rte_cryptodev_asym_capability_idx cap_idx;
+	const struct rte_cryptodev_asymmetric_xform_capability *capability;
 	int status = TEST_SUCCESS;
 	uint8_t output_buf[TEST_DATA_SIZE] = {0};
 	uint8_t input_buf[TEST_DATA_SIZE] = {0};
 
+	/* check for RSA capability */
+	cap_idx.type = RTE_CRYPTO_ASYM_XFORM_RSA;
+	capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
+
+	if (!capability) {
+		RTE_LOG(ERR, USER1,
+				"RSA xform not supported\n");
+				return TEST_SKIPPED;
+	}
+
+	/* test case supports non-crt sign op only,
+	 * so check for it in capability
+	 */
+	if (!rte_cryptodev_asym_xform_capability_check_optype(
+		capability, RTE_CRYPTO_ASYM_OP_SIGN)) {
+		RTE_LOG(ERR, USER1,
+				"non-crt mode RTE_CRYPTO_ASYM_OP_SIGN "
+				"not supported\n");
+				return TEST_SKIPPED;
+		}
+
 	sess = rte_cryptodev_asym_session_create(sess_mpool);
 
 	if (!sess) {
@@ -186,9 +209,33 @@ test_rsa_enc_dec(void)
 	struct rte_crypto_asym_op *asym_op = NULL;
 	struct rte_crypto_op *op = NULL, *result_op = NULL;
 	struct rte_cryptodev_asym_session *sess = NULL;
+	struct rte_cryptodev_asym_capability_idx cap_idx;
+	const struct rte_cryptodev_asymmetric_xform_capability *capability;
 	int status = TEST_SUCCESS;
 	uint8_t input_buf[TEST_DATA_SIZE] = {0};
 
+	/* check for RSA capability */
+	cap_idx.type = RTE_CRYPTO_ASYM_XFORM_RSA;
+	capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
+
+	if (!capability) {
+		RTE_LOG(ERR, USER1,
+				"RSA xform not supported\n");
+				return TEST_SKIPPED;
+	}
+
+	/* test case supports non-crt decrypt op only,
+	 * so check for it in capability
+	 */
+	if (!rte_cryptodev_asym_xform_capability_check_optype(
+		capability, RTE_CRYPTO_ASYM_OP_DECRYPT)) {
+		RTE_LOG(ERR, USER1,
+				"non-crt mode RTE_CRYPTO_ASYM_OP_DECRYPT "
+				"not supported\n");
+				return TEST_SKIPPED;
+		}
+
+
 	sess = rte_cryptodev_asym_session_create(sess_mpool);
 
 	if (!sess) {
-- 
2.20.0

  parent reply	other threads:[~2019-02-06 11:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 11:16 [dpdk-dev] [PATCH 0/3] adding op-type crt sign and decrypt Ayuj Verma
2019-02-06 11:16 ` [dpdk-dev] [PATCH 1/3] lib/cryptodev: add crt sign and decrypt ops Ayuj Verma
2019-02-06 11:16 ` [dpdk-dev] [PATCH 2/3] crypto/openssl: update op-type mask with crt ops Ayuj Verma
2019-02-06 11:16 ` Ayuj Verma [this message]
2019-02-08  8:47 ` [dpdk-dev] [PATCH 0/3] adding op-type crt sign and decrypt Ayuj Verma
     [not found]   ` <348A99DA5F5B7549AA880327E580B435896EBE65@IRSMSX101.ger.corp.intel.com>
     [not found]     ` <DM6PR18MB29087B09817C8ABDF820CDE0AD640@DM6PR18MB2908.namprd18.prod.outlook.com>
     [not found]       ` <06EE24DD0B19E248B53F6DC8657831551B13B064@hasmsx109.ger.corp.intel.com>
2019-02-12  5:27         ` Shally Verma
2019-02-12 11:12           ` Kusztal, ArkadiuszX
2019-02-12 11:19             ` Shally Verma
2019-02-12 11:36               ` Kusztal, ArkadiuszX

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=20190206111405.30860-4-ayverma@marvell.com \
    --to=ayverma@marvell.com \
    --cc=adesai@marvell.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=kkotamarthy@marvell.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=shallyv@marvell.com \
    --cc=ssahu@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;
as well as URLs for NNTP newsgroup(s).