net/sfc: support API to negotiate delivery of Rx metadata
[dpdk.git] / app / test / test_cryptodev_asym.c
index 69df293..9d19a6d 100644 (file)
 #include <rte_pause.h>
 
 #include <rte_cryptodev.h>
-#include <rte_cryptodev_pmd.h>
 #include <rte_crypto.h>
 
 #include "test_cryptodev.h"
 #include "test_cryptodev_dh_test_vectors.h"
 #include "test_cryptodev_dsa_test_vectors.h"
+#include "test_cryptodev_ecdsa_test_vectors.h"
+#include "test_cryptodev_ecpm_test_vectors.h"
 #include "test_cryptodev_mod_test_vectors.h"
 #include "test_cryptodev_rsa_test_vectors.h"
 #include "test_cryptodev_asym_util.h"
@@ -33,7 +34,7 @@
 #define TEST_VECTOR_SIZE 256
 
 static int gbl_driver_id;
-struct crypto_testsuite_params {
+struct crypto_testsuite_params_asym {
        struct rte_mempool *op_mpool;
        struct rte_mempool *session_mpool;
        struct rte_cryptodev_config conf;
@@ -61,12 +62,12 @@ static struct test_cases_array test_vector = {0, { NULL } };
 
 static uint32_t test_index;
 
-static struct crypto_testsuite_params testsuite_params = { NULL };
+static struct crypto_testsuite_params_asym testsuite_params = { NULL };
 
 static int
 queue_ops_rsa_sign_verify(struct rte_cryptodev_asym_session *sess)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        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;
@@ -157,7 +158,7 @@ error_exit:
 static int
 queue_ops_rsa_enc_dec(struct rte_cryptodev_asym_session *sess)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        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;
@@ -298,7 +299,7 @@ test_cryptodev_asym_ver(struct rte_crypto_op *op,
 }
 
 static int
-test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params,
+test_cryptodev_asym_op(struct crypto_testsuite_params_asym *ts_params,
        union test_case_structure *data_tc,
        char *test_msg, int sessionless, enum rte_crypto_asym_op_type type,
        enum rte_crypto_rsa_priv_key_type key_type)
@@ -325,7 +326,7 @@ test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params,
        if (capability == NULL) {
                RTE_LOG(INFO, USER1,
                        "Device doesn't support MODEX. Test Skipped\n");
-               return -ENOTSUP;
+               return TEST_SKIPPED;
        }
 
        /* Generate crypto op data structure */
@@ -615,7 +616,7 @@ static int
 test_one_by_one(void)
 {
        int status = TEST_SUCCESS;
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        uint32_t i = 0;
        uint8_t dev_id = ts_params->valid_devs[0];
        struct rte_cryptodev_info dev_info;
@@ -648,7 +649,7 @@ test_one_by_one(void)
 static int
 test_rsa_sign_verify(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
        struct rte_cryptodev_asym_session *sess;
@@ -663,7 +664,7 @@ test_rsa_sign_verify(void)
                                RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP)) {
                RTE_LOG(INFO, USER1, "Device doesn't support sign op with "
                        "exponent key type. Test Skipped\n");
-               return -ENOTSUP;
+               return TEST_SKIPPED;
        }
 
        sess = rte_cryptodev_asym_session_create(sess_mpool);
@@ -697,7 +698,7 @@ error_exit:
 static int
 test_rsa_enc_dec(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
        struct rte_cryptodev_asym_session *sess;
@@ -712,7 +713,7 @@ test_rsa_enc_dec(void)
                                RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP)) {
                RTE_LOG(INFO, USER1, "Device doesn't support decrypt op with "
                        "exponent key type. Test skipped\n");
-               return -ENOTSUP;
+               return TEST_SKIPPED;
        }
 
        sess = rte_cryptodev_asym_session_create(sess_mpool);
@@ -745,7 +746,7 @@ error_exit:
 static int
 test_rsa_sign_verify_crt(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
        struct rte_cryptodev_asym_session *sess;
@@ -759,7 +760,7 @@ test_rsa_sign_verify_crt(void)
        if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT)) {
                RTE_LOG(INFO, USER1, "Device doesn't support sign op with "
                        "quintuple key type. Test skipped\n");
-               return -ENOTSUP;
+               return TEST_SKIPPED;
        }
 
        sess = rte_cryptodev_asym_session_create(sess_mpool);
