[dpdk-dev] [PATCH v3 3/4] app/test: check for key type ff in asym unit test

Ayuj Verma ayverma at marvell.com
Thu Mar 28 11:28:40 CET 2019


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

diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index a779e8f..539eda1 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -49,6 +49,7 @@ struct crypto_unittest_params {
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_cryptodev_info dev_info;
 	struct rte_crypto_asym_op *asym_op = NULL;
 	struct rte_crypto_op *op = NULL, *result_op = NULL;
 	struct rte_cryptodev_asym_session *sess = NULL;
@@ -56,6 +57,18 @@ struct crypto_unittest_params {
 	uint8_t output_buf[TEST_DATA_SIZE] = {0};
 	uint8_t input_buf[TEST_DATA_SIZE] = {0};
 
+	/* test case supports op with exponent key only,
+	 * Check in PMD feature flag for RSA exponent key type support.
+	 */
+	rte_cryptodev_info_get(dev_id, &dev_info);
+	if (!(dev_info.feature_flags &
+				RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP)) {
+		RTE_LOG(INFO, USER1,
+				"Device doesn't support sign op with "
+				"exponent key type. Test Skipped\n");
+		return TEST_SKIPPED;
+	}
+
 	sess = rte_cryptodev_asym_session_create(sess_mpool);
 
 	if (!sess) {
@@ -183,12 +196,25 @@ struct crypto_unittest_params {
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_cryptodev_info dev_info;
 	struct rte_crypto_asym_op *asym_op = NULL;
 	struct rte_crypto_op *op = NULL, *result_op = NULL;
 	struct rte_cryptodev_asym_session *sess = NULL;
 	int status = TEST_SUCCESS;
 	uint8_t input_buf[TEST_DATA_SIZE] = {0};
 
+	/* test case supports op with exponent key only,
+	 * Check in PMD feature flag for RSA exponent key type support.
+	 */
+	rte_cryptodev_info_get(dev_id, &dev_info);
+	if (!(dev_info.feature_flags &
+				RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP)) {
+		RTE_LOG(INFO, USER1,
+				"Device doesn't support sign op with "
+				"exponent key type. Test Skipped\n");
+		return TEST_SKIPPED;
+	}
+
 	sess = rte_cryptodev_asym_session_create(sess_mpool);
 
 	if (!sess) {
-- 
1.8.3.1



More information about the dev mailing list