DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/test: random test vectors for Asymc RSA
@ 2022-08-17 10:57 Przemyslaw Zegan
  2022-08-17 14:14 ` [dpdk-dev v2] " Przemyslaw Zegan
  0 siblings, 1 reply; 3+ messages in thread
From: Przemyslaw Zegan @ 2022-08-17 10:57 UTC (permalink / raw)
  To: dev; +Cc: gakhil, roy.fan.zhang, Przemyslaw Zegan

This patch add random test vectors generator for asymc RSA algorithm,
base on OpenSSL 1.1.x lib.

Added functions for create RSA test vectors base on defined rules.
The randome generated test vector include plaintext, RSA key in exponent
and quintuple format, digest and expected cipher and sign.

Replace crypto_testsuite_params_asym struct from test_cryptodev_asym.c
to test_cryptodev_asym_types.h, as it's used in other test suit.

Description of new files:
test_cryptodev_asym_creator.c: generator for random plaintext
test_cryptodev_asym_rsa_creator.c: RSA vector generator
test_cryptodev_asym_rsa_creator.c RSA test suite
test_cryptodev_asym_vectors.c: memory allocator for vectors

Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
---
 app/test/meson.build                         |   5 +
 app/test/test_cryptodev_asym.c               |  63 ++--
 app/test/test_cryptodev_asym_common.c        | 117 +++++++
 app/test/test_cryptodev_asym_common.h        |  49 +++
 app/test/test_cryptodev_asym_creator.c       |  41 +++
 app/test/test_cryptodev_asym_creator.h       |  13 +
 app/test/test_cryptodev_asym_rsa.c           | 308 +++++++++++++++++++
 app/test/test_cryptodev_asym_rsa.h           |  17 +
 app/test/test_cryptodev_asym_rsa_creator.c   | 144 +++++++++
 app/test/test_cryptodev_asym_rsa_creator.h   |  15 +
 app/test/test_cryptodev_asym_types.h         |  20 ++
 app/test/test_cryptodev_asym_vectors.c       |  29 ++
 app/test/test_cryptodev_asym_vectors.h       |  18 ++
 app/test/test_cryptodev_asym_vectors_def.h   | 135 ++++++++
 app/test/test_cryptodev_asym_vectors_rules.h |  43 +++
 lib/cryptodev/rte_crypto_asym.h              |   1 +
 16 files changed, 984 insertions(+), 34 deletions(-)
 create mode 100644 app/test/test_cryptodev_asym_common.c
 create mode 100644 app/test/test_cryptodev_asym_common.h
 create mode 100644 app/test/test_cryptodev_asym_creator.c
 create mode 100644 app/test/test_cryptodev_asym_creator.h
 create mode 100644 app/test/test_cryptodev_asym_rsa.c
 create mode 100644 app/test/test_cryptodev_asym_rsa.h
 create mode 100644 app/test/test_cryptodev_asym_rsa_creator.c
 create mode 100644 app/test/test_cryptodev_asym_rsa_creator.h
 create mode 100644 app/test/test_cryptodev_asym_types.h
 create mode 100644 app/test/test_cryptodev_asym_vectors.c
 create mode 100644 app/test/test_cryptodev_asym_vectors.h
 create mode 100644 app/test/test_cryptodev_asym_vectors_def.h
 create mode 100644 app/test/test_cryptodev_asym_vectors_rules.h

diff --git a/app/test/meson.build b/app/test/meson.build
index 431c5bd318..8dc5a3e516 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -146,6 +146,11 @@ test_sources = files(
         'test_trace_perf.c',
         'test_version.c',
         'virtual_pmd.c',
+        'test_cryptodev_asym_common.c',
+        'test_cryptodev_asym_vectors.c',
+        'test_cryptodev_asym_rsa.c',
+        'test_cryptodev_asym_rsa_creator.c',
+        'test_cryptodev_asym_creator.c'
 )
 
 test_deps = enabled_libs
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index fc1a727472..b692af3760 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -23,6 +23,8 @@
 #include "test_cryptodev_rsa_test_vectors.h"
 #include "test_cryptodev_asym_util.h"
 #include "test.h"
+#include "test_cryptodev_asym_types.h"
+#include "test_cryptodev_asym_rsa.h"
 
 #define TEST_NUM_BUFS 10
 #define TEST_NUM_SESSIONS 4
@@ -34,14 +36,6 @@
 #define TEST_VECTOR_SIZE 256
 
 static int gbl_driver_id;
-struct crypto_testsuite_params_asym {
-	struct rte_mempool *op_mpool;
-	struct rte_mempool *session_mpool;
-	struct rte_cryptodev_config conf;
-	struct rte_cryptodev_qp_conf qp_conf;
-	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
-	uint8_t valid_dev_count;
-};
 
 struct crypto_unittest_params {
 	void *sess;
@@ -62,12 +56,12 @@ static struct test_cases_array test_vector = {0, { NULL } };
 
 static uint32_t test_index;
 
-static struct crypto_testsuite_params_asym testsuite_params = { NULL };
+struct crypto_testsuite_params_asym testsuite_params_asym = { NULL };
 
 static int
 queue_ops_rsa_sign_verify(void *sess)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_crypto_op *op, *result_op;
@@ -158,7 +152,7 @@ queue_ops_rsa_sign_verify(void *sess)
 static int
 queue_ops_rsa_enc_dec(void *sess)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_crypto_op *op, *result_op;
@@ -524,7 +518,7 @@ test_one_case(const void *test_case, int sessionless)
 
 	if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_MODEX
 			|| tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_MODINV) {
-		status = test_cryptodev_asym_op(&testsuite_params, &tc, test_msg,
+		status = test_cryptodev_asym_op(&testsuite_params_asym, &tc, test_msg,
 				sessionless, 0, 0);
 		printf("  %u) TestCase %s %s\n", test_index++,
 			tc.modex.description, test_msg);
@@ -534,7 +528,7 @@ test_one_case(const void *test_case, int sessionless)
 				if (tc.rsa_data.op_type_flags & (1 << i)) {
 					if (tc.rsa_data.key_exp) {
 						status = test_cryptodev_asym_op(
-							&testsuite_params, &tc,
+							&testsuite_params_asym, &tc,
 							test_msg, sessionless, i,
 							RTE_RSA_KEY_TYPE_EXP);
 					}
@@ -544,7 +538,7 @@ test_one_case(const void *test_case, int sessionless)
 							RTE_CRYPTO_ASYM_OP_DECRYPT ||
 							i == RTE_CRYPTO_ASYM_OP_SIGN)) {
 						status = test_cryptodev_asym_op(
-							&testsuite_params,
+							&testsuite_params_asym,
 							&tc, test_msg, sessionless, i,
 							RTE_RSA_KEY_TYPE_QT);
 					}
@@ -604,7 +598,7 @@ static int
 test_one_by_one(void)
 {
 	int status = TEST_SUCCESS;
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	uint32_t i = 0;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_info dev_info;
@@ -637,7 +631,7 @@ test_one_by_one(void)
 static int
 test_rsa_sign_verify(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	void *sess = NULL;
@@ -677,7 +671,7 @@ test_rsa_sign_verify(void)
 static int
 test_rsa_enc_dec(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	void *sess = NULL;
@@ -717,7 +711,7 @@ test_rsa_enc_dec(void)
 static int
 test_rsa_sign_verify_crt(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	void *sess = NULL;
@@ -757,7 +751,7 @@ test_rsa_sign_verify_crt(void)
 static int
 test_rsa_enc_dec_crt(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	void *sess = NULL;
@@ -797,7 +791,7 @@ test_rsa_enc_dec_crt(void)
 static int
 testsuite_setup(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
 	struct rte_cryptodev_info info;
 	int ret, dev_id = -1;
@@ -902,7 +896,7 @@ testsuite_setup(void)
 static void
 testsuite_teardown(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 
 	if (ts_params->op_mpool != NULL) {
 		RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
@@ -919,7 +913,7 @@ testsuite_teardown(void)
 static int
 ut_setup_asym(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 
 	uint16_t qp_id;
 
@@ -953,7 +947,7 @@ ut_setup_asym(void)
 static void
 ut_teardown_asym(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_cryptodev_stats stats;
 
 	rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats);
@@ -1002,7 +996,7 @@ static inline void print_asym_capa(
 static int
 test_capability(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_info dev_info;
 	const struct rte_cryptodev_capabilities *dev_capa;
@@ -1039,7 +1033,7 @@ test_capability(void)
 static int
 test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1121,7 +1115,7 @@ test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
 static int
 test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1201,7 +1195,7 @@ test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
 static int
 test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1289,7 +1283,7 @@ test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
 static int
 test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1375,7 +1369,7 @@ test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
 static int
 test_mod_inv(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1487,7 +1481,7 @@ test_mod_inv(void)
 static int
 test_mod_exp(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1635,7 +1629,7 @@ test_dh_keygenration(void)
 static int
 test_dsa_sign(struct rte_crypto_dsa_op_param *dsa_op)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1718,7 +1712,7 @@ test_dsa_sign(struct rte_crypto_dsa_op_param *dsa_op)
 static int
 test_dsa_verify(struct rte_crypto_dsa_op_param *dsa_op)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1831,7 +1825,7 @@ test_dsa(void)
 static int
 test_ecdsa_sign_verify(enum curve curve_id)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct crypto_testsuite_ecdsa_params input_params;
@@ -2032,7 +2026,7 @@ test_ecdsa_sign_verify_all_curve(void)
 static int
 test_ecpm(enum curve curve_id)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct crypto_testsuite_ecpm_params input_params;
@@ -2219,6 +2213,7 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite  = {
 	.teardown = testsuite_teardown,
 	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
+		TEST_CASE_ST(ats_rsa_setup, ats_rsa_teardown, ats_rsa_run),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
diff --git a/app/test/test_cryptodev_asym_common.c b/app/test/test_cryptodev_asym_common.c
new file mode 100644
index 0000000000..c35a04e4e6
--- /dev/null
+++ b/app/test/test_cryptodev_asym_common.c
@@ -0,0 +1,117 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include <stdint.h>
+
+#include "test_cryptodev_asym_common.h"
+#include "test.h"
+#include "test_cryptodev.h"
+
+int ats_common_setup(struct crypto_testsuite_params_asym* ts)
+{
+	uint16_t qp_id;
+
+	/* Reconfigure device to default parameters */
+	ts->conf.socket_id = SOCKET_ID_ANY;
+
+	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts->valid_devs[0],
+			&ts->conf),
+			"Failed to configure cryptodev %u",
+			ts->valid_devs[0]);
+
+	for (qp_id = 0; qp_id < ts->conf.nb_queue_pairs ; qp_id++) {
+		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
+			ts->valid_devs[0], qp_id,
+			&ts->qp_conf,
+			rte_cryptodev_socket_id(ts->valid_devs[0])),
+			"Failed to setup queue pair %u on cryptodev %u",
+			qp_id, ts->valid_devs[0]);
+	}
+
+	rte_cryptodev_stats_reset(ts->valid_devs[0]);
+
+	/* Start the device */
+	TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts->valid_devs[0]),
+						"Failed to start cryptodev %u",
+						ts->valid_devs[0]);
+
+	return TEST_SUCCESS;
+}
+
+void ats_common_teardown(struct crypto_testsuite_params_asym* ts)
+{
+	struct rte_cryptodev_stats stats;
+
+	rte_cryptodev_stats_get(ts->valid_devs[0], &stats);
+
+	rte_cryptodev_stop(ts->valid_devs[0]);
+}
+
+void ats_err_msg_cap(void)
+{
+	RTE_LOG(INFO, USER1, "Device doesn't support MODEX. Test Skipped\n");
+}
+
+void ats_err_msg_op(char* msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Failed to allocate asymmetric crypto operation struct");
+}
+
+void ats_err_msg_mod_len(char* msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Invalid MODULUS length specified");
+}
+
+void ats_err_msg_inv_alg(char* msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Invalid ASYM algorithm specified");
+}
+
+void ats_err_msg_sess_create(char* msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Session creation failed");
+}
+
+void ats_err_msg_sess_init(char* msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"unabled to config sym session");
+}
+
+void ats_err_msg_enque(char* msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Error sending packet for operation");
+}
+
+void ats_err_msg_burst(char* msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Error sending packet for operation");
+}
+
+void ats_err_msg_deq(char* msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Failed to process asym crypto op");
+}
+
+void ats_err_msg_ver(char* msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+			"line %u FAILED: %s", line,
+			"Verification failed ");
+}
diff --git a/app/test/test_cryptodev_asym_common.h b/app/test/test_cryptodev_asym_common.h
new file mode 100644
index 0000000000..5120888a0a
--- /dev/null
+++ b/app/test/test_cryptodev_asym_common.h
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_COMMON_H_
+#define TEST_CRYPTODEV_ASYM_COMMON_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+
+#include <rte_bus_vdev.h>
+#include <rte_common.h>
+#include <rte_hexdump.h>
+#include <rte_mbuf.h>
+#include <rte_malloc.h>
+#include <rte_memcpy.h>
+#include <rte_pause.h>
+
+#include <rte_cryptodev.h>
+#include <rte_crypto.h>
+
+#include "test_cryptodev_asym_types.h"
+
+int ats_common_setup(struct crypto_testsuite_params_asym* ts);
+
+void ats_common_teardown(struct crypto_testsuite_params_asym* ts);
+
+void ats_err_msg_cap(void);
+
+void ats_err_msg_op(char* msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_mod_len(char* msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_inv_alg(char* msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_sess_create(char* msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_sess_init(char* msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_enque(char* msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_burst(char* msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_deq(char* msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_ver(char* msg, uint32_t len, uint32_t line);
+
+
+#endif /* TEST_CRYPTODEV_ASYM_COMMON_H_ */
diff --git a/app/test/test_cryptodev_asym_creator.c b/app/test/test_cryptodev_asym_creator.c
new file mode 100644
index 0000000000..4af791bfad
--- /dev/null
+++ b/app/test/test_cryptodev_asym_creator.c
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <sys/time.h>
+
+#include <openssl/bn.h>
+#include <openssl/rand.h>
+
+#include "test_cryptodev_asym_creator.h"
+
+int atv_create_data(uint8_t* data, int len) {
+	struct timespec ts;
+	struct timeval tv;
+	int i;
+
+	ts.tv_sec = 0;
+	ts.tv_nsec = 10000000;
+	nanosleep(&ts, NULL);
+
+	gettimeofday(&tv, NULL);
+	int seed = 1000000 * tv.tv_sec + tv.tv_usec;
+
+	srand(seed);
+
+	memset(data, 0, len);
+
+	int* dt = (int*) data;
+	int ln = len / sizeof(int);
+
+	for (i = 0; i < ln; i++)
+		dt[i] = rand();
+
+	return 0;
+}
+
diff --git a/app/test/test_cryptodev_asym_creator.h b/app/test/test_cryptodev_asym_creator.h
new file mode 100644
index 0000000000..c3b4cf6780
--- /dev/null
+++ b/app/test/test_cryptodev_asym_creator.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_CREATOR_H_
+#define TEST_CRYPTODEV_ASYM_CREATOR_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+
+int atv_create_data(uint8_t* data, int len);
+
+#endif /* TEST_CRYPTODEV_ASYM_CREATOR_H_ */
diff --git a/app/test/test_cryptodev_asym_rsa.c b/app/test/test_cryptodev_asym_rsa.c
new file mode 100644
index 0000000000..77c40df6af
--- /dev/null
+++ b/app/test/test_cryptodev_asym_rsa.c
@@ -0,0 +1,308 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include "test_cryptodev_asym_common.h"
+#include "test_cryptodev_asym_rsa.h"
+#include "test_cryptodev_asym_vectors.h"
+
+#include "test.h"
+#include "test_cryptodev.h"
+#include "test_cryptodev_asym_types.h"
+#include "test_cryptodev_asym_vectors.h"
+
+#define ASYM_TEST_MSG_LEN 256
+#define TEST_DATA_SIZE 4096
+
+struct crypto_unittest_params {
+	struct rte_cryptodev_asym_session *sess;
+	struct rte_crypto_op *op;
+};
+
+static struct asym_test_rsa_vct* vct = NULL;
+static int vct_nb = 0;
+
+extern struct crypto_testsuite_params_asym testsuite_params_asym;
+
+int ats_rsa_setup(void)
+{
+	vct = atv_rsa(&vct_nb);
+
+	int status = ats_common_setup(&testsuite_params_asym);
+
+	return status;
+}
+
+void ats_rsa_teardown(void)
+{
+	atv_free(vct);
+
+	ats_common_teardown(&testsuite_params_asym);
+}
+
+static int ats_case_rsa_op(struct crypto_testsuite_params_asym *ts_params,
+		struct asym_test_rsa_vct *data_tc,
+		char *test_msg, int sessionless, enum rte_crypto_asym_op_type op_type,
+		enum rte_crypto_rsa_priv_key_type key_type)
+{
+	struct rte_crypto_asym_op *asym_op = NULL;
+	struct rte_crypto_op *op = NULL;
+	struct rte_crypto_op *result_op = NULL;
+	struct rte_crypto_asym_xform xform_tc;
+	void *sess = NULL;
+	struct rte_cryptodev_asym_capability_idx cap_idx;
+	const struct rte_cryptodev_asymmetric_xform_capability *capability;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	uint8_t *result = NULL;
+	uint8_t *data_expected = NULL, *data_received = NULL;
+	size_t data_size = 0;
+
+	int ret, status = TEST_SUCCESS;
+
+	xform_tc.next = NULL;
+	xform_tc.xform_type = data_tc->xform_type;
+
+	cap_idx.type = xform_tc.xform_type;
+	capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
+
+	if (capability == NULL) {
+		ats_err_msg_cap();
+		return TEST_SKIPPED;
+	}
+
+	/* Generate crypto op data structure */
+	op = rte_crypto_op_alloc(ts_params->op_mpool,
+		RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
+
+	if (!op) {
+		ats_err_msg_op(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+	asym_op = op->asym;
+
+	switch (xform_tc.xform_type) {
+	case RTE_CRYPTO_ASYM_XFORM_RSA:
+		result = rte_zmalloc(NULL, data_tc->n.len, 0);
+		op->asym->rsa.op_type 	= op_type;
+		xform_tc.rsa.e.data 	= data_tc->e.data;
+		xform_tc.rsa.e.length 	= data_tc->e.len;
+		xform_tc.rsa.n.data 	= data_tc->n.data;
+		xform_tc.rsa.n.length 	= data_tc->n.len;
+
+		if (key_type == RTE_RSA_KEY_TYPE_EXP) {
+			xform_tc.rsa.d.data 		= data_tc->d.data;
+			xform_tc.rsa.d.length 		= data_tc->d.len;
+		} else {
+			xform_tc.rsa.qt.p.data 		= data_tc->p.data;
+			xform_tc.rsa.qt.p.length 	= data_tc->p.len;
+			xform_tc.rsa.qt.q.data 		= data_tc->q.data;
+			xform_tc.rsa.qt.q.length 	= data_tc->q.len;
+			xform_tc.rsa.qt.dP.data 	= data_tc->dP.data;
+			xform_tc.rsa.qt.dP.length 	= data_tc->dP.len;
+			xform_tc.rsa.qt.dQ.data 	= data_tc->dQ.data;
+			xform_tc.rsa.qt.dQ.length 	= data_tc->dQ.len;
+			xform_tc.rsa.qt.qInv.data 	= data_tc->qInv.data;
+			xform_tc.rsa.qt.qInv.length	= data_tc->qInv.len;
+		}
+
+		xform_tc.rsa.key_type = key_type;
+		op->asym->rsa.padding.type = data_tc->padding;
+
+		if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_ENCRYPT) {
+			asym_op->rsa.message.data = data_tc->pt.data;
+			asym_op->rsa.message.length = data_tc->pt.len;
+			asym_op->rsa.cipher.data = result;
+			asym_op->rsa.cipher.length = data_tc->n.len;
+		} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_DECRYPT) {
+			asym_op->rsa.message.data = result;
+			asym_op->rsa.message.length = 0;
+			asym_op->rsa.cipher.data = data_tc->ct.data;
+			asym_op->rsa.cipher.length = data_tc->ct.len;
+		} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_SIGN) {
+			asym_op->rsa.sign.data = result;
+			asym_op->rsa.sign.length = data_tc->n.len;
+			asym_op->rsa.message.data = data_tc->digest.data;
+			asym_op->rsa.message.length = data_tc->digest.len;
+		} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_VERIFY) {
+			asym_op->rsa.cipher.data = result;
+			asym_op->rsa.cipher.length = data_tc->n.len;
+			asym_op->rsa.sign.data = data_tc->sign.data;
+			asym_op->rsa.sign.length = data_tc->sign.len;
+		}
+		break;
+
+	default:
+		ats_err_msg_inv_alg(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+	if (!sessionless) {
+		ret = rte_cryptodev_asym_session_create(dev_id, &xform_tc,
+				ts_params->session_mpool, &sess);
+		if (ret < 0) {
+			ats_err_msg_sess_create(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+			status = (ret == -ENOTSUP) ? TEST_SKIPPED : 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 */
+	if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
+		ats_err_msg_enque(test_msg, ASYM_TEST_MSG_LEN,  __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+	while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
+		rte_pause();
+
+	if (result_op == NULL) {
+		ats_err_msg_deq(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+	if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_ENCRYPT) {
+		data_size = xform_tc.rsa.n.length;
+		data_received = result_op->asym->rsa.cipher.data;
+		data_expected = data_tc->ct.data;
+	} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_DECRYPT) {
+		data_size = xform_tc.rsa.n.length;
+		data_expected = data_tc->pt.data;
+		data_received = result_op->asym->rsa.message.data;
+	} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_SIGN) {
+		data_size = xform_tc.rsa.n.length;
+		data_expected = data_tc->sign.data;
+		data_received = result_op->asym->rsa.sign.data;
+	} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_VERIFY) {
+		data_size = xform_tc.rsa.n.length;
+		data_expected = data_tc->digest.data;
+		data_received = result_op->asym->rsa.cipher.data;
+	}
+
+	if ((memcmp(data_expected, data_received, data_size) != 0) || (data_size == 0)) {
+		ats_err_msg_ver(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+error_exit:
+		if (sess != NULL) {
+			rte_cryptodev_asym_session_free(dev_id, sess);
+		}
+
+		if (op != NULL)
+			rte_crypto_op_free(op);
+
+		if (result != NULL)
+			rte_free(result);
+
+	return status;
+}
+
+int ats_rsa_run(void)
+{
+	int status = TEST_SUCCESS;
+	int i, key_type;
+	char test_msg[ASYM_TEST_MSG_LEN + 1];
+	int sessionless = 0;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_cryptodev_info dev_info;
+
+	rte_cryptodev_info_get(dev_id, &dev_info);
+	if ((dev_info.feature_flags &
+			RTE_CRYPTODEV_FF_ASYM_SESSIONLESS)) {
+		sessionless = 1;
+	}
+
+	for (i = 0; i < vct_nb; i++) {
+
+		printf("\n  %u) TestSubCase %s - %s\n", i + 1, vct[i].description, test_msg);
+		debug_hexdump(stdout, "plaintext:", vct[i].pt.data, vct[i].pt.len);
+		debug_hexdump(stdout, "ciphertext:", vct[i].ct.data, vct[i].ct.len);
+		debug_hexdump(stdout, "digest:", vct[i].digest.data, vct[i].digest.len);
+		debug_hexdump(stdout, "sign:", vct[i].sign.data, vct[i].sign.len);
+
+		debug_hexdump(stdout, "e:", vct[i].e.data, vct[i].e.len);
+		debug_hexdump(stdout, "d:", vct[i].d.data, vct[i].d.len);
+		debug_hexdump(stdout, "n:", vct[i].n.data, vct[i].n.len);
+		debug_hexdump(stdout, "p:", vct[i].p.data, vct[i].p.len);
+		debug_hexdump(stdout, "q:", vct[i].q.data, vct[i].q.len);
+		debug_hexdump(stdout, "dP:", vct[i].dP.data, vct[i].dP.len);
+		debug_hexdump(stdout, "dQ:", vct[i].dQ.data, vct[i].dQ.len);
+		debug_hexdump(stdout, "qInv:", vct[i].qInv.data, vct[i].qInv.len);
+
+		for (key_type = RTE_RSA_KEY_TYPE_EXP;
+				key_type < RTE_RSA_KEY_TYPE_LIST_END; key_type++) {
+
+			int sess = 0;
+
+			if (key_type == 0)
+				printf("\n    RSA key is an exponent:\n");
+			else
+				printf("    RSA key is in quintuple format:\n");
+			do {
+				if (sess == 1 && sessionless != 1)
+					break;
+
+				if (sess == 0)
+					printf("\n    With Session:\n");
+				else
+					printf("\n    Without Session:\n");
+
+				if (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
+						test_msg, sess, RTE_CRYPTO_ASYM_OP_ENCRYPT,
+						key_type) != TEST_SUCCESS) {
+					printf("    %-20s: %s\n", "Encryption", "FAIL");
+					status = TEST_FAILED;
+				} else {
+					printf("    %-20s: %s\n", "Encryption", "PASS");
+				}
+
+				if (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
+						test_msg, sess, RTE_CRYPTO_ASYM_OP_DECRYPT,
+						key_type) != TEST_SUCCESS) {
+					printf("    %-20s: %s\n", "Decryption", "FAIL");
+					status = TEST_FAILED;
+				} else {
+					printf("    %-20s: %s\n", "Decryption", "PASS");
+				}
+
+				if (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
+						test_msg, sess, RTE_CRYPTO_ASYM_OP_SIGN,
+						key_type) != TEST_SUCCESS) {
+					printf("    %-20s: %s\n", "Sign", "FAIL");
+					status = TEST_FAILED;
+				} else {
+					printf("    %-20s: %s\n", "Sign", "PASS");
+				}
+
+				if (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
+						test_msg, sess, RTE_CRYPTO_ASYM_OP_VERIFY,
+						key_type) != TEST_SUCCESS) {
+					printf("    %-20s: %s\n", "Verify", "FAIL");
+					status = TEST_FAILED;
+				} else {
+					printf("    %-20s: %s\n", "Verify", "PASS");
+				}
+
+				sess++;
+
+			} while (sess <= 1);
+			printf("\n");
+		}
+	}
+
+	TEST_ASSERT_EQUAL(status, 0, "Test failed");
+	return status;
+}
diff --git a/app/test/test_cryptodev_asym_rsa.h b/app/test/test_cryptodev_asym_rsa.h
new file mode 100644
index 0000000000..055bb77700
--- /dev/null
+++ b/app/test/test_cryptodev_asym_rsa.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_RSA_H_
+#define TEST_CRYPTODEV_ASYM_RSA_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+
+int ats_rsa_setup(void);
+
+void ats_rsa_teardown(void);
+
+int ats_rsa_run(void);
+
+#endif /* TEST_CRYPTODEV_ASYM_RSA_H_ */
diff --git a/app/test/test_cryptodev_asym_rsa_creator.c b/app/test/test_cryptodev_asym_rsa_creator.c
new file mode 100644
index 0000000000..1ef1801c5f
--- /dev/null
+++ b/app/test/test_cryptodev_asym_rsa_creator.c
@@ -0,0 +1,144 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <time.h>
+
+#include <openssl/bn.h>
+#include <openssl/rand.h>
+#include <openssl/rsa.h>
+#include <openssl/engine.h>
+#include <rte_crypto.h>
+
+#include "test_cryptodev_asym_rsa_creator.h"
+#include "test_cryptodev_asym_creator.h"
+
+static int rsa_result(RSA* rsa, struct asym_test_rsa_vct* vct,
+		enum rte_crypto_rsa_padding_type padding) {
+	int clen, state = 0;
+	int padding_rsa;
+	unsigned char digest[SHA256_DIGEST_LENGTH];
+
+	if (padding == RTE_CRYPTO_RSA_PADDING_PKCS1_5)
+		padding_rsa = RSA_PKCS1_PADDING;
+	else
+		padding_rsa = RSA_NO_PADDING;
+
+	// encrypt plain text
+	clen = RSA_public_encrypt(vct->pt.len, vct->pt.data, vct->ct.data, rsa,
+			padding_rsa);
+
+	if (clen >= 0) {
+		vct->ct.len = clen;
+	} else
+		goto err;
+
+	// checking decryption
+	unsigned char dec_buffer[ASYM_DATA_SIZE] = { 0 };
+	clen = RSA_private_decrypt(vct->ct.len, vct->ct.data, dec_buffer, rsa,
+			padding_rsa);
+
+	if (memcmp(dec_buffer, vct->pt.data, vct->pt.len) != 0)
+		goto err;
+
+	// create digest and sign
+	SHA256(vct->pt.data, vct->pt.len, digest);
+
+	if (padding_rsa == RSA_NO_PADDING) {
+		int rsa_size = RSA_size(rsa);
+		if (RSA_padding_add_PKCS1_type_1(vct->digest.data, rsa_size, digest,
+				SHA256_DIGEST_LENGTH) != 1)
+			goto err;
+
+		vct->digest.len = rsa_size;
+	} else {
+		memcpy(vct->digest.data, digest, SHA256_DIGEST_LENGTH);
+		vct->digest.len = SHA256_DIGEST_LENGTH;
+	}
+
+	clen = RSA_private_encrypt(vct->digest.len, vct->digest.data,
+			vct->sign.data, rsa, padding_rsa);
+
+	if (clen >= 0) {
+		vct->sign.len = clen;
+	} else
+		goto err;
+
+	state = 1;
+
+	err: return state;
+}
+
+int atv_rsa_creator(struct asym_test_rsa_vct* vct,
+		struct asym_test_rsa_rule* rule) {
+	int ret;
+	BN_CTX* ctx = NULL;
+	RSA *rsa = NULL;
+	BIGNUM* exp = NULL;
+
+	const BIGNUM* n = NULL;
+	const BIGNUM* e = NULL;
+	const BIGNUM* p = NULL;
+	const BIGNUM* d = NULL;
+	const BIGNUM* q = NULL;
+	const BIGNUM* dmp1 = NULL;
+	const BIGNUM* dmq1 = NULL;
+	const BIGNUM* iqmp = NULL;
+
+	for(;;)
+	{
+		vct->pt.len = rule->pt_len;
+		atv_create_data(vct->pt.data, vct->pt.len);
+		vct->pt.data[0] = 0xAA;
+
+		ctx = BN_CTX_new();
+		rsa = RSA_new();
+		exp = BN_new();
+
+		if ((ret = BN_set_word(exp, RSA_F4)) == 0)
+			goto err;
+
+		if ((ret = RSA_generate_key_ex(rsa, rule->key_size, exp, NULL)) == 0)
+			goto err;
+
+		if ((ret = rsa_result(rsa, vct, rule->padding)) == 0)
+			goto err;
+
+		RSA_get0_key(rsa, &n, &e, &d);
+		RSA_get0_factors(rsa, &p, &q);
+		RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp);
+
+		vct->n.len = BN_bn2bin(n, vct->n.data);
+		vct->e.len = BN_bn2bin(e, vct->e.data);
+		vct->d.len = BN_bn2bin(d, vct->d.data);
+		vct->p.len = BN_bn2bin(p, vct->p.data);
+		vct->q.len = BN_bn2bin(q, vct->q.data);
+
+		vct->dP.len = BN_bn2bin(dmp1, vct->dP.data);
+		vct->dQ.len = BN_bn2bin(dmq1, vct->dQ.data);
+		vct->qInv.len = BN_bn2bin(iqmp, vct->qInv.data);
+
+		err:
+		RSA_free(rsa);
+		BN_free(exp);
+		BN_CTX_free(ctx);
+
+		if (ret == 1)
+			break;
+	}
+
+	vct->xform_type = RTE_CRYPTO_ASYM_XFORM_RSA;
+	vct->padding = rule->padding,
+	vct->op_type_flags = rule->operation;
+	vct->key_exp = 1,
+	vct->key_qt = 1,
+
+	// create description
+	sprintf(vct->description, "RSA key size: %d bits", rule->key_size);
+	return 0;
+}
diff --git a/app/test/test_cryptodev_asym_rsa_creator.h b/app/test/test_cryptodev_asym_rsa_creator.h
new file mode 100644
index 0000000000..75501124da
--- /dev/null
+++ b/app/test/test_cryptodev_asym_rsa_creator.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_RSA_CREATOR_H_
+#define TEST_CRYPTODEV_ASYM_RSA_CREATOR_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+
+#include "test_cryptodev_asym_vectors_def.h"
+
+int atv_rsa_creator(struct asym_test_rsa_vct* vct, struct asym_test_rsa_rule* rule);
+
+#endif /* TEST_CRYPTODEV_ASYM_RSA_CREATOR_H_ */
diff --git a/app/test/test_cryptodev_asym_types.h b/app/test/test_cryptodev_asym_types.h
new file mode 100644
index 0000000000..1cf464e56d
--- /dev/null
+++ b/app/test/test_cryptodev_asym_types.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRPTODEV_ASYM_TYPES_H_
+#define TEST_CRPTODEV_ASYM_TYPES_H_
+
+#include <rte_cryptodev.h>
+#include <rte_crypto.h>
+
+struct crypto_testsuite_params_asym {
+	struct rte_mempool *op_mpool;
+	struct rte_mempool *session_mpool;
+	struct rte_cryptodev_config conf;
+	struct rte_cryptodev_qp_conf qp_conf;
+	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
+	uint8_t valid_dev_count;
+};
+
+#endif /* TEST_CRPTODEV_ASYM_TYPES_H_ */
diff --git a/app/test/test_cryptodev_asym_vectors.c b/app/test/test_cryptodev_asym_vectors.c
new file mode 100644
index 0000000000..9c744baaeb
--- /dev/null
+++ b/app/test/test_cryptodev_asym_vectors.c
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "test_cryptodev_asym_vectors.h"
+#include "test_cryptodev_asym_rsa_creator.h"
+#include "test_cryptodev_asym_vectors_rules.h"
+
+void atv_free(void* vct) {
+	free(vct);
+}
+
+struct asym_test_rsa_vct* atv_rsa(int* vct_nb) {
+	struct asym_test_rsa_vct* vct = NULL;
+	int i;
+
+	*vct_nb = asym_test_rsa_rules_size;
+
+	vct = calloc(*vct_nb, sizeof(struct asym_test_rsa_vct));
+
+	if (vct)
+		for (i = 0; i < *vct_nb; i++)
+			atv_rsa_creator(&vct[i], &asym_test_rsa_rules[i]);
+
+	return vct;
+}
diff --git a/app/test/test_cryptodev_asym_vectors.h b/app/test/test_cryptodev_asym_vectors.h
new file mode 100644
index 0000000000..9a1caf364c
--- /dev/null
+++ b/app/test/test_cryptodev_asym_vectors.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_VECTORS_H_
+#define TEST_CRYPTODEV_ASYM_VECTORS_H_
+
+#include <stdint.h>
+#include "rte_crypto_asym.h"
+#include "test_cryptodev_asym_vectors_def.h"
+
+void atv_free(void* vct);
+
+struct asym_test_modex_vct* atv_modex(int* vct_nb);
+
+struct asym_test_rsa_vct* atv_rsa(int* vct_nb);
+ 
+#endif /* TEST_CRYPTODEV_ASYM_VECTORS_H_ */
diff --git a/app/test/test_cryptodev_asym_vectors_def.h b/app/test/test_cryptodev_asym_vectors_def.h
new file mode 100644
index 0000000000..b5f26a11ea
--- /dev/null
+++ b/app/test/test_cryptodev_asym_vectors_def.h
@@ -0,0 +1,135 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_VECTORS_DEF_H__
+#define TEST_CRYPTODEV_ASYM_VECTORS_DEF_H__
+
+#include <stdint.h>
+
+#include "rte_crypto_asym.h"
+
+#define ASYM_DATA_SIZE 4096
+
+struct asym_test_rsa_vct {
+	enum rte_crypto_asym_xform_type xform_type;
+	char description[2048];
+	uint64_t op_type_flags;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} pt;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} ct;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} sign;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} digest;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} e;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} d;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} n;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} p;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} q;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} dP;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} dQ;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} qInv;
+
+	uint16_t result_len;
+	enum rte_crypto_rsa_padding_type padding;
+	int key_exp;
+	int key_qt;
+};
+
+struct asym_test_rsa_rule
+{
+	int key_size;
+	enum rte_crypto_rsa_priv_key_type key_type;
+	enum rte_crypto_rsa_padding_type padding;
+	int pt_len;
+	uint64_t operation;
+};
+
+struct asym_test_modex_vct {
+	enum rte_crypto_asym_xform_type xform_type;
+	char description[ASYM_DATA_SIZE];
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} base;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} exponent;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} modulus;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} reminder;
+	uint16_t result_len;
+};
+
+struct asym_test_modinv_vct {
+	enum rte_crypto_asym_xform_type xform_type;
+	char description[ASYM_DATA_SIZE];
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} base;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} modulus;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} inverse;
+	uint16_t result_len;
+};
+
+struct asym_test_modexp_rule
+{
+	int base_len;
+	int modulus_len;
+	int exponent_len;
+};
+
+struct asym_test_modinv_rule
+{
+	int base_len;
+	int modulus_len;
+};
+
+#endif /* TEST_CRYPTODEV_ASYM_VECTORS_DEF_H__ */
diff --git a/app/test/test_cryptodev_asym_vectors_rules.h b/app/test/test_cryptodev_asym_vectors_rules.h
new file mode 100644
index 0000000000..27b59b05f4
--- /dev/null
+++ b/app/test/test_cryptodev_asym_vectors_rules.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_VECTORS_RULES_H__
+#define TEST_CRYPTODEV_ASYM_VECTORS_RULES_H__
+
+#include <stdint.h>
+
+#include "test_cryptodev_asym_vectors_def.h"
+
+static struct asym_test_rsa_rule asym_test_rsa_rules[] =
+{
+	{
+		.key_size 	= 1024,
+		.key_type	= RTE_RSA_KEY_TYPE_EXP,
+		.padding 	= RTE_CRYPTO_RSA_PADDING_NONE,
+		.pt_len 	= 128,
+		.operation	= (1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
+						(1UL << RTE_CRYPTO_ASYM_OP_DECRYPT)
+	},
+	{
+		.key_size	= 2048,
+		.key_type	= RTE_RSA_KEY_TYPE_EXP,
+		.padding	= RTE_CRYPTO_RSA_PADDING_NONE,
+		.pt_len		= 256,
+		.operation	= (1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
+						(1UL << RTE_CRYPTO_ASYM_OP_DECRYPT)
+	},
+	{
+		.key_size	= 4096,
+		.key_type	= RTE_RSA_KEY_TYPE_EXP,
+		.padding	= RTE_CRYPTO_RSA_PADDING_NONE,
+		.pt_len		= 512,
+		.operation	= (1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
+						(1UL << RTE_CRYPTO_ASYM_OP_DECRYPT)
+	},
+};
+
+static int asym_test_rsa_rules_size = (sizeof(asym_test_rsa_rules)
+		/ sizeof(*asym_test_rsa_rules));
+
+#endif /* TEST_CRYPTODEV_ASYM_VECTORS_RULES_H__ */
diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
index 8ae43d5f3d..6e289832b3 100644
--- a/lib/cryptodev/rte_crypto_asym.h
+++ b/lib/cryptodev/rte_crypto_asym.h
@@ -182,6 +182,7 @@ enum rte_crypto_rsa_priv_key_type {
 	/**< RSA private key is in quintuple format
 	 * See rte_crypto_rsa_priv_key_qt
 	 */
+	RTE_RSA_KEY_TYPE_LIST_END,
 };
 
 /**
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev v2] app/test: random test vectors for Asymc RSA
  2022-08-17 10:57 [PATCH] app/test: random test vectors for Asymc RSA Przemyslaw Zegan
@ 2022-08-17 14:14 ` Przemyslaw Zegan
  2022-09-27 11:42   ` [EXT] " Gowrishankar Muthukrishnan
  0 siblings, 1 reply; 3+ messages in thread
From: Przemyslaw Zegan @ 2022-08-17 14:14 UTC (permalink / raw)
  To: dev; +Cc: gakhil, roy.fan.zhang, Przemyslaw Zegan

This patch add random test vectors generator for asymc RSA algorithm,
base on OpenSSL 1.1.x lib.

Added functions for create RSA test vectors base on defined rules.
The randome generated test vector include plaintext, RSA key in exponent
and quintuple format, digest and expected cipher and sign.

Replace crypto_testsuite_params_asym struct from test_cryptodev_asym.c
to test_cryptodev_asym_types.h, as it's used in other test suit.

Description of new files:
test_cryptodev_asym_creator.c: generator for random plaintext
test_cryptodev_asym_rsa_creator.c: RSA vector generator
test_cryptodev_asym_rsa_creator.c RSA test suite
test_cryptodev_asym_vectors.c: memory allocator for vectors

Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
---
v2: fixed coding style issues
---
 app/test/meson.build                         |   5 +
 app/test/test_cryptodev_asym.c               |  63 ++--
 app/test/test_cryptodev_asym_common.c        | 117 +++++++
 app/test/test_cryptodev_asym_common.h        |  49 +++
 app/test/test_cryptodev_asym_creator.c       |  42 +++
 app/test/test_cryptodev_asym_creator.h       |  13 +
 app/test/test_cryptodev_asym_rsa.c           | 309 +++++++++++++++++++
 app/test/test_cryptodev_asym_rsa.h           |  17 +
 app/test/test_cryptodev_asym_rsa_creator.c   | 145 +++++++++
 app/test/test_cryptodev_asym_rsa_creator.h   |  16 +
 app/test/test_cryptodev_asym_types.h         |  20 ++
 app/test/test_cryptodev_asym_vectors.c       |  31 ++
 app/test/test_cryptodev_asym_vectors.h       |  18 ++
 app/test/test_cryptodev_asym_vectors_def.h   | 132 ++++++++
 app/test/test_cryptodev_asym_vectors_rules.h |  42 +++
 lib/cryptodev/rte_crypto_asym.h              |   1 +
 16 files changed, 986 insertions(+), 34 deletions(-)
 create mode 100644 app/test/test_cryptodev_asym_common.c
 create mode 100644 app/test/test_cryptodev_asym_common.h
 create mode 100644 app/test/test_cryptodev_asym_creator.c
 create mode 100644 app/test/test_cryptodev_asym_creator.h
 create mode 100644 app/test/test_cryptodev_asym_rsa.c
 create mode 100644 app/test/test_cryptodev_asym_rsa.h
 create mode 100644 app/test/test_cryptodev_asym_rsa_creator.c
 create mode 100644 app/test/test_cryptodev_asym_rsa_creator.h
 create mode 100644 app/test/test_cryptodev_asym_types.h
 create mode 100644 app/test/test_cryptodev_asym_vectors.c
 create mode 100644 app/test/test_cryptodev_asym_vectors.h
 create mode 100644 app/test/test_cryptodev_asym_vectors_def.h
 create mode 100644 app/test/test_cryptodev_asym_vectors_rules.h

diff --git a/app/test/meson.build b/app/test/meson.build
index 431c5bd318..8dc5a3e516 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -146,6 +146,11 @@ test_sources = files(
         'test_trace_perf.c',
         'test_version.c',
         'virtual_pmd.c',
+        'test_cryptodev_asym_common.c',
+        'test_cryptodev_asym_vectors.c',
+        'test_cryptodev_asym_rsa.c',
+        'test_cryptodev_asym_rsa_creator.c',
+        'test_cryptodev_asym_creator.c'
 )
 
 test_deps = enabled_libs
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index fc1a727472..b692af3760 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -23,6 +23,8 @@
 #include "test_cryptodev_rsa_test_vectors.h"
 #include "test_cryptodev_asym_util.h"
 #include "test.h"
+#include "test_cryptodev_asym_types.h"
+#include "test_cryptodev_asym_rsa.h"
 
 #define TEST_NUM_BUFS 10
 #define TEST_NUM_SESSIONS 4
@@ -34,14 +36,6 @@
 #define TEST_VECTOR_SIZE 256
 
 static int gbl_driver_id;
-struct crypto_testsuite_params_asym {
-	struct rte_mempool *op_mpool;
-	struct rte_mempool *session_mpool;
-	struct rte_cryptodev_config conf;
-	struct rte_cryptodev_qp_conf qp_conf;
-	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
-	uint8_t valid_dev_count;
-};
 
 struct crypto_unittest_params {
 	void *sess;
@@ -62,12 +56,12 @@ static struct test_cases_array test_vector = {0, { NULL } };
 
 static uint32_t test_index;
 
-static struct crypto_testsuite_params_asym testsuite_params = { NULL };
+struct crypto_testsuite_params_asym testsuite_params_asym = { NULL };
 
 static int
 queue_ops_rsa_sign_verify(void *sess)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_crypto_op *op, *result_op;
@@ -158,7 +152,7 @@ queue_ops_rsa_sign_verify(void *sess)
 static int
 queue_ops_rsa_enc_dec(void *sess)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_crypto_op *op, *result_op;
@@ -524,7 +518,7 @@ test_one_case(const void *test_case, int sessionless)
 
 	if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_MODEX
 			|| tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_MODINV) {
-		status = test_cryptodev_asym_op(&testsuite_params, &tc, test_msg,
+		status = test_cryptodev_asym_op(&testsuite_params_asym, &tc, test_msg,
 				sessionless, 0, 0);
 		printf("  %u) TestCase %s %s\n", test_index++,
 			tc.modex.description, test_msg);
@@ -534,7 +528,7 @@ test_one_case(const void *test_case, int sessionless)
 				if (tc.rsa_data.op_type_flags & (1 << i)) {
 					if (tc.rsa_data.key_exp) {
 						status = test_cryptodev_asym_op(
-							&testsuite_params, &tc,
+							&testsuite_params_asym, &tc,
 							test_msg, sessionless, i,
 							RTE_RSA_KEY_TYPE_EXP);
 					}
@@ -544,7 +538,7 @@ test_one_case(const void *test_case, int sessionless)
 							RTE_CRYPTO_ASYM_OP_DECRYPT ||
 							i == RTE_CRYPTO_ASYM_OP_SIGN)) {
 						status = test_cryptodev_asym_op(
-							&testsuite_params,
+							&testsuite_params_asym,
 							&tc, test_msg, sessionless, i,
 							RTE_RSA_KEY_TYPE_QT);
 					}
@@ -604,7 +598,7 @@ static int
 test_one_by_one(void)
 {
 	int status = TEST_SUCCESS;
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	uint32_t i = 0;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_info dev_info;
@@ -637,7 +631,7 @@ test_one_by_one(void)
 static int
 test_rsa_sign_verify(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	void *sess = NULL;
@@ -677,7 +671,7 @@ test_rsa_sign_verify(void)
 static int
 test_rsa_enc_dec(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	void *sess = NULL;
@@ -717,7 +711,7 @@ test_rsa_enc_dec(void)
 static int
 test_rsa_sign_verify_crt(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	void *sess = NULL;
@@ -757,7 +751,7 @@ test_rsa_sign_verify_crt(void)
 static int
 test_rsa_enc_dec_crt(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	void *sess = NULL;
@@ -797,7 +791,7 @@ test_rsa_enc_dec_crt(void)
 static int
 testsuite_setup(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
 	struct rte_cryptodev_info info;
 	int ret, dev_id = -1;
@@ -902,7 +896,7 @@ testsuite_setup(void)
 static void
 testsuite_teardown(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 
 	if (ts_params->op_mpool != NULL) {
 		RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
@@ -919,7 +913,7 @@ testsuite_teardown(void)
 static int
 ut_setup_asym(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 
 	uint16_t qp_id;
 
@@ -953,7 +947,7 @@ ut_setup_asym(void)
 static void
 ut_teardown_asym(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_cryptodev_stats stats;
 
 	rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats);
@@ -1002,7 +996,7 @@ static inline void print_asym_capa(
 static int
 test_capability(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_info dev_info;
 	const struct rte_cryptodev_capabilities *dev_capa;
@@ -1039,7 +1033,7 @@ test_capability(void)
 static int
 test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1121,7 +1115,7 @@ test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
 static int
 test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1201,7 +1195,7 @@ test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
 static int
 test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1289,7 +1283,7 @@ test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
 static int
 test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1375,7 +1369,7 @@ test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
 static int
 test_mod_inv(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1487,7 +1481,7 @@ test_mod_inv(void)
 static int
 test_mod_exp(void)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1635,7 +1629,7 @@ test_dh_keygenration(void)
 static int
 test_dsa_sign(struct rte_crypto_dsa_op_param *dsa_op)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1718,7 +1712,7 @@ test_dsa_sign(struct rte_crypto_dsa_op_param *dsa_op)
 static int
 test_dsa_verify(struct rte_crypto_dsa_op_param *dsa_op)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	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];
@@ -1831,7 +1825,7 @@ test_dsa(void)
 static int
 test_ecdsa_sign_verify(enum curve curve_id)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct crypto_testsuite_ecdsa_params input_params;
@@ -2032,7 +2026,7 @@ test_ecdsa_sign_verify_all_curve(void)
 static int
 test_ecpm(enum curve curve_id)
 {
-	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct crypto_testsuite_ecpm_params input_params;
@@ -2219,6 +2213,7 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite  = {
 	.teardown = testsuite_teardown,
 	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
+		TEST_CASE_ST(ats_rsa_setup, ats_rsa_teardown, ats_rsa_run),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
diff --git a/app/test/test_cryptodev_asym_common.c b/app/test/test_cryptodev_asym_common.c
new file mode 100644
index 0000000000..f0e3987db8
--- /dev/null
+++ b/app/test/test_cryptodev_asym_common.c
@@ -0,0 +1,117 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include <stdint.h>
+
+#include "test_cryptodev_asym_common.h"
+#include "test.h"
+#include "test_cryptodev.h"
+
+int ats_common_setup(struct crypto_testsuite_params_asym *ts)
+{
+	uint16_t qp_id;
+
+	/* Reconfigure device to default parameters */
+	ts->conf.socket_id = SOCKET_ID_ANY;
+
+	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts->valid_devs[0],
+			&ts->conf),
+			"Failed to configure cryptodev %u",
+			ts->valid_devs[0]);
+
+	for (qp_id = 0; qp_id < ts->conf.nb_queue_pairs ; qp_id++) {
+		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
+			ts->valid_devs[0], qp_id,
+			&ts->qp_conf,
+			rte_cryptodev_socket_id(ts->valid_devs[0])),
+			"Failed to setup queue pair %u on cryptodev %u",
+			qp_id, ts->valid_devs[0]);
+	}
+
+	rte_cryptodev_stats_reset(ts->valid_devs[0]);
+
+	/* Start the device */
+	TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts->valid_devs[0]),
+						"Failed to start cryptodev %u",
+						ts->valid_devs[0]);
+
+	return TEST_SUCCESS;
+}
+
+void ats_common_teardown(struct crypto_testsuite_params_asym *ts)
+{
+	struct rte_cryptodev_stats stats;
+
+	rte_cryptodev_stats_get(ts->valid_devs[0], &stats);
+
+	rte_cryptodev_stop(ts->valid_devs[0]);
+}
+
+void ats_err_msg_cap(void)
+{
+	RTE_LOG(INFO, USER1, "Device doesn't support MODEX. Test Skipped\n");
+}
+
+void ats_err_msg_op(char *msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Failed to allocate asymmetric crypto operation struct");
+}
+
+void ats_err_msg_mod_len(char *msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Invalid MODULUS length specified");
+}
+
+void ats_err_msg_inv_alg(char *msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Invalid ASYM algorithm specified");
+}
+
+void ats_err_msg_sess_create(char *msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Session creation failed");
+}
+
+void ats_err_msg_sess_init(char *msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"unabled to config sym session");
+}
+
+void ats_err_msg_enque(char *msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Error sending packet for operation");
+}
+
+void ats_err_msg_burst(char *msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Error sending packet for operation");
+}
+
+void ats_err_msg_deq(char *msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+		"line %u FAILED: %s", line,
+		"Failed to process asym crypto op");
+}
+
+void ats_err_msg_ver(char *msg, uint32_t len, uint32_t line)
+{
+	snprintf(msg, len,
+			"line %u FAILED: %s", line,
+			"Verification failed ");
+}
diff --git a/app/test/test_cryptodev_asym_common.h b/app/test/test_cryptodev_asym_common.h
new file mode 100644
index 0000000000..f61e49f5dc
--- /dev/null
+++ b/app/test/test_cryptodev_asym_common.h
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_COMMON_H_
+#define TEST_CRYPTODEV_ASYM_COMMON_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+
+#include <rte_bus_vdev.h>
+#include <rte_common.h>
+#include <rte_hexdump.h>
+#include <rte_mbuf.h>
+#include <rte_malloc.h>
+#include <rte_memcpy.h>
+#include <rte_pause.h>
+
+#include <rte_cryptodev.h>
+#include <rte_crypto.h>
+
+#include "test_cryptodev_asym_types.h"
+
+int ats_common_setup(struct crypto_testsuite_params_asym *ts);
+
+void ats_common_teardown(struct crypto_testsuite_params_asym *ts);
+
+void ats_err_msg_cap(void);
+
+void ats_err_msg_op(char *msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_mod_len(char *msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_inv_alg(char *msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_sess_create(char *msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_sess_init(char *msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_enque(char *msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_burst(char *msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_deq(char *msg, uint32_t len, uint32_t line);
+
+void ats_err_msg_ver(char *msg, uint32_t len, uint32_t line);
+
+
+#endif /* TEST_CRYPTODEV_ASYM_COMMON_H_ */
diff --git a/app/test/test_cryptodev_asym_creator.c b/app/test/test_cryptodev_asym_creator.c
new file mode 100644
index 0000000000..2be9755791
--- /dev/null
+++ b/app/test/test_cryptodev_asym_creator.c
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <sys/time.h>
+
+#include <openssl/bn.h>
+#include <openssl/rand.h>
+
+#include "test_cryptodev_asym_creator.h"
+
+int atv_create_data(uint8_t *data, int len)
+{
+	struct timespec ts;
+	struct timeval tv;
+	int i;
+
+	ts.tv_sec = 0;
+	ts.tv_nsec = 10000000;
+	nanosleep(&ts, NULL);
+
+	gettimeofday(&tv, NULL);
+	int seed = 1000000 * tv.tv_sec + tv.tv_usec;
+
+	srand(seed);
+
+	memset(data, 0, len);
+
+	int *dt = (int *) data;
+	int ln = len / sizeof(int);
+
+	for (i = 0; i < ln; i++)
+		dt[i] = rand();
+
+	return 0;
+}
+
diff --git a/app/test/test_cryptodev_asym_creator.h b/app/test/test_cryptodev_asym_creator.h
new file mode 100644
index 0000000000..9587fadb55
--- /dev/null
+++ b/app/test/test_cryptodev_asym_creator.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_CREATOR_H_
+#define TEST_CRYPTODEV_ASYM_CREATOR_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+
+int atv_create_data(uint8_t *data, int len);
+
+#endif /* TEST_CRYPTODEV_ASYM_CREATOR_H_ */
diff --git a/app/test/test_cryptodev_asym_rsa.c b/app/test/test_cryptodev_asym_rsa.c
new file mode 100644
index 0000000000..6f90877e6c
--- /dev/null
+++ b/app/test/test_cryptodev_asym_rsa.c
@@ -0,0 +1,309 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include "test_cryptodev_asym_common.h"
+#include "test_cryptodev_asym_rsa.h"
+#include "test_cryptodev_asym_vectors.h"
+
+#include "test.h"
+#include "test_cryptodev.h"
+#include "test_cryptodev_asym_types.h"
+#include "test_cryptodev_asym_vectors.h"
+
+#define ASYM_TEST_MSG_LEN 256
+#define TEST_DATA_SIZE 4096
+
+struct crypto_unittest_params {
+	struct rte_cryptodev_asym_session *sess;
+	struct rte_crypto_op *op;
+};
+
+static struct asym_test_rsa_vct *vct;
+static int vct_nb;
+
+extern struct crypto_testsuite_params_asym testsuite_params_asym;
+
+int ats_rsa_setup(void)
+{
+	vct = atv_rsa(&vct_nb);
+
+	int status = ats_common_setup(&testsuite_params_asym);
+
+	return status;
+}
+
+void ats_rsa_teardown(void)
+{
+	atv_free(vct);
+
+	ats_common_teardown(&testsuite_params_asym);
+}
+
+static int ats_case_rsa_op(struct crypto_testsuite_params_asym *ts_params,
+		struct asym_test_rsa_vct *data_tc, char *test_msg, int sessionless,
+		enum rte_crypto_asym_op_type op_type,
+		enum rte_crypto_rsa_priv_key_type key_type)
+{
+	struct rte_crypto_asym_op *asym_op = NULL;
+	struct rte_crypto_op *op = NULL;
+	struct rte_crypto_op *result_op = NULL;
+	struct rte_crypto_asym_xform xform_tc;
+	void *sess = NULL;
+	struct rte_cryptodev_asym_capability_idx cap_idx;
+	const struct rte_cryptodev_asymmetric_xform_capability *capability;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	uint8_t *result = NULL;
+	uint8_t *data_expected = NULL, *data_received = NULL;
+	size_t data_size = 0;
+
+	int ret, status = TEST_SUCCESS;
+
+	xform_tc.next = NULL;
+	xform_tc.xform_type = data_tc->xform_type;
+
+	cap_idx.type = xform_tc.xform_type;
+	capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
+
+	if (capability == NULL) {
+		ats_err_msg_cap();
+		return TEST_SKIPPED;
+	}
+
+	/* Generate crypto op data structure */
+	op = rte_crypto_op_alloc(ts_params->op_mpool,
+			RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
+
+	if (!op) {
+		ats_err_msg_op(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+	asym_op = op->asym;
+
+	switch (xform_tc.xform_type) {
+	case RTE_CRYPTO_ASYM_XFORM_RSA:
+		result = rte_zmalloc(NULL, data_tc->n.len, 0);
+		op->asym->rsa.op_type = op_type;
+		xform_tc.rsa.e.data = data_tc->e.data;
+		xform_tc.rsa.e.length = data_tc->e.len;
+		xform_tc.rsa.n.data = data_tc->n.data;
+		xform_tc.rsa.n.length = data_tc->n.len;
+
+		if (key_type == RTE_RSA_KEY_TYPE_EXP) {
+			xform_tc.rsa.d.data = data_tc->d.data;
+			xform_tc.rsa.d.length = data_tc->d.len;
+		} else {
+			xform_tc.rsa.qt.p.data = data_tc->p.data;
+			xform_tc.rsa.qt.p.length = data_tc->p.len;
+			xform_tc.rsa.qt.q.data = data_tc->q.data;
+			xform_tc.rsa.qt.q.length = data_tc->q.len;
+			xform_tc.rsa.qt.dP.data = data_tc->dP.data;
+			xform_tc.rsa.qt.dP.length = data_tc->dP.len;
+			xform_tc.rsa.qt.dQ.data = data_tc->dQ.data;
+			xform_tc.rsa.qt.dQ.length = data_tc->dQ.len;
+			xform_tc.rsa.qt.qInv.data = data_tc->qInv.data;
+			xform_tc.rsa.qt.qInv.length = data_tc->qInv.len;
+		}
+
+		xform_tc.rsa.key_type = key_type;
+		op->asym->rsa.padding.type = data_tc->padding;
+
+		if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_ENCRYPT) {
+			asym_op->rsa.message.data = data_tc->pt.data;
+			asym_op->rsa.message.length = data_tc->pt.len;
+			asym_op->rsa.cipher.data = result;
+			asym_op->rsa.cipher.length = data_tc->n.len;
+		} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_DECRYPT) {
+			asym_op->rsa.message.data = result;
+			asym_op->rsa.message.length = 0;
+			asym_op->rsa.cipher.data = data_tc->ct.data;
+			asym_op->rsa.cipher.length = data_tc->ct.len;
+		} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_SIGN) {
+			asym_op->rsa.sign.data = result;
+			asym_op->rsa.sign.length = data_tc->n.len;
+			asym_op->rsa.message.data = data_tc->digest.data;
+			asym_op->rsa.message.length = data_tc->digest.len;
+		} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_VERIFY) {
+			asym_op->rsa.cipher.data = result;
+			asym_op->rsa.cipher.length = data_tc->n.len;
+			asym_op->rsa.sign.data = data_tc->sign.data;
+			asym_op->rsa.sign.length = data_tc->sign.len;
+		}
+		break;
+
+	default:
+		ats_err_msg_inv_alg(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+	if (!sessionless) {
+		ret = rte_cryptodev_asym_session_create(dev_id, &xform_tc,
+				ts_params->session_mpool, &sess);
+		if (ret < 0) {
+			ats_err_msg_sess_create(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+			status = (ret == -ENOTSUP) ? TEST_SKIPPED : 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 */
+	if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
+		ats_err_msg_enque(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+	while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
+		rte_pause();
+
+	if (result_op == NULL) {
+		ats_err_msg_deq(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+	if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_ENCRYPT) {
+		data_size = xform_tc.rsa.n.length;
+		data_received = result_op->asym->rsa.cipher.data;
+		data_expected = data_tc->ct.data;
+	} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_DECRYPT) {
+		data_size = xform_tc.rsa.n.length;
+		data_expected = data_tc->pt.data;
+		data_received = result_op->asym->rsa.message.data;
+	} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_SIGN) {
+		data_size = xform_tc.rsa.n.length;
+		data_expected = data_tc->sign.data;
+		data_received = result_op->asym->rsa.sign.data;
+	} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_VERIFY) {
+		data_size = xform_tc.rsa.n.length;
+		data_expected = data_tc->digest.data;
+		data_received = result_op->asym->rsa.cipher.data;
+	}
+
+	if ((memcmp(data_expected, data_received, data_size) != 0)
+			|| (data_size == 0)) {
+		ats_err_msg_ver(test_msg, ASYM_TEST_MSG_LEN, __LINE__);
+		status = TEST_FAILED;
+		goto error_exit;
+	}
+
+error_exit:
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+
+	if (op != NULL)
+		rte_crypto_op_free(op);
+
+	if (result != NULL)
+		rte_free(result);
+
+	return status;
+}
+
+int ats_rsa_run(void)
+{
+	int status = TEST_SUCCESS;
+	int i, key_type;
+	char test_msg[ASYM_TEST_MSG_LEN + 1];
+	int sessionless = 0;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params_asym;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_cryptodev_info dev_info;
+
+	rte_cryptodev_info_get(dev_id, &dev_info);
+	if ((dev_info.feature_flags &
+	RTE_CRYPTODEV_FF_ASYM_SESSIONLESS)) {
+		sessionless = 1;
+	}
+
+	for (i = 0; i < vct_nb; i++) {
+
+		printf("\n  %u) TestSubCase %s - %s\n", i + 1, vct[i].description,
+				test_msg);
+		debug_hexdump(stdout, "plaintext:", vct[i].pt.data, vct[i].pt.len);
+		debug_hexdump(stdout, "ciphertext:", vct[i].ct.data, vct[i].ct.len);
+		debug_hexdump(stdout, "digest:", vct[i].digest.data, vct[i].digest.len);
+		debug_hexdump(stdout, "sign:", vct[i].sign.data, vct[i].sign.len);
+
+		debug_hexdump(stdout, "e:", vct[i].e.data, vct[i].e.len);
+		debug_hexdump(stdout, "d:", vct[i].d.data, vct[i].d.len);
+		debug_hexdump(stdout, "n:", vct[i].n.data, vct[i].n.len);
+		debug_hexdump(stdout, "p:", vct[i].p.data, vct[i].p.len);
+		debug_hexdump(stdout, "q:", vct[i].q.data, vct[i].q.len);
+		debug_hexdump(stdout, "dP:", vct[i].dP.data, vct[i].dP.len);
+		debug_hexdump(stdout, "dQ:", vct[i].dQ.data, vct[i].dQ.len);
+		debug_hexdump(stdout, "qInv:", vct[i].qInv.data, vct[i].qInv.len);
+
+		for (key_type = RTE_RSA_KEY_TYPE_EXP;
+				key_type < RTE_RSA_KEY_TYPE_LIST_END; key_type++) {
+
+			int sess = 0;
+
+			if (key_type == 0)
+				printf("\n    RSA key is an exponent:\n");
+			else
+				printf("    RSA key is in quintuple format:\n");
+			do {
+				if (sess == 1 && sessionless != 1)
+					break;
+
+				if (sess == 0)
+					printf("\n    With Session:\n");
+				else
+					printf("\n    Without Session:\n");
+
+				if (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
+						test_msg, sess, RTE_CRYPTO_ASYM_OP_ENCRYPT,
+						key_type) != TEST_SUCCESS) {
+					printf("    %-20s: %s\n", "Encryption", "FAIL");
+					status = TEST_FAILED;
+				} else {
+					printf("    %-20s: %s\n", "Encryption", "PASS");
+				}
+
+				if (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
+						test_msg, sess, RTE_CRYPTO_ASYM_OP_DECRYPT,
+						key_type) != TEST_SUCCESS) {
+					printf("    %-20s: %s\n", "Decryption", "FAIL");
+					status = TEST_FAILED;
+				} else {
+					printf("    %-20s: %s\n", "Decryption", "PASS");
+				}
+
+				if (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
+						test_msg, sess, RTE_CRYPTO_ASYM_OP_SIGN,
+						key_type) != TEST_SUCCESS) {
+					printf("    %-20s: %s\n", "Sign", "FAIL");
+					status = TEST_FAILED;
+				} else {
+					printf("    %-20s: %s\n", "Sign", "PASS");
+				}
+
+				if (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
+						test_msg, sess, RTE_CRYPTO_ASYM_OP_VERIFY,
+						key_type) != TEST_SUCCESS) {
+					printf("    %-20s: %s\n", "Verify", "FAIL");
+					status = TEST_FAILED;
+				} else {
+					printf("    %-20s: %s\n", "Verify", "PASS");
+				}
+
+				sess++;
+
+			} while (sess <= 1);
+			printf("\n");
+		}
+	}
+
+	TEST_ASSERT_EQUAL(status, 0, "Test failed");
+	return status;
+}
diff --git a/app/test/test_cryptodev_asym_rsa.h b/app/test/test_cryptodev_asym_rsa.h
new file mode 100644
index 0000000000..055bb77700
--- /dev/null
+++ b/app/test/test_cryptodev_asym_rsa.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_RSA_H_
+#define TEST_CRYPTODEV_ASYM_RSA_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+
+int ats_rsa_setup(void);
+
+void ats_rsa_teardown(void);
+
+int ats_rsa_run(void);
+
+#endif /* TEST_CRYPTODEV_ASYM_RSA_H_ */
diff --git a/app/test/test_cryptodev_asym_rsa_creator.c b/app/test/test_cryptodev_asym_rsa_creator.c
new file mode 100644
index 0000000000..7c031721af
--- /dev/null
+++ b/app/test/test_cryptodev_asym_rsa_creator.c
@@ -0,0 +1,145 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <time.h>
+
+#include <openssl/bn.h>
+#include <openssl/rand.h>
+#include <openssl/rsa.h>
+#include <openssl/engine.h>
+#include <rte_crypto.h>
+
+#include "test_cryptodev_asym_rsa_creator.h"
+#include "test_cryptodev_asym_creator.h"
+
+static int rsa_result(RSA *rsa, struct asym_test_rsa_vct *vct,
+		enum rte_crypto_rsa_padding_type padding)
+{
+	int clen, state = 0;
+	int padding_rsa;
+	unsigned char digest[SHA256_DIGEST_LENGTH];
+
+	if (padding == RTE_CRYPTO_RSA_PADDING_PKCS1_5)
+		padding_rsa = RSA_PKCS1_PADDING;
+	else
+		padding_rsa = RSA_NO_PADDING;
+
+	clen = RSA_public_encrypt(vct->pt.len, vct->pt.data, vct->ct.data, rsa,
+			padding_rsa);
+
+	if (clen >= 0)
+		vct->ct.len = clen;
+	else
+		goto err;
+
+	unsigned char dec_buffer[ASYM_DATA_SIZE] = { 0 };
+	clen = RSA_private_decrypt(vct->ct.len, vct->ct.data, dec_buffer, rsa,
+			padding_rsa);
+
+	if (memcmp(dec_buffer, vct->pt.data, vct->pt.len) != 0)
+		goto err;
+
+	SHA256(vct->pt.data, vct->pt.len, digest);
+
+	if (padding_rsa == RSA_NO_PADDING) {
+		int rsa_size = RSA_size(rsa);
+		if (RSA_padding_add_PKCS1_type_1(vct->digest.data, rsa_size, digest,
+				SHA256_DIGEST_LENGTH) != 1)
+			goto err;
+
+		vct->digest.len = rsa_size;
+	} else {
+		memcpy(vct->digest.data, digest, SHA256_DIGEST_LENGTH);
+		vct->digest.len = SHA256_DIGEST_LENGTH;
+	}
+
+	clen = RSA_private_encrypt(vct->digest.len, vct->digest.data,
+			vct->sign.data, rsa, padding_rsa);
+
+	if (clen >= 0)
+		vct->sign.len = clen;
+	else
+		goto err;
+
+	state = 1;
+
+err:
+	return state;
+}
+
+int atv_rsa_creator(struct asym_test_rsa_vct *vct,
+		struct asym_test_rsa_rule *rule)
+{
+	int ret;
+	BN_CTX *ctx = NULL;
+	RSA *rsa = NULL;
+	BIGNUM *exp = NULL;
+
+	const BIGNUM *n = NULL;
+	const BIGNUM *e = NULL;
+	const BIGNUM *p = NULL;
+	const BIGNUM *d = NULL;
+	const BIGNUM *q = NULL;
+	const BIGNUM *dmp1 = NULL;
+	const BIGNUM *dmq1 = NULL;
+	const BIGNUM *iqmp = NULL;
+
+	for (;;) {
+		vct->pt.len = rule->pt_len;
+		atv_create_data(vct->pt.data, vct->pt.len);
+		vct->pt.data[0] = 0xAA;
+
+		ctx = BN_CTX_new();
+		rsa = RSA_new();
+		exp = BN_new();
+
+		ret = BN_set_word(exp, RSA_F4);
+		if (ret == 0)
+			goto err;
+
+		ret = RSA_generate_key_ex(rsa, rule->key_size, exp, NULL);
+		if (ret == 0)
+			goto err;
+
+		ret = rsa_result(rsa, vct, rule->padding);
+		if (ret == 0)
+			goto err;
+
+		RSA_get0_key(rsa, &n, &e, &d);
+		RSA_get0_factors(rsa, &p, &q);
+		RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp);
+
+		vct->n.len = BN_bn2bin(n, vct->n.data);
+		vct->e.len = BN_bn2bin(e, vct->e.data);
+		vct->d.len = BN_bn2bin(d, vct->d.data);
+		vct->p.len = BN_bn2bin(p, vct->p.data);
+		vct->q.len = BN_bn2bin(q, vct->q.data);
+
+		vct->dP.len = BN_bn2bin(dmp1, vct->dP.data);
+		vct->dQ.len = BN_bn2bin(dmq1, vct->dQ.data);
+		vct->qInv.len = BN_bn2bin(iqmp, vct->qInv.data);
+
+err:
+		RSA_free(rsa);
+		BN_free(exp);
+		BN_CTX_free(ctx);
+
+		if (ret == 1)
+			break;
+	}
+
+	vct->xform_type = RTE_CRYPTO_ASYM_XFORM_RSA;
+	vct->padding = rule->padding,
+	vct->op_type_flags = rule->operation;
+	vct->key_exp = 1,
+	vct->key_qt = 1,
+
+	sprintf(vct->description, "RSA key size: %d bits", rule->key_size);
+	return 0;
+}
diff --git a/app/test/test_cryptodev_asym_rsa_creator.h b/app/test/test_cryptodev_asym_rsa_creator.h
new file mode 100644
index 0000000000..58c0efd376
--- /dev/null
+++ b/app/test/test_cryptodev_asym_rsa_creator.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_RSA_CREATOR_H_
+#define TEST_CRYPTODEV_ASYM_RSA_CREATOR_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+
+#include "test_cryptodev_asym_vectors_def.h"
+
+int atv_rsa_creator(struct asym_test_rsa_vct *vct,
+		struct asym_test_rsa_rule *rule);
+
+#endif /* TEST_CRYPTODEV_ASYM_RSA_CREATOR_H_ */
diff --git a/app/test/test_cryptodev_asym_types.h b/app/test/test_cryptodev_asym_types.h
new file mode 100644
index 0000000000..5b2a79679c
--- /dev/null
+++ b/app/test/test_cryptodev_asym_types.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRPTODEV_ASYM_TYPES_H_
+#define TEST_CRPTODEV_ASYM_TYPES_H_
+
+#include <rte_cryptodev.h>
+#include <rte_crypto.h>
+
+struct crypto_testsuite_params_asym {
+	struct rte_mempool *op_mpool;
+	struct rte_mempool *session_mpool;
+	struct rte_cryptodev_config conf;
+	struct rte_cryptodev_qp_conf qp_conf;
+	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
+	uint8_t valid_dev_count;
+};
+
+#endif /* TEST_CRPTODEV_ASYM_TYPES_H_ */
diff --git a/app/test/test_cryptodev_asym_vectors.c b/app/test/test_cryptodev_asym_vectors.c
new file mode 100644
index 0000000000..d18aaa5426
--- /dev/null
+++ b/app/test/test_cryptodev_asym_vectors.c
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "test_cryptodev_asym_vectors.h"
+#include "test_cryptodev_asym_rsa_creator.h"
+#include "test_cryptodev_asym_vectors_rules.h"
+
+void atv_free(void *vct)
+{
+	free(vct);
+}
+
+struct asym_test_rsa_vct *atv_rsa(int *vct_nb)
+{
+	struct asym_test_rsa_vct *vct = NULL;
+	int i;
+
+	*vct_nb = asym_test_rsa_rules_size;
+
+	vct = calloc(*vct_nb, sizeof(struct asym_test_rsa_vct));
+
+	if (vct)
+		for (i = 0; i < *vct_nb; i++)
+			atv_rsa_creator(&vct[i], &asym_test_rsa_rules[i]);
+
+	return vct;
+}
diff --git a/app/test/test_cryptodev_asym_vectors.h b/app/test/test_cryptodev_asym_vectors.h
new file mode 100644
index 0000000000..6f47d92dd3
--- /dev/null
+++ b/app/test/test_cryptodev_asym_vectors.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_VECTORS_H_
+#define TEST_CRYPTODEV_ASYM_VECTORS_H_
+
+#include <stdint.h>
+#include "rte_crypto_asym.h"
+#include "test_cryptodev_asym_vectors_def.h"
+
+void atv_free(void *vct);
+
+struct asym_test_modex_vct *atv_modex(int *vct_nb);
+
+struct asym_test_rsa_vct *atv_rsa(int *vct_nb);
+
+#endif /* TEST_CRYPTODEV_ASYM_VECTORS_H_ */
diff --git a/app/test/test_cryptodev_asym_vectors_def.h b/app/test/test_cryptodev_asym_vectors_def.h
new file mode 100644
index 0000000000..b8d9c51f9b
--- /dev/null
+++ b/app/test/test_cryptodev_asym_vectors_def.h
@@ -0,0 +1,132 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_VECTORS_DEF_H__
+#define TEST_CRYPTODEV_ASYM_VECTORS_DEF_H__
+
+#include <stdint.h>
+
+#include "rte_crypto_asym.h"
+
+#define ASYM_DATA_SIZE 4096
+
+struct asym_test_rsa_vct {
+	enum rte_crypto_asym_xform_type xform_type;
+	char description[2048];
+	uint64_t op_type_flags;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} pt;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} ct;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} sign;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} digest;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} e;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} d;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} n;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} p;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} q;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} dP;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} dQ;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} qInv;
+
+	uint16_t result_len;
+	enum rte_crypto_rsa_padding_type padding;
+	int key_exp;
+	int key_qt;
+};
+
+struct asym_test_rsa_rule {
+	int key_size;
+	enum rte_crypto_rsa_priv_key_type key_type;
+	enum rte_crypto_rsa_padding_type padding;
+	int pt_len;
+	uint64_t operation;
+};
+
+struct asym_test_modex_vct {
+	enum rte_crypto_asym_xform_type xform_type;
+	char description[ASYM_DATA_SIZE];
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} base;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} exponent;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} modulus;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} reminder;
+	uint16_t result_len;
+};
+
+struct asym_test_modinv_vct {
+	enum rte_crypto_asym_xform_type xform_type;
+	char description[ASYM_DATA_SIZE];
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} base;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} modulus;
+	struct {
+		uint8_t data[ASYM_DATA_SIZE];
+		uint16_t len;
+	} inverse;
+	uint16_t result_len;
+};
+
+struct asym_test_modexp_rule {
+	int base_len;
+	int modulus_len;
+	int exponent_len;
+};
+
+struct asym_test_modinv_rule {
+	int base_len;
+	int modulus_len;
+};
+
+#endif /* TEST_CRYPTODEV_ASYM_VECTORS_DEF_H__ */
diff --git a/app/test/test_cryptodev_asym_vectors_rules.h b/app/test/test_cryptodev_asym_vectors_rules.h
new file mode 100644
index 0000000000..4e93df6f59
--- /dev/null
+++ b/app/test/test_cryptodev_asym_vectors_rules.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Intel Corporation
+ */
+
+#ifndef TEST_CRYPTODEV_ASYM_VECTORS_RULES_H__
+#define TEST_CRYPTODEV_ASYM_VECTORS_RULES_H__
+
+#include <stdint.h>
+
+#include "test_cryptodev_asym_vectors_def.h"
+
+static struct asym_test_rsa_rule asym_test_rsa_rules[] = {
+{
+	.key_size	= 1024,
+	.key_type	= RTE_RSA_KEY_TYPE_EXP,
+	.padding	= RTE_CRYPTO_RSA_PADDING_NONE,
+	.pt_len		= 128,
+	.operation	= (1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
+					(1UL << RTE_CRYPTO_ASYM_OP_DECRYPT)
+},
+{
+	.key_size	= 2048,
+	.key_type	= RTE_RSA_KEY_TYPE_EXP,
+	.padding	= RTE_CRYPTO_RSA_PADDING_NONE,
+	.pt_len		= 256,
+	.operation	= (1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
+					(1UL << RTE_CRYPTO_ASYM_OP_DECRYPT)
+},
+{
+	.key_size	= 4096,
+	.key_type	= RTE_RSA_KEY_TYPE_EXP,
+	.padding	= RTE_CRYPTO_RSA_PADDING_NONE,
+	.pt_len		= 512,
+	.operation	= (1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
+					(1UL << RTE_CRYPTO_ASYM_OP_DECRYPT)
+	},
+};
+
+static int asym_test_rsa_rules_size = (sizeof(asym_test_rsa_rules)
+		/ sizeof(*asym_test_rsa_rules));
+
+#endif /* TEST_CRYPTODEV_ASYM_VECTORS_RULES_H__ */
diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
index 8ae43d5f3d..6e289832b3 100644
--- a/lib/cryptodev/rte_crypto_asym.h
+++ b/lib/cryptodev/rte_crypto_asym.h
@@ -182,6 +182,7 @@ enum rte_crypto_rsa_priv_key_type {
 	/**< RSA private key is in quintuple format
 	 * See rte_crypto_rsa_priv_key_qt
 	 */
+	RTE_RSA_KEY_TYPE_LIST_END,
 };
 
 /**
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [EXT] [dpdk-dev v2] app/test: random test vectors for Asymc RSA
  2022-08-17 14:14 ` [dpdk-dev v2] " Przemyslaw Zegan