@@ -793,7 +794,7 @@ error_exit:
 static int
 test_rsa_enc_dec_crt(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
        struct rte_cryptodev_asym_session *sess;
@@ -807,7 +808,7 @@ test_rsa_enc_dec_crt(void)
        if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT)) {
                RTE_LOG(INFO, USER1, "Device doesn't support decrypt op with "
                        "quintuple key type. Test skipped\n");
-               return -ENOTSUP;
+               return TEST_SKIPPED;
        }
 
        sess = rte_cryptodev_asym_session_create(sess_mpool);
@@ -840,7 +841,7 @@ error_exit:
 static int
 testsuite_setup(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
        struct rte_cryptodev_info info;
        int ret, dev_id = -1;
@@ -933,8 +934,9 @@ testsuite_setup(void)
        }
 
        /* setup asym session pool */
-       unsigned int session_size =
-               rte_cryptodev_asym_get_private_session_size(dev_id);
+       unsigned int session_size = RTE_MAX(
+               rte_cryptodev_asym_get_private_session_size(dev_id),
+               rte_cryptodev_asym_get_header_session_size());
        /*
         * Create mempool with TEST_NUM_SESSIONS * 2,
         * to include the session headers
@@ -956,7 +958,7 @@ testsuite_setup(void)
 static void
 testsuite_teardown(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 
        if (ts_params->op_mpool != NULL) {
                RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
@@ -971,9 +973,9 @@ testsuite_teardown(void)
 }
 
 static int
-ut_setup(void)
+ut_setup_asym(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 
        uint16_t qp_id;
 
@@ -1005,9 +1007,9 @@ ut_setup(void)
 }
 
 static void
-ut_teardown(void)
+ut_teardown_asym(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_cryptodev_stats stats;
 
        rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats);
@@ -1037,20 +1039,23 @@ static inline void print_asym_capa(
                case RTE_CRYPTO_ASYM_XFORM_MODEX:
                case RTE_CRYPTO_ASYM_XFORM_DH:
                case RTE_CRYPTO_ASYM_XFORM_DSA:
-                       printf(" modlen: min %d max %d increment %d\n",
+                       printf(" modlen: min %d max %d increment %d",
                                        capa->modlen.min,
                                        capa->modlen.max,
                                        capa->modlen.increment);
                break;
+               case RTE_CRYPTO_ASYM_XFORM_ECDSA:
+               case RTE_CRYPTO_ASYM_XFORM_ECPM:
                default:
                        break;
                }
+               printf("\n");
 }
 
 static int
 test_capability(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        uint8_t dev_id = ts_params->valid_devs[0];
        struct rte_cryptodev_info dev_info;
        const struct rte_cryptodev_capabilities *dev_capa;
@@ -1087,7 +1092,7 @@ test_capability(void)
 static int
 test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *op_mpool = ts_params->op_mpool;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
@@ -1180,7 +1185,7 @@ error_exit:
 static int
 test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *op_mpool = ts_params->op_mpool;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
@@ -1271,7 +1276,7 @@ error_exit:
 static int
 test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *op_mpool = ts_params->op_mpool;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
@@ -1370,7 +1375,7 @@ error_exit:
 static int
 test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *op_mpool = ts_params->op_mpool;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
@@ -1467,7 +1472,7 @@ error_exit:
 static int
 test_mod_inv(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *op_mpool = ts_params->op_mpool;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
@@ -1495,7 +1500,7 @@ test_mod_inv(void)
        if (capability == NULL) {
                RTE_LOG(INFO, USER1,
                        "Device doesn't support MOD INV. Test Skipped\n");
-               return -ENOTSUP;
+               return TEST_SKIPPED;
        }
 
        if (rte_cryptodev_asym_xform_capability_check_modlen(
@@ -1503,7 +1508,7 @@ test_mod_inv(void)
                modinv_xform.modinv.modulus.length)) {
                RTE_LOG(ERR, USER1,
                                 "Invalid MODULUS length specified\n");
-                               return -ENOTSUP;
+                               return TEST_SKIPPED;
                }
 
        sess = rte_cryptodev_asym_session_create(sess_mpool);
@@ -1591,7 +1596,7 @@ error_exit:
 static int
 test_mod_exp(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *op_mpool = ts_params->op_mpool;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
@@ -1620,14 +1625,14 @@ test_mod_exp(void)
        if (capability == NULL) {
                RTE_LOG(INFO, USER1,
                        "Device doesn't support MOD EXP. Test Skipped\n");
-               return -ENOTSUP;
+               return TEST_SKIPPED;
        }
 
        if (rte_cryptodev_asym_xform_capability_check_modlen(
                        capability, modex_xform.modex.modulus.length)) {
                RTE_LOG(ERR, USER1,
                                "Invalid MODULUS length specified\n");
-                               return -ENOTSUP;
+                               return TEST_SKIPPED;
                }
 
        /* generate crypto op data structure */