@ 2022-09-27 11:42   ` Gowrishankar Muthukrishnan
  0 siblings, 0 replies; 3+ messages in thread
From: Gowrishankar Muthukrishnan @ 2022-09-27 11:42 UTC (permalink / raw)
  To: Przemyslaw Zegan, dev; +Cc: Akhil Goyal, roy.fan.zhang

> -----Original Message-----
> From: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
> Sent: Wednesday, August 17, 2022 7:45 PM
> To: dev@dpdk.org
> Cc: Akhil Goyal <gakhil@marvell.com>; roy.fan.zhang@intel.com;
> Przemyslaw Zegan <przemyslawx.zegan@intel.com>
> Subject: [EXT] [dpdk-dev v2] app/test: random test vectors for Asymc RSA
> 
> External Email
> 
> ----------------------------------------------------------------------
> This patch add random test vectors generator for asymc RSA algorithm, base
> on OpenSSL 1.1.x lib.
> 
> Added functions for create RSA test vectors base on defined rules.
> The randome generated test vector include plaintext, RSA key in exponent
> and quintuple format, digest and expected cipher and sign.
> 
> Replace crypto_testsuite_params_asym struct from test_cryptodev_asym.c
> to test_cryptodev_asym_types.h, as it's used in other test suit.
> 
> Description of new files:
> test_cryptodev_asym_creator.c: generator for random plaintext
> test_cryptodev_asym_rsa_creator.c: RSA vector generator
> test_cryptodev_asym_rsa_creator.c RSA test suite
> test_cryptodev_asym_vectors.c: memory allocator for vectors
> 
> Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
> ---
> v2: fixed coding style issues
> ---
>  app/test/meson.build                         |   5 +
>  app/test/test_cryptodev_asym.c               |  63 ++--
>  app/test/test_cryptodev_asym_common.c        | 117 +++++++
>  app/test/test_cryptodev_asym_common.h        |  49 +++
>  app/test/test_cryptodev_asym_creator.c       |  42 +++
>  app/test/test_cryptodev_asym_creator.h       |  13 +
>  app/test/test_cryptodev_asym_rsa.c           | 309 +++++++++++++++++++
>  app/test/test_cryptodev_asym_rsa.h           |  17 +
>  app/test/test_cryptodev_asym_rsa_creator.c   | 145 +++++++++
>  app/test/test_cryptodev_asym_rsa_creator.h   |  16 +
>  app/test/test_cryptodev_asym_types.h         |  20 ++
>  app/test/test_cryptodev_asym_vectors.c       |  31 ++
>  app/test/test_cryptodev_asym_vectors.h       |  18 ++
>  app/test/test_cryptodev_asym_vectors_def.h   | 132 ++++++++
>  app/test/test_cryptodev_asym_vectors_rules.h |  42 +++
>  lib/cryptodev/rte_crypto_asym.h              |   1 +
>  16 files changed, 986 insertions(+), 34 deletions(-)  create mode 100644
> app/test/test_cryptodev_asym_common.c
>  create mode 100644 app/test/test_cryptodev_asym_common.h
>  create mode 100644 app/test/test_cryptodev_asym_creator.c
>  create mode 100644 app/test/test_cryptodev_asym_creator.h
>  create mode 100644 app/test/test_cryptodev_asym_rsa.c
>  create mode 100644 app/test/test_cryptodev_asym_rsa.h
>  create mode 100644 app/test/test_cryptodev_asym_rsa_creator.c
>  create mode 100644 app/test/test_cryptodev_asym_rsa_creator.h
>  create mode 100644 app/test/test_cryptodev_asym_types.h
>  create mode 100644 app/test/test_cryptodev_asym_vectors.c
>  create mode 100644 app/test/test_cryptodev_asym_vectors.h
>  create mode 100644 app/test/test_cryptodev_asym_vectors_def.h
>  create mode 100644 app/test/test_cryptodev_asym_vectors_rules.h
> 
> diff --git a/app/test/meson.build b/app/test/meson.build index
> 431c5bd318..8dc5a3e516 100644
> --- a/app/test/meson.build
> +++ b/app/test/meson.build
> @@ -146,6 +146,11 @@ test_sources = files(
>          'test_trace_perf.c',
>          'test_version.c',
>          'virtual_pmd.c',
> +        'test_cryptodev_asym_common.c',
> +        'test_cryptodev_asym_vectors.c',
> +        'test_cryptodev_asym_rsa.c',
> +        'test_cryptodev_asym_rsa_creator.c',
> +        'test_cryptodev_asym_creator.c'
>  )
> 
>  test_deps = enabled_libs
> diff --git a/app/test/test_cryptodev_asym.c
> b/app/test/test_cryptodev_asym.c index fc1a727472..b692af3760 100644
> --- a/app/test/test_cryptodev_asym.c
> +++ b/app/test/test_cryptodev_asym.c
> @@ -23,6 +23,8 @@
>  #include "test_cryptodev_rsa_test_vectors.h"
>  #include "test_cryptodev_asym_util.h"
>  #include "test.h"
> +#include "test_cryptodev_asym_types.h"
> +#include "test_cryptodev_asym_rsa.h"
> 
>  #define TEST_NUM_BUFS 10
>  #define TEST_NUM_SESSIONS 4
> @@ -34,14 +36,6 @@
>  #define TEST_VECTOR_SIZE 256
> 
>  static int gbl_driver_id;
> -struct crypto_testsuite_params_asym {
> -	struct rte_mempool *op_mpool;
> -	struct rte_mempool *session_mpool;
> -	struct rte_cryptodev_config conf;
> -	struct rte_cryptodev_qp_conf qp_conf;
> -	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
> -	uint8_t valid_dev_count;
> -};
> 
>  struct crypto_unittest_params {
>  	void *sess;
> @@ -62,12 +56,12 @@ static struct test_cases_array test_vector = {0, { NULL
> } };
> 
>  static uint32_t test_index;
> 
> -static struct crypto_testsuite_params_asym testsuite_params = { NULL };
> +struct crypto_testsuite_params_asym testsuite_params_asym = { NULL };

Coul this variable rename be avoided here, as we have many patch hunks below
because of it.

> 
>  static int
>  queue_ops_rsa_sign_verify(void *sess)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	struct rte_mempool *op_mpool = ts_params->op_mpool;
>  	uint8_t dev_id = ts_params->valid_devs[0];
>  	struct rte_crypto_op *op, *result_op;
> @@ -158,7 +152,7 @@ queue_ops_rsa_sign_verify(void *sess)  static int
> queue_ops_rsa_enc_dec(void *sess)  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	struct rte_mempool *op_mpool = ts_params->op_mpool;
>  	uint8_t dev_id = ts_params->valid_devs[0];
>  	struct rte_crypto_op *op, *result_op;
> @@ -524,7 +518,7 @@ test_one_case(const void *test_case, int sessionless)
> 
>  	if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_MODEX
>  			|| tc.modex.xform_type ==
> RTE_CRYPTO_ASYM_XFORM_MODINV) {
> -		status = test_cryptodev_asym_op(&testsuite_params, &tc,
> test_msg,
> +		status =
> test_cryptodev_asym_op(&testsuite_params_asym, &tc,
> +test_msg,
>  				sessionless, 0, 0);
>  		printf("  %u) TestCase %s %s\n", test_index++,
>  			tc.modex.description, test_msg);
> @@ -534,7 +528,7 @@ test_one_case(const void *test_case, int sessionless)
>  				if (tc.rsa_data.op_type_flags & (1 << i)) {
>  					if (tc.rsa_data.key_exp) {
>  						status =
> test_cryptodev_asym_op(
> -							&testsuite_params,
> &tc,
> +
> 	&testsuite_params_asym, &tc,
>  							test_msg,
> sessionless, i,
> 
> 	RTE_RSA_KEY_TYPE_EXP);
>  					}
> @@ -544,7 +538,7 @@ test_one_case(const void *test_case, int sessionless)
> 
> 	RTE_CRYPTO_ASYM_OP_DECRYPT ||
>  							i ==
> RTE_CRYPTO_ASYM_OP_SIGN)) {
>  						status =
> test_cryptodev_asym_op(
> -							&testsuite_params,
> +
> 	&testsuite_params_asym,
>  							&tc, test_msg,
> sessionless, i,
> 
> 	RTE_RSA_KEY_TYPE_QT);
>  					}
> @@ -604,7 +598,7 @@ static int
>  test_one_by_one(void)
>  {
>  	int status = TEST_SUCCESS;
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	uint32_t i = 0;
>  	uint8_t dev_id = ts_params->valid_devs[0];
>  	struct rte_cryptodev_info dev_info;
> @@ -637,7 +631,7 @@ test_one_by_one(void)  static int
>  test_rsa_sign_verify(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	struct rte_mempool *sess_mpool = ts_params->session_mpool;
>  	uint8_t dev_id = ts_params->valid_devs[0];
>  	void *sess = NULL;
> @@ -677,7 +671,7 @@ test_rsa_sign_verify(void)  static int
>  test_rsa_enc_dec(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	struct rte_mempool *sess_mpool = ts_params->session_mpool;
>  	uint8_t dev_id = ts_params->valid_devs[0];
>  	void *sess = NULL;
> @@ -717,7 +711,7 @@ test_rsa_enc_dec(void)  static int
>  test_rsa_sign_verify_crt(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	struct rte_mempool *sess_mpool = ts_params->session_mpool;
>  	uint8_t dev_id = ts_params->valid_devs[0];
>  	void *sess = NULL;
> @@ -757,7 +751,7 @@ test_rsa_sign_verify_crt(void)  static int
>  test_rsa_enc_dec_crt(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	struct rte_mempool *sess_mpool = ts_params->session_mpool;
>  	uint8_t dev_id = ts_params->valid_devs[0];
>  	void *sess = NULL;
> @@ -797,7 +791,7 @@ test_rsa_enc_dec_crt(void)  static int
>  testsuite_setup(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
>  	struct rte_cryptodev_info info;
>  	int ret, dev_id = -1;
> @@ -902,7 +896,7 @@ testsuite_setup(void)  static void
>  testsuite_teardown(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
> 
>  	if (ts_params->op_mpool != NULL) {
>  		RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
> @@ -919,7 +913,7 @@ testsuite_teardown(void)  static int
>  ut_setup_asym(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
> 
>  	uint16_t qp_id;
> 
> @@ -953,7 +947,7 @@ ut_setup_asym(void)
>  static void
>  ut_teardown_asym(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	struct rte_cryptodev_stats stats;
> 
>  	rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats); @@ -
> 1002,7 +996,7 @@ static inline void print_asym_capa(  static int
>  test_capability(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	uint8_t dev_id = ts_params->valid_devs[0];
>  	struct rte_cryptodev_info dev_info;
>  	const struct rte_cryptodev_capabilities *dev_capa; @@ -1039,7
> +1033,7 @@ test_capability(void)  static int  test_dh_gen_shared_sec(struct
> rte_crypto_asym_xform *xfrm)  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	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]; @@ -1121,7 +1115,7 @@
> test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)  static int
> test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	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]; @@ -1201,7 +1195,7 @@
> test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)  static int
> test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	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]; @@ -1289,7 +1283,7 @@
> test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)  static int
> test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	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]; @@ -1375,7 +1369,7 @@
> test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)  static int
>  test_mod_inv(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	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]; @@ -1487,7 +1481,7 @@
> test_mod_inv(void)  static int
>  test_mod_exp(void)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	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]; @@ -1635,7 +1629,7 @@
> test_dh_keygenration(void)  static int  test_dsa_sign(struct
> rte_crypto_dsa_op_param *dsa_op)  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	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]; @@ -1718,7 +1712,7 @@
> test_dsa_sign(struct rte_crypto_dsa_op_param *dsa_op)  static int
> test_dsa_verify(struct rte_crypto_dsa_op_param *dsa_op)  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	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]; @@ -1831,7 +1825,7 @@
> test_dsa(void)  static int  test_ecdsa_sign_verify(enum curve curve_id)  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	struct rte_mempool *sess_mpool = ts_params->session_mpool;
>  	struct rte_mempool *op_mpool = ts_params->op_mpool;
>  	struct crypto_testsuite_ecdsa_params input_params; @@ -2032,7
> +2026,7 @@ test_ecdsa_sign_verify_all_curve(void)
>  static int
>  test_ecpm(enum curve curve_id)
>  {
> -	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params;
> +	struct crypto_testsuite_params_asym *ts_params =
> +&testsuite_params_asym;
>  	struct rte_mempool *sess_mpool = ts_params->session_mpool;
>  	struct rte_mempool *op_mpool = ts_params->op_mpool;
>  	struct crypto_testsuite_ecpm_params input_params; @@ -2219,6
> +2213,7 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite  = {
>  	.teardown = testsuite_teardown,
>  	.unit_test_cases = {
>  		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
> test_one_by_one),
> +		TEST_CASE_ST(ats_rsa_setup, ats_rsa_teardown,
> ats_rsa_run),
>  		TEST_CASES_END() /**< NULL terminate unit test array */
>  	}
>  };
> diff --git a/app/test/test_cryptodev_asym_common.c
> b/app/test/test_cryptodev_asym_common.c
> new file mode 100644
> index 0000000000..f0e3987db8
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_common.c
> @@ -0,0 +1,117 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#include <stdint.h>
> +
> +#include "test_cryptodev_asym_common.h"
> +#include "test.h"
This test.h could below the one below.

> +#include "test_cryptodev.h"
> +
> +int ats_common_setup(struct crypto_testsuite_params_asym *ts) {
> +	uint16_t qp_id;
> +
> +	/* Reconfigure device to default parameters */
> +	ts->conf.socket_id = SOCKET_ID_ANY;
> +
> +	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts->valid_devs[0],
> +			&ts->conf),
> +			"Failed to configure cryptodev %u",
> +			ts->valid_devs[0]);
> +
> +	for (qp_id = 0; qp_id < ts->conf.nb_queue_pairs ; qp_id++) {
> +		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
> +			ts->valid_devs[0], qp_id,
> +			&ts->qp_conf,
> +			rte_cryptodev_socket_id(ts->valid_devs[0])),
> +			"Failed to setup queue pair %u on cryptodev %u",
> +			qp_id, ts->valid_devs[0]);
> +	}
> +
> +	rte_cryptodev_stats_reset(ts->valid_devs[0]);
> +
> +	/* Start the device */
> +	TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts->valid_devs[0]),
> +						"Failed to start cryptodev
> %u",
> +						ts->valid_devs[0]);
> +
> +	return TEST_SUCCESS;
> +}
> +
> +void ats_common_teardown(struct crypto_testsuite_params_asym *ts) {
> +	struct rte_cryptodev_stats stats;
> +
> +	rte_cryptodev_stats_get(ts->valid_devs[0], &stats);
> +
Any purpose _stats_get called for here ?

> +	rte_cryptodev_stop(ts->valid_devs[0]);
> +}
> +
> +void ats_err_msg_cap(void)
> +{
> +	RTE_LOG(INFO, USER1, "Device doesn't support MODEX. Test
> Skipped\n");
> +}
> +
> +void ats_err_msg_op(char *msg, uint32_t len, uint32_t line) {
> +	snprintf(msg, len,
> +		"line %u FAILED: %s", line,
> +		"Failed to allocate asymmetric crypto operation struct"); }
" Failed to allocate struct for asymmetirc crypto op" .. 

> +
> +void ats_err_msg_mod_len(char *msg, uint32_t len, uint32_t line) {
> +	snprintf(msg, len,
> +		"line %u FAILED: %s", line,
> +		"Invalid MODULUS length specified");
Except for library mnemonics like ASYM, RSA, we can avoid capital letters IMO - "modulus".

> +}
> +
> +void ats_err_msg_inv_alg(char *msg, uint32_t len, uint32_t line) {
> +	snprintf(msg, len,
> +		"line %u FAILED: %s", line,
> +		"Invalid ASYM algorithm specified");
> +}
> +
> +void ats_err_msg_sess_create(char *msg, uint32_t len, uint32_t line) {
> +	snprintf(msg, len,
> +		"line %u FAILED: %s", line,
> +		"Session creation failed");
> +}
> +
> +void ats_err_msg_sess_init(char *msg, uint32_t len, uint32_t line) {
> +	snprintf(msg, len,
> +		"line %u FAILED: %s", line,
> +		"unabled to config sym session");
"Unable to config SYM session" ?

> +}
> +
> +void ats_err_msg_enque(char *msg, uint32_t len, uint32_t line) {
> +	snprintf(msg, len,
> +		"line %u FAILED: %s", line,
> +		"Error sending packet for operation"); }
> +
> +void ats_err_msg_burst(char *msg, uint32_t len, uint32_t line) {
> +	snprintf(msg, len,
> +		"line %u FAILED: %s", line,
> +		"Error sending packet for operation"); }
"multiple packets" ?

> +
> +void ats_err_msg_deq(char *msg, uint32_t len, uint32_t line) {
> +	snprintf(msg, len,
> +		"line %u FAILED: %s", line,
> +		"Failed to process asym crypto op");

"ASYM" just for uniformity.

> +}
> +
> +void ats_err_msg_ver(char *msg, uint32_t len, uint32_t line) {
> +	snprintf(msg, len,
> +			"line %u FAILED: %s", line,
> +			"Verification failed ");
> +}
> diff --git a/app/test/test_cryptodev_asym_common.h
> b/app/test/test_cryptodev_asym_common.h
> new file mode 100644
> index 0000000000..f61e49f5dc
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_common.h
> @@ -0,0 +1,49 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#ifndef TEST_CRYPTODEV_ASYM_COMMON_H_
> +#define TEST_CRYPTODEV_ASYM_COMMON_H_
> +
> +#include <stdlib.h>
> +#include <stdint.h>
> +
> +#include <rte_bus_vdev.h>
> +#include <rte_common.h>
> +#include <rte_hexdump.h>
> +#include <rte_mbuf.h>
> +#include <rte_malloc.h>
> +#include <rte_memcpy.h>
> +#include <rte_pause.h>
> +
> +#include <rte_cryptodev.h>
> +#include <rte_crypto.h>
> +
> +#include "test_cryptodev_asym_types.h"
> +
> +int ats_common_setup(struct crypto_testsuite_params_asym *ts);
> +
> +void ats_common_teardown(struct crypto_testsuite_params_asym *ts);
> +
> +void ats_err_msg_cap(void);
> +
> +void ats_err_msg_op(char *msg, uint32_t len, uint32_t line);
> +
> +void ats_err_msg_mod_len(char *msg, uint32_t len, uint32_t line);
> +
> +void ats_err_msg_inv_alg(char *msg, uint32_t len, uint32_t line);
> +
> +void ats_err_msg_sess_create(char *msg, uint32_t len, uint32_t line);
> +
> +void ats_err_msg_sess_init(char *msg, uint32_t len, uint32_t line);
> +
> +void ats_err_msg_enque(char *msg, uint32_t len, uint32_t line);
> +
> +void ats_err_msg_burst(char *msg, uint32_t len, uint32_t line);
> +
> +void ats_err_msg_deq(char *msg, uint32_t len, uint32_t line);
> +
> +void ats_err_msg_ver(char *msg, uint32_t len, uint32_t line);
> +
> +
> +#endif /* TEST_CRYPTODEV_ASYM_COMMON_H_ */
> diff --git a/app/test/test_cryptodev_asym_creator.c
> b/app/test/test_cryptodev_asym_creator.c
> new file mode 100644
> index 0000000000..2be9755791
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_creator.c
> @@ -0,0 +1,42 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <stdint.h>
> +#include <string.h>
> +
> +#include <sys/time.h>
> +
#ifdef USE_OPENSSL
> +#include <openssl/bn.h>
> +#include <openssl/rand.h>
> +
I am adding RTE_HAS_OPENSSL in
 https://patches.dpdk.org/project/dpdk/patch/da6c7aec7de7da40883d3dc2ce4792ef7969c958.1664263264.git.gmuthukrishn@marvell.com/

We can add dependency with openssl here.

However, I could not find any openSSL fn used in this .c file.

> +#include "test_cryptodev_asym_creator.h"
> +
> +int atv_create_data(uint8_t *data, int len) {
> +	struct timespec ts;
> +	struct timeval tv;
> +	int i;
> +
> +	ts.tv_sec = 0;
> +	ts.tv_nsec = 10000000;
> +	nanosleep(&ts, NULL);
> +
> +	gettimeofday(&tv, NULL);
> +	int seed = 1000000 * tv.tv_sec + tv.tv_usec;
> +
> +	srand(seed);
> +
> +	memset(data, 0, len);
> +
> +	int *dt = (int *) data;
> +	int ln = len / sizeof(int);
> +
> +	for (i = 0; i < ln; i++)
> +		dt[i] = rand();
> +
> +	return 0;
> +}
> +
> diff --git a/app/test/test_cryptodev_asym_creator.h
> b/app/test/test_cryptodev_asym_creator.h
> new file mode 100644
> index 0000000000..9587fadb55
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_creator.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#ifndef TEST_CRYPTODEV_ASYM_CREATOR_H_
> +#define TEST_CRYPTODEV_ASYM_CREATOR_H_
> +
> +#include <stdlib.h>
> +#include <stdint.h>
> +
> +int atv_create_data(uint8_t *data, int len);
> +
> +#endif /* TEST_CRYPTODEV_ASYM_CREATOR_H_ */
> diff --git a/app/test/test_cryptodev_asym_rsa.c
> b/app/test/test_cryptodev_asym_rsa.c
> new file mode 100644
> index 0000000000..6f90877e6c
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_rsa.c
> @@ -0,0 +1,309 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#include "test_cryptodev_asym_common.h"
> +#include "test_cryptodev_asym_rsa.h"
> +#include "test_cryptodev_asym_vectors.h"
> +
> +#include "test.h"
> +#include "test_cryptodev.h"
> +#include "test_cryptodev_asym_types.h"
> +#include "test_cryptodev_asym_vectors.h"
> +
> +#define ASYM_TEST_MSG_LEN 256
(256)
> +#define TEST_DATA_SIZE 4096
(4096)
> +
> +struct crypto_unittest_params {
> +	struct rte_cryptodev_asym_session *sess;
> +	struct rte_crypto_op *op;
> +};
> +
> +static struct asym_test_rsa_vct *vct;
> +static int vct_nb;
"vec" could be used as variable name for test vector purpose, but up to you.

> +
> +extern struct crypto_testsuite_params_asym testsuite_params_asym;
> +
> +int ats_rsa_setup(void)
> +{
> +	vct = atv_rsa(&vct_nb);
> +
Check for atv_rsa return status.

> +	int status = ats_common_setup(&testsuite_params_asym);
> +
> +	return status;
> +}
> +
> +void ats_rsa_teardown(void)
> +{
> +	atv_free(vct);
> +
> +	ats_common_teardown(&testsuite_params_asym);
> +}
> +
> +static int ats_case_rsa_op(struct crypto_testsuite_params_asym
> *ts_params,
> +		struct asym_test_rsa_vct *data_tc, char *test_msg, int

tc_data may suite better than data_tc for uniformity here.
tc_msg instead of test_msg .

> sessionless,
> +		enum rte_crypto_asym_op_type op_type,
> +		enum rte_crypto_rsa_priv_key_type key_type) {
> +	struct rte_crypto_asym_op *asym_op = NULL;
> +	struct rte_crypto_op *op = NULL;
> +	struct rte_crypto_op *result_op = NULL;
> +	struct rte_crypto_asym_xform xform_tc;
> +	void *sess = NULL;
> +	struct rte_cryptodev_asym_capability_idx cap_idx;
> +	const struct rte_cryptodev_asymmetric_xform_capability
> *capability;
> +	uint8_t dev_id = ts_params->valid_devs[0];
> +	uint8_t *result = NULL;
> +	uint8_t *data_expected = NULL, *data_received = NULL;
> +	size_t data_size = 0;
> +
Like in other places, my suggestion to arrange vars declaration in some
inverted tree format just for easier readability.
    var aaaaa = 11;
    var bbb = 12;
    var c = 3;

> +	int ret, status = TEST_SUCCESS;
> +
> +	xform_tc.next = NULL;
> +	xform_tc.xform_type = data_tc->xform_type;
> +
> +	cap_idx.type = xform_tc.xform_type;
> +	capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
> +
> +	if (capability == NULL) {
> +		ats_err_msg_cap();
> +		return TEST_SKIPPED;
> +	}
> +
> +	/* Generate crypto op data structure */
> +	op = rte_crypto_op_alloc(ts_params->op_mpool,
> +			RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
> +
> +	if (!op) {
> +		ats_err_msg_op(test_msg, ASYM_TEST_MSG_LEN,
> __LINE__);
> +		status = TEST_FAILED;
> +		goto error_exit;
> +	}
> +
> +	asym_op = op->asym;
> +
> +	switch (xform_tc.xform_type) {
> +	case RTE_CRYPTO_ASYM_XFORM_RSA:
> +		result = rte_zmalloc(NULL, data_tc->n.len, 0);
> +		op->asym->rsa.op_type = op_type;
asym_op->rsa.op_type

> +		xform_tc.rsa.e.data = data_tc->e.data;
> +		xform_tc.rsa.e.length = data_tc->e.len;
> +		xform_tc.rsa.n.data = data_tc->n.data;
> +		xform_tc.rsa.n.length = data_tc->n.len;
> +
> +		if (key_type == RTE_RSA_KEY_TYPE_EXP) {
> +			xform_tc.rsa.d.data = data_tc->d.data;
> +			xform_tc.rsa.d.length = data_tc->d.len;
> +		} else {
> +			xform_tc.rsa.qt.p.data = data_tc->p.data;
> +			xform_tc.rsa.qt.p.length = data_tc->p.len;
> +			xform_tc.rsa.qt.q.data = data_tc->q.data;
> +			xform_tc.rsa.qt.q.length = data_tc->q.len;
> +			xform_tc.rsa.qt.dP.data = data_tc->dP.data;
> +			xform_tc.rsa.qt.dP.length = data_tc->dP.len;
> +			xform_tc.rsa.qt.dQ.data = data_tc->dQ.data;
> +			xform_tc.rsa.qt.dQ.length = data_tc->dQ.len;
> +			xform_tc.rsa.qt.qInv.data = data_tc->qInv.data;
> +			xform_tc.rsa.qt.qInv.length = data_tc->qInv.len;
> +		}
> +
> +		xform_tc.rsa.key_type = key_type;
> +		op->asym->rsa.padding.type = data_tc->padding;
> +
> +		if (op->asym->rsa.op_type ==
> RTE_CRYPTO_ASYM_OP_ENCRYPT) {
> +			asym_op->rsa.message.data = data_tc->pt.data;
> +			asym_op->rsa.message.length = data_tc->pt.len;
> +			asym_op->rsa.cipher.data = result;
> +			asym_op->rsa.cipher.length = data_tc->n.len;
> +		} else if (op->asym->rsa.op_type ==
> RTE_CRYPTO_ASYM_OP_DECRYPT) {
> +			asym_op->rsa.message.data = result;
> +			asym_op->rsa.message.length = 0;
> +			asym_op->rsa.cipher.data = data_tc->ct.data;
> +			asym_op->rsa.cipher.length = data_tc->ct.len;
> +		} else if (op->asym->rsa.op_type ==
> RTE_CRYPTO_ASYM_OP_SIGN) {
> +			asym_op->rsa.sign.data = result;
> +			asym_op->rsa.sign.length = data_tc->n.len;
> +			asym_op->rsa.message.data = data_tc->digest.data;
> +			asym_op->rsa.message.length = data_tc->digest.len;
> +		} else if (op->asym->rsa.op_type ==
> RTE_CRYPTO_ASYM_OP_VERIFY) {
> +			asym_op->rsa.cipher.data = result;
> +			asym_op->rsa.cipher.length = data_tc->n.len;
> +			asym_op->rsa.sign.data = data_tc->sign.data;
> +			asym_op->rsa.sign.length = data_tc->sign.len;
> +		}
> +		break;
> +
> +	default:
> +		ats_err_msg_inv_alg(test_msg, ASYM_TEST_MSG_LEN,
> __LINE__);
> +		status = TEST_FAILED;
> +		goto error_exit;
> +	}
> +
> +	if (!sessionless) {
> +		ret = rte_cryptodev_asym_session_create(dev_id,
> &xform_tc,
> +				ts_params->session_mpool, &sess);
> +		if (ret < 0) {
> +			ats_err_msg_sess_create(test_msg,
> ASYM_TEST_MSG_LEN, __LINE__);
> +			status = (ret == -ENOTSUP) ? TEST_SKIPPED :
> 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 */
> +	if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
> +		ats_err_msg_enque(test_msg, ASYM_TEST_MSG_LEN,
> __LINE__);
> +		status = TEST_FAILED;
> +		goto error_exit;
> +	}
> +
> +	while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) ==
> 0)
> +		rte_pause();
> +
> +	if (result_op == NULL) {
> +		ats_err_msg_deq(test_msg, ASYM_TEST_MSG_LEN,
> __LINE__);
> +		status = TEST_FAILED;
> +		goto error_exit;
> +	}
> +
> +	if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_ENCRYPT) {
> +		data_size = xform_tc.rsa.n.length;
> +		data_received = result_op->asym->rsa.cipher.data;
> +		data_expected = data_tc->ct.data;
> +	} else if (op->asym->rsa.op_type ==
> RTE_CRYPTO_ASYM_OP_DECRYPT) {
> +		data_size = xform_tc.rsa.n.length;
> +		data_expected = data_tc->pt.data;
> +		data_received = result_op->asym->rsa.message.data;
> +	} else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_SIGN) {
> +		data_size = xform_tc.rsa.n.length;
> +		data_expected = data_tc->sign.data;
> +		data_received = result_op->asym->rsa.sign.data;
> +	} else if (op->asym->rsa.op_type ==
> RTE_CRYPTO_ASYM_OP_VERIFY) {
> +		data_size = xform_tc.rsa.n.length;
> +		data_expected = data_tc->digest.data;
> +		data_received = result_op->asym->rsa.cipher.data;
> +	}
> +
> +	if ((memcmp(data_expected, data_received, data_size) != 0)
> +			|| (data_size == 0)) {
> +		ats_err_msg_ver(test_msg, ASYM_TEST_MSG_LEN,
> __LINE__);
> +		status = TEST_FAILED;
> +		goto error_exit;
> +	}
> +
> +error_exit:
> +	if (sess != NULL)
> +		rte_cryptodev_asym_session_free(dev_id, sess);
> +
> +	if (op != NULL)
> +		rte_crypto_op_free(op);
> +
> +	if (result != NULL)
> +		rte_free(result);
> +
> +	return status;
> +}
> +
> +int ats_rsa_run(void)
> +{
> +	int status = TEST_SUCCESS;
> +	int i, key_type;
> +	char test_msg[ASYM_TEST_MSG_LEN + 1];
> +	int sessionless = 0;
> +	struct crypto_testsuite_params_asym *ts_params =
> &testsuite_params_asym;
> +	uint8_t dev_id = ts_params->valid_devs[0];
> +	struct rte_cryptodev_info dev_info;
> +
> +	rte_cryptodev_info_get(dev_id, &dev_info);
> +	if ((dev_info.feature_flags &
> +	RTE_CRYPTODEV_FF_ASYM_SESSIONLESS)) {
> +		sessionless = 1;
> +	}
> +
> +	for (i = 0; i < vct_nb; i++) {
> +
> +		printf("\n  %u) TestSubCase %s - %s\n", i + 1,
> vct[i].description,
> +				test_msg);
> +		debug_hexdump(stdout, "plaintext:", vct[i].pt.data,
> vct[i].pt.len);
> +		debug_hexdump(stdout, "ciphertext:", vct[i].ct.data,
> vct[i].ct.len);
> +		debug_hexdump(stdout, "digest:", vct[i].digest.data,
> vct[i].digest.len);
> +		debug_hexdump(stdout, "sign:", vct[i].sign.data,
> vct[i].sign.len);
> +
> +		debug_hexdump(stdout, "e:", vct[i].e.data, vct[i].e.len);
> +		debug_hexdump(stdout, "d:", vct[i].d.data, vct[i].d.len);
> +		debug_hexdump(stdout, "n:", vct[i].n.data, vct[i].n.len);
> +		debug_hexdump(stdout, "p:", vct[i].p.data, vct[i].p.len);
> +		debug_hexdump(stdout, "q:", vct[i].q.data, vct[i].q.len);
> +		debug_hexdump(stdout, "dP:", vct[i].dP.data, vct[i].dP.len);
> +		debug_hexdump(stdout, "dQ:", vct[i].dQ.data,
> vct[i].dQ.len);
> +		debug_hexdump(stdout, "qInv:", vct[i].qInv.data,
> vct[i].qInv.len);
> +
> +		for (key_type = RTE_RSA_KEY_TYPE_EXP;
> +				key_type < RTE_RSA_KEY_TYPE_LIST_END;

Only two key types we have at the moment (QT and EXP). Adding LIST_END is
unnecessarily touching lib/crypto. Could this be handled accordingly here ?
Same thing can be done like:

for (int i=0; i<2; i++) {
  if (i == RTE_RSA_KEY_TYPE_EXP) 
   ..
  else if (I == RTE_RSA_KEY_TYPE_QT)
  ..
  else
     error
  ...
} 

Also check if dev supports respective key type before calling each test.

> key_type++) {
> +
> +			int sess = 0;
> +
> +			if (key_type == 0)
> +				printf("\n    RSA key is an exponent:\n");
> +			else
> +				printf("    RSA key is in quintuple format:\n");
> +			do {
> +				if (sess == 1 && sessionless != 1)
> +					break;
> +
> +				if (sess == 0)
> +					printf("\n    With Session:\n");
> +				else
> +					printf("\n    Without Session:\n");
> +
> +				if
> (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
> +						test_msg, sess,
> RTE_CRYPTO_ASYM_OP_ENCRYPT,
> +						key_type) != TEST_SUCCESS)
> {
> +					printf("    %-20s: %s\n", "Encryption",
> "FAIL");
> +					status = TEST_FAILED;
> +				} else {
> +					printf("    %-20s: %s\n", "Encryption",
> "PASS");
> +				}
> +
> +				if
> (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
> +						test_msg, sess,
> RTE_CRYPTO_ASYM_OP_DECRYPT,
> +						key_type) != TEST_SUCCESS)
> {
> +					printf("    %-20s: %s\n", "Decryption",
> "FAIL");
> +					status = TEST_FAILED;
> +				} else {
> +					printf("    %-20s: %s\n", "Decryption",
> "PASS");
> +				}
> +
> +				if
> (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
> +						test_msg, sess,
> RTE_CRYPTO_ASYM_OP_SIGN,
> +						key_type) != TEST_SUCCESS)
> {
> +					printf("    %-20s: %s\n", "Sign",
> "FAIL");
> +					status = TEST_FAILED;
> +				} else {
> +					printf("    %-20s: %s\n", "Sign",
> "PASS");
> +				}
> +
> +				if
> (ats_case_rsa_op(&testsuite_params_asym, &vct[sess],
> +						test_msg, sess,
> RTE_CRYPTO_ASYM_OP_VERIFY,
> +						key_type) != TEST_SUCCESS)
> {
> +					printf("    %-20s: %s\n", "Verify",
> "FAIL");
> +					status = TEST_FAILED;
> +				} else {
> +					printf("    %-20s: %s\n", "Verify",
> "PASS");
> +				}
> +
> +				sess++;
> +
> +			} while (sess <= 1);
> +			printf("\n");
> +		}
> +	}
> +
> +	TEST_ASSERT_EQUAL(status, 0, "Test failed");
> +	return status;
> +}
> diff --git a/app/test/test_cryptodev_asym_rsa.h
> b/app/test/test_cryptodev_asym_rsa.h
> new file mode 100644
> index 0000000000..055bb77700
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_rsa.h
> @@ -0,0 +1,17 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#ifndef TEST_CRYPTODEV_ASYM_RSA_H_
> +#define TEST_CRYPTODEV_ASYM_RSA_H_
> +
> +#include <stdlib.h>
> +#include <stdint.h>
> +
> +int ats_rsa_setup(void);
> +
> +void ats_rsa_teardown(void);
> +
> +int ats_rsa_run(void);
> +
> +#endif /* TEST_CRYPTODEV_ASYM_RSA_H_ */
> diff --git a/app/test/test_cryptodev_asym_rsa_creator.c
> b/app/test/test_cryptodev_asym_rsa_creator.c
> new file mode 100644
> index 0000000000..7c031721af
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_rsa_creator.c
> @@ -0,0 +1,145 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <stdint.h>
> +#include <string.h>
> +
> +#include <time.h>
> +
> +#include <openssl/bn.h>
> +#include <openssl/rand.h>
> +#include <openssl/rsa.h>
> +#include <openssl/engine.h>
> +#include <rte_crypto.h>

Use USE_OPENSSL as mentioned earlier here and don't run tests if openssl not installed.

> +
> +#include "test_cryptodev_asym_rsa_creator.h"
> +#include "test_cryptodev_asym_creator.h"
> +
> +static int rsa_result(RSA *rsa, struct asym_test_rsa_vct *vct,
> +		enum rte_crypto_rsa_padding_type padding) {
> +	int clen, state = 0;
> +	int padding_rsa;
> +	unsigned char digest[SHA256_DIGEST_LENGTH];
> +
> +	if (padding == RTE_CRYPTO_RSA_PADDING_PKCS1_5)
> +		padding_rsa = RSA_PKCS1_PADDING;
> +	else
> +		padding_rsa = RSA_NO_PADDING;
> +
> +	clen = RSA_public_encrypt(vct->pt.len, vct->pt.data, vct->ct.data,
> rsa,
> +			padding_rsa);
> +
> +	if (clen >= 0)
> +		vct->ct.len = clen;
> +	else
> +		goto err;
> +
> +	unsigned char dec_buffer[ASYM_DATA_SIZE] = { 0 };
> +	clen = RSA_private_decrypt(vct->ct.len, vct->ct.data, dec_buffer,
> rsa,
> +			padding_rsa);
> +
> +	if (memcmp(dec_buffer, vct->pt.data, vct->pt.len) != 0)
> +		goto err;
> +
> +	SHA256(vct->pt.data, vct->pt.len, digest);
> +
> +	if (padding_rsa == RSA_NO_PADDING) {
> +		int rsa_size = RSA_size(rsa);
> +		if (RSA_padding_add_PKCS1_type_1(vct->digest.data,
> rsa_size, digest,
> +				SHA256_DIGEST_LENGTH) != 1)
> +			goto err;
> +
> +		vct->digest.len = rsa_size;
> +	} else {
> +		memcpy(vct->digest.data, digest, SHA256_DIGEST_LENGTH);
> +		vct->digest.len = SHA256_DIGEST_LENGTH;
> +	}
> +
> +	clen = RSA_private_encrypt(vct->digest.len, vct->digest.data,
> +			vct->sign.data, rsa, padding_rsa);
> +
> +	if (clen >= 0)
> +		vct->sign.len = clen;
> +	else
> +		goto err;
> +
> +	state = 1;
> +
> +err:
> +	return state;
> +}
> +
> +int atv_rsa_creator(struct asym_test_rsa_vct *vct,
> +		struct asym_test_rsa_rule *rule)
> +{
> +	int ret;
> +	BN_CTX *ctx = NULL;
> +	RSA *rsa = NULL;
> +	BIGNUM *exp = NULL;
> +
> +	const BIGNUM *n = NULL;
> +	const BIGNUM *e = NULL;
> +	const BIGNUM *p = NULL;
> +	const BIGNUM *d = NULL;
> +	const BIGNUM *q = NULL;
> +	const BIGNUM *dmp1 = NULL;
> +	const BIGNUM *dmq1 = NULL;
> +	const BIGNUM *iqmp = NULL;
> +
> +	for (;;) {
Can you put some limitation on loop count here ?

> +		vct->pt.len = rule->pt_len;
> +		atv_create_data(vct->pt.data, vct->pt.len);
> +		vct->pt.data[0] = 0xAA;
> +
> +		ctx = BN_CTX_new();
> +		rsa = RSA_new();
> +		exp = BN_new();
> +
> +		ret = BN_set_word(exp, RSA_F4);
> +		if (ret == 0)
> +			goto err;
> +
> +		ret = RSA_generate_key_ex(rsa, rule->key_size, exp, NULL);
> +		if (ret == 0)
> +			goto err;
> +
> +		ret = rsa_result(rsa, vct, rule->padding);
> +		if (ret == 0)
> +			goto err;
> +
> +		RSA_get0_key(rsa, &n, &e, &d);
> +		RSA_get0_factors(rsa, &p, &q);
> +		RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp);
> +
> +		vct->n.len = BN_bn2bin(n, vct->n.data);
> +		vct->e.len = BN_bn2bin(e, vct->e.data);
> +		vct->d.len = BN_bn2bin(d, vct->d.data);
> +		vct->p.len = BN_bn2bin(p, vct->p.data);
> +		vct->q.len = BN_bn2bin(q, vct->q.data);
> +
> +		vct->dP.len = BN_bn2bin(dmp1, vct->dP.data);
> +		vct->dQ.len = BN_bn2bin(dmq1, vct->dQ.data);
> +		vct->qInv.len = BN_bn2bin(iqmp, vct->qInv.data);
> +
> +err:
> +		RSA_free(rsa);
> +		BN_free(exp);
> +		BN_CTX_free(ctx);
> +
> +		if (ret == 1)
> +			break;
> +	}
> +
> +	vct->xform_type = RTE_CRYPTO_ASYM_XFORM_RSA;
> +	vct->padding = rule->padding,
> +	vct->op_type_flags = rule->operation;
> +	vct->key_exp = 1,
> +	vct->key_qt = 1,
> +
> +	sprintf(vct->description, "RSA key size: %d bits", rule->key_size);
> +	return 0;
> +}
> diff --git a/app/test/test_cryptodev_asym_rsa_creator.h
> b/app/test/test_cryptodev_asym_rsa_creator.h
> new file mode 100644
> index 0000000000..58c0efd376
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_rsa_creator.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#ifndef TEST_CRYPTODEV_ASYM_RSA_CREATOR_H_
> +#define TEST_CRYPTODEV_ASYM_RSA_CREATOR_H_
> +
> +#include <stdlib.h>
> +#include <stdint.h>
> +
> +#include "test_cryptodev_asym_vectors_def.h"
> +
> +int atv_rsa_creator(struct asym_test_rsa_vct *vct,
> +		struct asym_test_rsa_rule *rule);
> +
> +#endif /* TEST_CRYPTODEV_ASYM_RSA_CREATOR_H_ */
> diff --git a/app/test/test_cryptodev_asym_types.h
> b/app/test/test_cryptodev_asym_types.h
> new file mode 100644
> index 0000000000..5b2a79679c
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_types.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#ifndef TEST_CRPTODEV_ASYM_TYPES_H_
> +#define TEST_CRPTODEV_ASYM_TYPES_H_
> +
> +#include <rte_cryptodev.h>
> +#include <rte_crypto.h>
> +
> +struct crypto_testsuite_params_asym {
> +	struct rte_mempool *op_mpool;
> +	struct rte_mempool *session_mpool;
> +	struct rte_cryptodev_config conf;
> +	struct rte_cryptodev_qp_conf qp_conf;
> +	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
> +	uint8_t valid_dev_count;
> +};
> +
> +#endif /* TEST_CRPTODEV_ASYM_TYPES_H_ */
> diff --git a/app/test/test_cryptodev_asym_vectors.c
> b/app/test/test_cryptodev_asym_vectors.c
> new file mode 100644
> index 0000000000..d18aaa5426
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_vectors.c
> @@ -0,0 +1,31 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +
> +#include "test_cryptodev_asym_vectors.h"
> +#include "test_cryptodev_asym_rsa_creator.h"
> +#include "test_cryptodev_asym_vectors_rules.h"
> +
> +void atv_free(void *vct)
> +{
> +	free(vct);
> +}
> +
> +struct asym_test_rsa_vct *atv_rsa(int *vct_nb) {
> +	struct asym_test_rsa_vct *vct = NULL;
> +	int i;
> +
> +	*vct_nb = asym_test_rsa_rules_size;
> +
> +	vct = calloc(*vct_nb, sizeof(struct asym_test_rsa_vct));
> +
> +	if (vct)
> +		for (i = 0; i < *vct_nb; i++)
> +			atv_rsa_creator(&vct[i], &asym_test_rsa_rules[i]);

else ?

> +
> +	return vct;
> +}
> diff --git a/app/test/test_cryptodev_asym_vectors.h
> b/app/test/test_cryptodev_asym_vectors.h
> new file mode 100644
> index 0000000000..6f47d92dd3
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_vectors.h
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#ifndef TEST_CRYPTODEV_ASYM_VECTORS_H_
> +#define TEST_CRYPTODEV_ASYM_VECTORS_H_
> +
> +#include <stdint.h>
> +#include "rte_crypto_asym.h"
> +#include "test_cryptodev_asym_vectors_def.h"
> +
> +void atv_free(void *vct);
> +
> +struct asym_test_modex_vct *atv_modex(int *vct_nb);
> +
> +struct asym_test_rsa_vct *atv_rsa(int *vct_nb);
> +
> +#endif /* TEST_CRYPTODEV_ASYM_VECTORS_H_ */
> diff --git a/app/test/test_cryptodev_asym_vectors_def.h
> b/app/test/test_cryptodev_asym_vectors_def.h
> new file mode 100644
> index 0000000000..b8d9c51f9b
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_vectors_def.h
> @@ -0,0 +1,132 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#ifndef TEST_CRYPTODEV_ASYM_VECTORS_DEF_H__
> +#define TEST_CRYPTODEV_ASYM_VECTORS_DEF_H__
> +
> +#include <stdint.h>
> +
> +#include "rte_crypto_asym.h"
> +
> +#define ASYM_DATA_SIZE 4096
> +
> +struct asym_test_rsa_vct {
> +	enum rte_crypto_asym_xform_type xform_type;
> +	char description[2048];
> +	uint64_t op_type_flags;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} pt;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} ct;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} sign;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} digest;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} e;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} d;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} n;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} p;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} q;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} dP;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} dQ;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} qInv;
> +
> +	uint16_t result_len;
> +	enum rte_crypto_rsa_padding_type padding;
> +	int key_exp;
> +	int key_qt;
> +};
> +
> +struct asym_test_rsa_rule {
> +	int key_size;
> +	enum rte_crypto_rsa_priv_key_type key_type;
> +	enum rte_crypto_rsa_padding_type padding;
> +	int pt_len;
> +	uint64_t operation;
> +};
> +
> +struct asym_test_modex_vct {
> +	enum rte_crypto_asym_xform_type xform_type;
> +	char description[ASYM_DATA_SIZE];
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} base;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} exponent;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} modulus;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} reminder;
> +	uint16_t result_len;
> +};
> +
> +struct asym_test_modinv_vct {
> +	enum rte_crypto_asym_xform_type xform_type;
> +	char description[ASYM_DATA_SIZE];
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} base;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} modulus;
> +	struct {
> +		uint8_t data[ASYM_DATA_SIZE];
> +		uint16_t len;
> +	} inverse;
> +	uint16_t result_len;
> +};
> +
> +struct asym_test_modexp_rule {
> +	int base_len;
> +	int modulus_len;
> +	int exponent_len;
> +};
> +
> +struct asym_test_modinv_rule {
> +	int base_len;
> +	int modulus_len;
> +};
> +
> +#endif /* TEST_CRYPTODEV_ASYM_VECTORS_DEF_H__ */
> diff --git a/app/test/test_cryptodev_asym_vectors_rules.h
> b/app/test/test_cryptodev_asym_vectors_rules.h
> new file mode 100644
> index 0000000000..4e93df6f59
> --- /dev/null
> +++ b/app/test/test_cryptodev_asym_vectors_rules.h
> @@ -0,0 +1,42 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Intel Corporation  */
> +
> +#ifndef TEST_CRYPTODEV_ASYM_VECTORS_RULES_H__
> +#define TEST_CRYPTODEV_ASYM_VECTORS_RULES_H__
> +
> +#include <stdint.h>
> +
> +#include "test_cryptodev_asym_vectors_def.h"
> +
> +static struct asym_test_rsa_rule asym_test_rsa_rules[] = { {
> +	.key_size	= 1024,
> +	.key_type	= RTE_RSA_KEY_TYPE_EXP,
> +	.padding	= RTE_CRYPTO_RSA_PADDING_NONE,
> +	.pt_len		= 128,
> +	.operation	= (1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
> +					(1UL <<
> RTE_CRYPTO_ASYM_OP_DECRYPT) }, {
> +	.key_size	= 2048,
> +	.key_type	= RTE_RSA_KEY_TYPE_EXP,
> +	.padding	= RTE_CRYPTO_RSA_PADDING_NONE,
> +	.pt_len		= 256,
> +	.operation	= (1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
> +					(1UL <<
> RTE_CRYPTO_ASYM_OP_DECRYPT) }, {
> +	.key_size	= 4096,
> +	.key_type	= RTE_RSA_KEY_TYPE_EXP,
> +	.padding	= RTE_CRYPTO_RSA_PADDING_NONE,
> +	.pt_len		= 512,
> +	.operation	= (1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
> +					(1UL <<
> RTE_CRYPTO_ASYM_OP_DECRYPT)
> +	},
> +};
> +

Could you also add some combinations of _QT type key ?
Also on padding type as well. Just to ensure nothing broken here.

> +static int asym_test_rsa_rules_size = (sizeof(asym_test_rsa_rules)
> +		/ sizeof(*asym_test_rsa_rules));
> +
> +#endif /* TEST_CRYPTODEV_ASYM_VECTORS_RULES_H__ */
> diff --git a/lib/cryptodev/rte_crypto_asym.h
> b/lib/cryptodev/rte_crypto_asym.h index 8ae43d5f3d..6e289832b3 100644
> --- a/lib/cryptodev/rte_crypto_asym.h
> +++ b/lib/cryptodev/rte_crypto_asym.h
> @@ -182,6 +182,7 @@ enum rte_crypto_rsa_priv_key_type {
>  	/**< RSA private key is in quintuple format
>  	 * See rte_crypto_rsa_priv_key_qt
>  	 */
> +	RTE_RSA_KEY_TYPE_LIST_END,

Read my comment above to avoid this change as much as possible.

>  };
> 
>  /**
> --
> 2.25.1

Thanks,
Gowrishankar


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-27 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17 10:57 [PATCH] app/test: random test vectors for Asymc RSA Przemyslaw Zegan
2022-08-17 14:14 ` [dpdk-dev v2] " Przemyslaw Zegan
2022-09-27 11:42   ` [EXT] " Gowrishankar Muthukrishnan

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).