@@ -1751,7 +1756,7 @@ test_dh_keygenration(void)
 static int
 test_dsa_sign(void)
 {
-       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
        struct rte_mempool *op_mpool = ts_params->op_mpool;
        struct rte_mempool *sess_mpool = ts_params->session_mpool;
        uint8_t dev_id = ts_params->valid_devs[0];
@@ -1892,22 +1897,411 @@ test_dsa(void)
        return status;
 }
 
+static int
+test_ecdsa_sign_verify(enum curve curve_id)
+{
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+       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;
+       struct rte_cryptodev_asym_session *sess = NULL;
+       uint8_t dev_id = ts_params->valid_devs[0];
+       struct rte_crypto_op *result_op = NULL;
+       uint8_t output_buf_r[TEST_DATA_SIZE];
+       uint8_t output_buf_s[TEST_DATA_SIZE];
+       struct rte_crypto_asym_xform xform;
+       struct rte_crypto_asym_op *asym_op;
+       struct rte_cryptodev_info dev_info;
+       struct rte_crypto_op *op = NULL;
+       int status = TEST_SUCCESS, ret;
+
+       switch (curve_id) {
+       case SECP192R1:
+               input_params = ecdsa_param_secp192r1;
+               break;
+       case SECP224R1:
+               input_params = ecdsa_param_secp224r1;
+               break;
+       case SECP256R1:
+               input_params = ecdsa_param_secp256r1;
+               break;
+       case SECP384R1:
+               input_params = ecdsa_param_secp384r1;
+               break;
+       case SECP521R1:
+               input_params = ecdsa_param_secp521r1;
+               break;
+       default:
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Unsupported curve id\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       rte_cryptodev_info_get(dev_id, &dev_info);
+
+       sess = rte_cryptodev_asym_session_create(sess_mpool);
+       if (sess == NULL) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Session creation failed\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       /* Setup crypto op data structure */
+       op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
+       if (op == NULL) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Failed to allocate asymmetric crypto "
+                               "operation struct\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+       asym_op = op->asym;
+
+       /* Setup asym xform */
+       xform.next = NULL;
+       xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ECDSA;
+       xform.ec.curve_id = input_params.curve;
+
+       if (rte_cryptodev_asym_session_init(dev_id, sess, &xform,
+                               sess_mpool) < 0) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Unable to config asym session\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       /* Attach asymmetric crypto session to crypto operations */
+       rte_crypto_op_attach_asym_session(op, sess);
+
+       /* Compute sign */
+
+       /* Populate op with operational details */
+       op->asym->ecdsa.op_type = RTE_CRYPTO_ASYM_OP_SIGN;
+       op->asym->ecdsa.message.data = input_params.digest.data;
+       op->asym->ecdsa.message.length = input_params.digest.length;
+       op->asym->ecdsa.k.data = input_params.scalar.data;
+       op->asym->ecdsa.k.length = input_params.scalar.length;
+       op->asym->ecdsa.pkey.data = input_params.pkey.data;
+       op->asym->ecdsa.pkey.length = input_params.pkey.length;
+
+       /* Init out buf */
+       op->asym->ecdsa.r.data = output_buf_r;
+       op->asym->ecdsa.s.data = output_buf_s;
+
+       RTE_LOG(DEBUG, USER1, "Process ASYM operation\n");
+
+       /* Process crypto operation */
+       if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Error sending packet for operation\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
+               rte_pause();
+
+       if (result_op == NULL) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Failed to process asym crypto op\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       if (result_op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Failed to process asym crypto op\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       asym_op = result_op->asym;
+
+       debug_hexdump(stdout, "r:",
+                       asym_op->ecdsa.r.data, asym_op->ecdsa.r.length);
+       debug_hexdump(stdout, "s:",
+                       asym_op->ecdsa.s.data, asym_op->ecdsa.s.length);
+
+       ret = verify_ecdsa_sign(input_params.sign_r.data,
+                               input_params.sign_s.data, result_op);
+       if (ret) {
+               status = TEST_FAILED;
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "ECDSA sign failed.\n");
+               goto exit;
+       }
+
+       /* Verify sign */
+
+       /* Populate op with operational details */
+       op->asym->ecdsa.op_type = RTE_CRYPTO_ASYM_OP_VERIFY;
+       op->asym->ecdsa.q.x.data = input_params.pubkey_qx.data;
+       op->asym->ecdsa.q.x.length = input_params.pubkey_qx.length;
+       op->asym->ecdsa.q.y.data = input_params.pubkey_qy.data;
+       op->asym->ecdsa.q.y.length = input_params.pubkey_qx.length;
+       op->asym->ecdsa.r.data = asym_op->ecdsa.r.data;
+       op->asym->ecdsa.r.length = asym_op->ecdsa.r.length;
+       op->asym->ecdsa.s.data = asym_op->ecdsa.s.data;
+       op->asym->ecdsa.s.length = asym_op->ecdsa.s.length;
+
+       /* Enqueue sign result for verify */
+       if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
+               status = TEST_FAILED;
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Error sending packet for operation\n");
+               goto exit;
+       }
+
+       while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
+               rte_pause();
+
+       if (result_op == NULL) {
+               status = TEST_FAILED;
+               goto exit;
+       }
+       if (result_op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
+               status = TEST_FAILED;
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "ECDSA verify failed.\n");
+               goto exit;
+       }
+
+exit:
+       if (sess != NULL) {
+               rte_cryptodev_asym_session_clear(dev_id, sess);
+               rte_cryptodev_asym_session_free(sess);
+       }
+       if (op != NULL)
+               rte_crypto_op_free(op);
+       return status;
+};
+
+static int
+test_ecdsa_sign_verify_all_curve(void)
+{
+       int status, overall_status = TEST_SUCCESS;
+       enum curve curve_id;
+       int test_index = 0;
+       const char *msg;
+
+       for (curve_id = SECP192R1; curve_id < END_OF_CURVE_LIST; curve_id++) {
+               status = test_ecdsa_sign_verify(curve_id);
+               if (status == TEST_SUCCESS) {
+                       msg = "succeeded";
+               } else {
+                       msg = "failed";
+                       overall_status = status;
+               }
+               printf("  %u) TestCase Sign/Veriy Curve %s  %s\n",
+                      test_index ++, curve[curve_id], msg);
+       }
+       return overall_status;
+}
+
+static int
+test_ecpm(enum curve curve_id)
+{
+       struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+       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;
+       struct rte_cryptodev_asym_session *sess = NULL;
+       uint8_t dev_id = ts_params->valid_devs[0];
+       struct rte_crypto_op *result_op = NULL;
+       uint8_t output_buf_x[TEST_DATA_SIZE];
+       uint8_t output_buf_y[TEST_DATA_SIZE];
+       struct rte_crypto_asym_xform xform;
+       struct rte_crypto_asym_op *asym_op;
+       struct rte_cryptodev_info dev_info;
+       struct rte_crypto_op *op = NULL;
+       int status = TEST_SUCCESS, ret;
+
+       switch (curve_id) {
+       case SECP192R1:
+               input_params = ecpm_param_secp192r1;
+               break;
+       case SECP224R1:
+               input_params = ecpm_param_secp224r1;
+               break;
+       case SECP256R1:
+               input_params = ecpm_param_secp256r1;
+               break;
+       case SECP384R1:
+               input_params = ecpm_param_secp384r1;
+               break;
+       case SECP521R1:
+               input_params = ecpm_param_secp521r1;
+               break;
+       default:
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Unsupported curve id\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       rte_cryptodev_info_get(dev_id, &dev_info);
+
+       sess = rte_cryptodev_asym_session_create(sess_mpool);
+       if (sess == NULL) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Session creation failed\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       /* Setup crypto op data structure */
+       op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
+       if (op == NULL) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Failed to allocate asymmetric crypto "
+                               "operation struct\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+       asym_op = op->asym;
+
+       /* Setup asym xform */
+       xform.next = NULL;
+       xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ECPM;
+       xform.ec.curve_id = input_params.curve;
+
+       if (rte_cryptodev_asym_session_init(dev_id, sess, &xform,
+                               sess_mpool) < 0) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Unable to config asym session\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       /* Attach asymmetric crypto session to crypto operations */
+       rte_crypto_op_attach_asym_session(op, sess);
+
+       /* Populate op with operational details */
+       op->asym->ecpm.p.x.data = input_params.gen_x.data;
+       op->asym->ecpm.p.x.length = input_params.gen_x.length;
+       op->asym->ecpm.p.y.data = input_params.gen_y.data;
+       op->asym->ecpm.p.y.length = input_params.gen_y.length;
+       op->asym->ecpm.scalar.data = input_params.privkey.data;
+       op->asym->ecpm.scalar.length = input_params.privkey.length;
+
+       /* Init out buf */
+       op->asym->ecpm.r.x.data = output_buf_x;
+       op->asym->ecpm.r.y.data = output_buf_y;
+
+       RTE_LOG(DEBUG, USER1, "Process ASYM operation\n");
+
+       /* Process crypto operation */
+       if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Error sending packet for operation\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
+               rte_pause();
+
+       if (result_op == NULL) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Failed to process asym crypto op\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       if (result_op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "Failed to process asym crypto op\n");
+               status = TEST_FAILED;
+               goto exit;
+       }
+
+       asym_op = result_op->asym;
+
+       debug_hexdump(stdout, "r x:",
+                       asym_op->ecpm.r.x.data, asym_op->ecpm.r.x.length);
+       debug_hexdump(stdout, "r y:",
+                       asym_op->ecpm.r.y.data, asym_op->ecpm.r.y.length);
+
+       ret = verify_ecpm(input_params.pubkey_x.data,
+                               input_params.pubkey_y.data, result_op);
+       if (ret) {
+               status = TEST_FAILED;
+               RTE_LOG(ERR, USER1,
+                               "line %u FAILED: %s", __LINE__,
+                               "EC Point Multiplication failed.\n");
+               goto exit;
+       }
+
+exit:
+       if (sess != NULL) {
+               rte_cryptodev_asym_session_clear(dev_id, sess);
+               rte_cryptodev_asym_session_free(sess);
+       }
+       if (op != NULL)
+               rte_crypto_op_free(op);
+       return status;
+}
+
+static int
+test_ecpm_all_curve(void)
+{
+       int status, overall_status = TEST_SUCCESS;
+       enum curve curve_id;
+       int test_index = 0;
+       const char *msg;
+
+       for (curve_id = SECP192R1; curve_id < END_OF_CURVE_LIST; curve_id++) {
+               status = test_ecpm(curve_id);
+               if (status == TEST_SUCCESS) {
+                       msg = "succeeded";
+               } else {
+                       msg = "failed";
+                       overall_status = status;
+               }
+               printf("  %u) TestCase EC Point Mul Curve %s  %s\n",
+                      test_index ++, curve[curve_id], msg);
+       }
+       return overall_status;
+}
 
 static struct unit_test_suite cryptodev_openssl_asym_testsuite  = {
        .suite_name = "Crypto Device OPENSSL ASYM Unit Test Suite",
        .setup = testsuite_setup,
        .teardown = testsuite_teardown,
        .unit_test_cases = {
-               TEST_CASE_ST(ut_setup, ut_teardown, test_capability),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_dsa),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_dh_keygenration),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec_crt),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify_crt),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_mod_inv),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_mod_exp),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_one_by_one),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_capability),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_dsa),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+                               test_dh_keygenration),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_rsa_enc_dec),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+                               test_rsa_sign_verify),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+                               test_rsa_enc_dec_crt),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+                               test_rsa_sign_verify_crt),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_inv),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
                TEST_CASES_END() /**< NULL terminate unit test array */
        }
 };
@@ -1917,7 +2311,7 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite  = {
        .setup = testsuite_setup,
        .teardown = testsuite_teardown,
        .unit_test_cases = {
-               TEST_CASE_ST(ut_setup, ut_teardown, test_one_by_one),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
                TEST_CASES_END() /**< NULL terminate unit test array */
        }
 };
@@ -1927,10 +2321,16 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite  = {
        .setup = testsuite_setup,
        .teardown = testsuite_teardown,
        .unit_test_cases = {
-               TEST_CASE_ST(ut_setup, ut_teardown, test_capability),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec_crt),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify_crt),
-               TEST_CASE_ST(ut_setup, ut_teardown, test_mod_exp),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_capability),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+                               test_rsa_enc_dec_crt),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+                               test_rsa_sign_verify_crt),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+                            test_ecdsa_sign_verify_all_curve),
+               TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+                               test_ecpm_all_curve),
                TEST_CASES_END() /**< NULL terminate unit test array */
        }
 };
@@ -1942,9 +2342,7 @@ test_cryptodev_openssl_asym(void)
                        RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
 
        if (gbl_driver_id == -1) {
-               RTE_LOG(ERR, USER1, "OPENSSL PMD must be loaded. Check if "
-                               "CONFIG_RTE_LIBRTE_PMD_OPENSSL is enabled "
-                               "in config file to run this testsuite.\n");
+               RTE_LOG(ERR, USER1, "OPENSSL PMD must be loaded.\n");
                return TEST_FAILED;
        }
 
@@ -1958,9 +2356,7 @@ test_cryptodev_qat_asym(void)
                        RTE_STR(CRYPTODEV_NAME_QAT_ASYM_PMD));
 
        if (gbl_driver_id == -1) {
-               RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
-                                   "CONFIG_RTE_LIBRTE_PMD_QAT_ASYM is enabled "
-                                   "in config file to run this testsuite.\n");
+               RTE_LOG(ERR, USER1, "QAT PMD must be loaded.\n");
                return TEST_FAILED;
        }
 
@@ -1973,10 +2369,7 @@ test_cryptodev_octeontx_asym(void)
        gbl_driver_id = rte_cryptodev_driver_id_get(
                        RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
        if (gbl_driver_id == -1) {
-               RTE_LOG(ERR, USER1, "OCTEONTX PMD must be loaded. Check if "
-                               "CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO is "
-                               "enabled in config file to run this "
-                               "testsuite.\n");
+               RTE_LOG(ERR, USER1, "OCTEONTX PMD must be loaded.\n");
                return TEST_FAILED;
        }
        return unit_test_suite_runner(&cryptodev_octeontx_asym_testsuite);
@@ -1988,10 +2381,35 @@ test_cryptodev_octeontx2_asym(void)
        gbl_driver_id = rte_cryptodev_driver_id_get(
                        RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
        if (gbl_driver_id == -1) {
-               RTE_LOG(ERR, USER1, "OCTEONTX2 PMD must be loaded. Check if "
-                               "CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO is "
-                               "enabled in config file to run this "
-                               "testsuite.\n");
+               RTE_LOG(ERR, USER1, "OCTEONTX2 PMD must be loaded.\n");
+               return TEST_FAILED;
+       }
+
+       /* Use test suite registered for crypto_octeontx PMD */
+       return unit_test_suite_runner(&cryptodev_octeontx_asym_testsuite);
+}
+
+static int
+test_cryptodev_cn9k_asym(void)
+{
+       gbl_driver_id = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_CN9K_PMD));
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "CN9K PMD must be loaded.\n");
+               return TEST_FAILED;
+       }
+
+       /* Use test suite registered for crypto_octeontx PMD */
+       return unit_test_suite_runner(&cryptodev_octeontx_asym_testsuite);
+}
+
+static int
+test_cryptodev_cn10k_asym(void)
+{
+       gbl_driver_id = rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_CN10K_PMD));
+       if (gbl_driver_id == -1) {
+               RTE_LOG(ERR, USER1, "CN10K PMD must be loaded.\n");
                return TEST_FAILED;
        }
 
@@ -2009,3 +2427,5 @@ REGISTER_TEST_COMMAND(cryptodev_octeontx_asym_autotest,
 
 REGISTER_TEST_COMMAND(cryptodev_octeontx2_asym_autotest,
                                          test_cryptodev_octeontx2_asym);
+REGISTER_TEST_COMMAND(cryptodev_cn9k_asym_autotest, test_cryptodev_cn9k_asym);
+REGISTER_TEST_COMMAND(cryptodev_cn10k_asym_autotest, test_cryptodev_cn10k_asym);