DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1 0/4] test/cryptodev: add ECDH tests
@ 2023-10-26  8:15 Gowrishankar Muthukrishnan
  2023-10-26  8:15 ` [PATCH v1 1/4] " Gowrishankar Muthukrishnan
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Gowrishankar Muthukrishnan @ 2023-10-26  8:15 UTC (permalink / raw)
  To: dev; +Cc: anoobj, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan

This patch series adds ECDH testsuite. It also enables ECDH
support in CNXK PMD.

Gowrishankar Muthukrishnan (4):
  test/cryptodev: add ECDH tests
  crypto/cnxk: use generic EC opcodes
  crypto/cnxk: change order of ECFPM params
  crypto/cnxk: add ECDH support

 app/test/test_cryptodev_asym.c                | 729 ++++++++++++++++++
 app/test/test_cryptodev_asym_util.h           |  12 +
 app/test/test_cryptodev_ecdh_test_vectors.h   | 577 ++++++++++++++
 app/test/test_cryptodev_ecdsa_test_vectors.h  |   3 +
 doc/guides/cryptodevs/features/cn10k.ini      |   1 +
 doc/guides/cryptodevs/features/cn9k.ini       |   1 +
 drivers/common/cnxk/roc_ae.h                  |  21 +-
 drivers/crypto/cnxk/cn10k_cryptodev_ops.c     |  12 +
 drivers/crypto/cnxk/cnxk_ae.h                 | 240 ++++--
 drivers/crypto/cnxk/cnxk_cryptodev.h          |   2 +-
 .../crypto/cnxk/cnxk_cryptodev_capabilities.c |  14 +
 11 files changed, 1543 insertions(+), 69 deletions(-)
 create mode 100644 app/test/test_cryptodev_ecdh_test_vectors.h

-- 
2.25.1


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

* [PATCH v1 1/4] test/cryptodev: add ECDH tests
  2023-10-26  8:15 [PATCH v1 0/4] test/cryptodev: add ECDH tests Gowrishankar Muthukrishnan
@ 2023-10-26  8:15 ` Gowrishankar Muthukrishnan
  2023-10-30 18:48   ` Akhil Goyal
  2023-11-08 13:17   ` [PATCH v2] " Gowrishankar Muthukrishnan
  2023-10-26  8:15 ` [PATCH v1 2/4] crypto/cnxk: use generic EC opcodes Gowrishankar Muthukrishnan
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Gowrishankar Muthukrishnan @ 2023-10-26  8:15 UTC (permalink / raw)
  To: dev; +Cc: anoobj, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan

Add ECDH tests.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 app/test/test_cryptodev_asym.c               | 729 +++++++++++++++++++
 app/test/test_cryptodev_asym_util.h          |  12 +
 app/test/test_cryptodev_ecdh_test_vectors.h  | 577 +++++++++++++++
 app/test/test_cryptodev_ecdsa_test_vectors.h |   3 +
 4 files changed, 1321 insertions(+)
 create mode 100644 app/test/test_cryptodev_ecdh_test_vectors.h

diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index c6334380d7..965e71d0bc 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -17,6 +17,7 @@
 #include "test_cryptodev.h"
 #include "test_cryptodev_dh_test_vectors.h"
 #include "test_cryptodev_dsa_test_vectors.h"
+#include "test_cryptodev_ecdh_test_vectors.h"
 #include "test_cryptodev_ecdsa_test_vectors.h"
 #include "test_cryptodev_ecpm_test_vectors.h"
 #include "test_cryptodev_mod_test_vectors.h"
@@ -1806,6 +1807,732 @@ test_ecpm_all_curve(void)
 	return overall_status;
 }
 
+static int
+test_ecdh_priv_key_generate(enum curve curve_id)
+{
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	const struct rte_cryptodev_asymmetric_xform_capability *capa;
+	struct rte_mempool *sess_mpool = ts_params->session_mpool;
+	struct rte_mempool *op_mpool = ts_params->op_mpool;
+	struct rte_cryptodev_asym_capability_idx idx;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_crypto_asym_xform xform = {0};
+	struct rte_crypto_op *result_op = NULL;
+	uint8_t output_buf[TEST_DATA_SIZE];
+	struct rte_crypto_asym_op *asym_op;
+	struct rte_crypto_op *op = NULL;
+	int ret, status = TEST_SUCCESS;
+	uint16_t output_buflen = 0;
+	void *sess = NULL;
+	int curve;
+
+	/* Check ECDH capability */
+	idx.type = RTE_CRYPTO_ASYM_XFORM_ECDH;
+	capa = rte_cryptodev_asym_capability_get(dev_id, &idx);
+	if (capa == NULL)
+		return -ENOTSUP;
+
+	if (!(capa->op_types & (1 <<  RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE)))
+		return -ENOTSUP;
+
+	switch (curve_id) {
+	case SECP192R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP192R1;
+		output_buflen = 24;
+		break;
+	case SECP224R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP224R1;
+		output_buflen = 28;
+		break;
+	case SECP256R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP256R1;
+		output_buflen = 32;
+		break;
+	case SECP384R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP384R1;
+		output_buflen = 48;
+		break;
+	case SECP521R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP521R1;
+		output_buflen = 66;
+		break;
+	default:
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Unsupported curve id\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_ECDH;
+	xform.ec.curve_id = curve;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE;
+
+	/* Init out buf */
+	asym_op->ecdh.priv_key.data = output_buf;
+	asym_op->ecdh.priv_key.length = output_buflen;
+
+	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, "priv_key:",
+		asym_op->ecdh.priv_key.data, asym_op->ecdh.priv_key.length);
+
+exit:
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+	return status;
+}
+
+static int
+test_ecdh_pub_key_generate(enum curve curve_id)
+{
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	const struct rte_cryptodev_asymmetric_xform_capability *capa;
+	struct rte_mempool *sess_mpool = ts_params->session_mpool;
+	struct rte_mempool *op_mpool = ts_params->op_mpool;
+	struct crypto_testsuite_ecdh_params input_params;
+	struct rte_cryptodev_asym_capability_idx idx;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_crypto_asym_xform xform = {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_op *asym_op;
+	struct rte_crypto_op *op = NULL;
+	int ret, status = TEST_SUCCESS;
+	void *sess = NULL;
+
+	/* Check ECDH capability */
+	idx.type = RTE_CRYPTO_ASYM_XFORM_ECDH;
+	capa = rte_cryptodev_asym_capability_get(dev_id, &idx);
+	if (capa == NULL)
+		return -ENOTSUP;
+
+	if (!(capa->op_types & (1 <<  RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE)))
+		return -ENOTSUP;
+
+	switch (curve_id) {
+	case SECP192R1:
+		input_params = ecdh_param_secp192r1;
+		break;
+	case SECP224R1:
+		input_params = ecdh_param_secp224r1;
+		break;
+	case SECP256R1:
+		input_params = ecdh_param_secp256r1;
+		break;
+	case SECP384R1:
+		input_params = ecdh_param_secp384r1;
+		break;
+	case SECP521R1:
+		input_params = ecdh_param_secp521r1;
+		break;
+	default:
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Unsupported curve id\n");
+		status = TEST_FAILED;
+		goto exit;
+	}
+
+	debug_hexdump(stdout, "pkey:",
+		input_params.pkey_A.data, input_params.pkey_A.length);
+
+	/* 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_ECDH;
+	xform.ec.curve_id = input_params.curve;
+	xform.ec.pkey.data = input_params.pkey_A.data;
+	xform.ec.pkey.length = input_params.pkey_A.length;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE;
+
+	/* Init out buf */
+	asym_op->ecdh.pub_key.x.data = output_buf_x;
+	asym_op->ecdh.pub_key.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, "qx:",
+		asym_op->ecdh.pub_key.x.data, asym_op->ecdh.pub_key.x.length);
+	debug_hexdump(stdout, "qy:",
+		asym_op->ecdh.pub_key.y.data, asym_op->ecdh.pub_key.y.length);
+
+	ret = verify_ecdh_secret(input_params.pubkey_qA_x.data,
+				input_params.pubkey_qA_y.data, result_op);
+	if (ret) {
+		status = TEST_FAILED;
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"ECDH public key generation failed.\n");
+		goto exit;
+	}
+
+exit:
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+	return status;
+}
+
+static int
+test_ecdh_pub_key_verify(enum curve curve_id)
+{
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	const struct rte_cryptodev_asymmetric_xform_capability *capa;
+	struct rte_mempool *sess_mpool = ts_params->session_mpool;
+	struct rte_mempool *op_mpool = ts_params->op_mpool;
+	struct crypto_testsuite_ecdh_params input_params;
+	struct rte_cryptodev_asym_capability_idx idx;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_crypto_asym_xform xform = {0};
+	struct rte_crypto_op *result_op = NULL;
+	struct rte_crypto_asym_op *asym_op;
+	struct rte_crypto_op *op = NULL;
+	int ret, status = TEST_SUCCESS;
+	void *sess = NULL;
+
+	/* Check ECDH capability */
+	idx.type = RTE_CRYPTO_ASYM_XFORM_ECDH;
+	capa = rte_cryptodev_asym_capability_get(dev_id, &idx);
+	if (capa == NULL)
+		return -ENOTSUP;
+
+	if (!(capa->op_types & (1 <<  RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY)))
+		return -ENOTSUP;
+
+	switch (curve_id) {
+	case SECP192R1:
+		input_params = ecdh_param_secp192r1;
+		break;
+	case SECP224R1:
+		input_params = ecdh_param_secp224r1;
+		break;
+	case SECP256R1:
+		input_params = ecdh_param_secp256r1;
+		break;
+	case SECP384R1:
+		input_params = ecdh_param_secp384r1;
+		break;
+	case SECP521R1:
+		input_params = ecdh_param_secp521r1;
+		break;
+	default:
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Unsupported curve id\n");
+		status = TEST_FAILED;
+		goto exit;
+	}
+
+	debug_hexdump(stdout, "qx:",
+		input_params.pubkey_qA_x.data, input_params.pubkey_qA_x.length);
+	debug_hexdump(stdout, "qy:",
+		input_params.pubkey_qA_y.data, input_params.pubkey_qA_y.length);
+
+	/* 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_ECDH;
+	xform.ec.curve_id = input_params.curve;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY;
+	asym_op->ecdh.pub_key.x.data = input_params.pubkey_qA_x.data;
+	asym_op->ecdh.pub_key.x.length = input_params.pubkey_qA_x.length;
+	asym_op->ecdh.pub_key.y.data = input_params.pubkey_qA_y.data;
+	asym_op->ecdh.pub_key.y.length = input_params.pubkey_qA_y.length;
+
+	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;
+	}
+
+exit:
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+	return status;
+}
+
+static int
+test_ecdh_shared_secret(enum curve curve_id)
+{
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	const struct rte_cryptodev_asymmetric_xform_capability *capa;
+	struct rte_mempool *sess_mpool = ts_params->session_mpool;
+	struct rte_mempool *op_mpool = ts_params->op_mpool;
+	struct crypto_testsuite_ecdh_params input_params;
+	struct rte_cryptodev_asym_capability_idx idx;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_crypto_asym_xform xform = {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_op *asym_op;
+	struct rte_crypto_op *op = NULL;
+	int ret, status = TEST_SUCCESS;
+	void *sess = NULL;
+
+	/* Check ECDH capability */
+	idx.type = RTE_CRYPTO_ASYM_XFORM_ECDH;
+	capa = rte_cryptodev_asym_capability_get(dev_id, &idx);
+	if (capa == NULL)
+		return -ENOTSUP;
+
+	if (!(capa->op_types & (1 <<  RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE)))
+		return -ENOTSUP;
+
+	switch (curve_id) {
+	case SECP192R1:
+		input_params = ecdh_param_secp192r1;
+		break;
+	case SECP224R1:
+		input_params = ecdh_param_secp224r1;
+		break;
+	case SECP256R1:
+		input_params = ecdh_param_secp256r1;
+		break;
+	case SECP384R1:
+		input_params = ecdh_param_secp384r1;
+		break;
+	case SECP521R1:
+		input_params = ecdh_param_secp521r1;
+		break;
+	default:
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Unsupported curve id\n");
+		status = TEST_FAILED;
+		goto exit;
+	}
+
+	/* zA = dA.QB */
+	debug_hexdump(stdout, "pkey:",
+		input_params.pkey_A.data, input_params.pkey_A.length);
+	debug_hexdump(stdout, "qx:",
+		input_params.pubkey_qB_x.data, input_params.pubkey_qB_x.length);
+	debug_hexdump(stdout, "qy:",
+		input_params.pubkey_qB_y.data, input_params.pubkey_qB_y.length);
+
+	/* 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_ECDH;
+	xform.ec.curve_id = input_params.curve;
+	xform.ec.pkey.data = input_params.pkey_A.data;
+	xform.ec.pkey.length = input_params.pkey_A.length;
+	xform.ec.q.x.data = input_params.pubkey_qB_x.data;
+	xform.ec.q.x.length = input_params.pubkey_qB_x.length;
+	xform.ec.q.y.data = input_params.pubkey_qB_y.data;
+	xform.ec.q.y.length = input_params.pubkey_qB_y.length;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE;
+
+	/* Init out buf */
+	asym_op->ecdh.shared_secret.x.data = output_buf_x;
+	asym_op->ecdh.shared_secret.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, "secret_x:",
+		asym_op->ecdh.shared_secret.x.data, asym_op->ecdh.shared_secret.x.length);
+	debug_hexdump(stdout, "secret_y:",
+		asym_op->ecdh.shared_secret.y.data, asym_op->ecdh.shared_secret.y.length);
+
+	ret = verify_ecdh_secret(input_params.secret_x.data,
+				input_params.secret_y.data, result_op);
+	if (ret) {
+		status = TEST_FAILED;
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"ECDH shared secret compute failed.\n");
+		goto exit;
+	}
+
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+
+	/* zB = dB.QA */
+	debug_hexdump(stdout, "pkey:",
+		input_params.pkey_B.data, input_params.pkey_B.length);
+	debug_hexdump(stdout, "qx:",
+		input_params.pubkey_qA_x.data, input_params.pubkey_qA_x.length);
+	debug_hexdump(stdout, "qy:",
+		input_params.pubkey_qA_y.data, input_params.pubkey_qA_y.length);
+
+	/* 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_ECDH;
+	xform.ec.curve_id = input_params.curve;
+	xform.ec.pkey.data = input_params.pkey_B.data;
+	xform.ec.pkey.length = input_params.pkey_B.length;
+	xform.ec.q.x.data = input_params.pubkey_qA_x.data;
+	xform.ec.q.x.length = input_params.pubkey_qA_x.length;
+	xform.ec.q.y.data = input_params.pubkey_qA_y.data;
+	xform.ec.q.y.length = input_params.pubkey_qA_y.length;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE;
+
+	/* Init out buf */
+	asym_op->ecdh.shared_secret.x.data = output_buf_x;
+	asym_op->ecdh.shared_secret.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, "secret_x:",
+			asym_op->ecdh.shared_secret.x.data, asym_op->ecdh.shared_secret.x.length);
+	debug_hexdump(stdout, "secret_y:",
+			asym_op->ecdh.shared_secret.y.data, asym_op->ecdh.shared_secret.y.length);
+
+	ret = verify_ecdh_secret(input_params.secret_x.data,
+				input_params.secret_y.data, result_op);
+	if (ret) {
+		status = TEST_FAILED;
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"ECDH shared secret compute failed.\n");
+		goto exit;
+	}
+
+exit:
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+	return status;
+}
+
+static int
+test_ecdh_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_ecdh_priv_key_generate(curve_id);
+		if (status == TEST_SUCCESS) {
+			msg = "succeeded";
+		} else {
+			msg = "failed";
+			overall_status = status;
+		}
+		printf("  %u) TestCase ECDH private key generation for Curve %s %s\n",
+		       test_index ++, curve[curve_id], msg);
+	}
+
+	for (curve_id = SECP192R1; curve_id < END_OF_CURVE_LIST; curve_id++) {
+		status = test_ecdh_pub_key_generate(curve_id);
+		if (status == TEST_SUCCESS) {
+			msg = "succeeded";
+		} else {
+			msg = "failed";
+			overall_status = status;
+		}
+		printf("  %u) TestCase ECDH public key generation for Curve %s %s\n",
+		       test_index ++, curve[curve_id], msg);
+	}
+
+	for (curve_id = SECP192R1; curve_id < END_OF_CURVE_LIST; curve_id++) {
+		status = test_ecdh_pub_key_verify(curve_id);
+		if (status == TEST_SUCCESS) {
+			msg = "succeeded";
+		} else {
+			msg = "failed";
+			overall_status = status;
+		}
+		printf("  %u) TestCase ECDH public key verification for Curve %s %s\n",
+		       test_index ++, curve[curve_id], msg);
+	}
+
+	for (curve_id = SECP192R1; curve_id < END_OF_CURVE_LIST; curve_id++) {
+		status = test_ecdh_shared_secret(curve_id);
+		if (status == TEST_SUCCESS) {
+			msg = "succeeded";
+		} else {
+			msg = "failed";
+			overall_status = status;
+		}
+		printf("  %u) TestCase ECDH shared secret compute for Curve %s %s\n",
+		       test_index ++, curve[curve_id], msg);
+	}
+
+	return overall_status;
+}
+
 static int
 test_sm2_sign(void)
 {
@@ -2848,6 +3575,8 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite  = {
 			     test_ecdsa_sign_verify_all_curve),
 		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_sm2_sign),
 		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_sm2_verify),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+				test_ecdh_all_curve),
 		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
 				test_ecpm_all_curve),
 		TEST_CASES_END() /**< NULL terminate unit test array */
diff --git a/app/test/test_cryptodev_asym_util.h b/app/test/test_cryptodev_asym_util.h
index 83dc265dd7..07e6e831e8 100644
--- a/app/test/test_cryptodev_asym_util.h
+++ b/app/test/test_cryptodev_asym_util.h
@@ -57,4 +57,16 @@ static inline int verify_ecpm(uint8_t *result_x, uint8_t *result_y,
 
 	return 0;
 }
+
+static inline int verify_ecdh_secret(uint8_t *result_x, uint8_t *result_y,
+			      struct rte_crypto_op *result_op)
+{
+	if (memcmp(result_x, result_op->asym->ecdh.shared_secret.x.data,
+		   result_op->asym->ecdh.shared_secret.x.length) ||
+		   memcmp(result_y, result_op->asym->ecdh.shared_secret.y.data,
+		   result_op->asym->ecdh.shared_secret.y.length))
+		return -1;
+
+	return 0;
+}
 #endif /* TEST_CRYPTODEV_ASYM_TEST_UTIL_H__ */
diff --git a/app/test/test_cryptodev_ecdh_test_vectors.h b/app/test/test_cryptodev_ecdh_test_vectors.h
new file mode 100644
index 0000000000..5f22fbddcb
--- /dev/null
+++ b/app/test/test_cryptodev_ecdh_test_vectors.h
@@ -0,0 +1,577 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2023 Marvell International Ltd.
+ */
+
+#ifndef __TEST_CRYPTODEV_ECDH_TEST_VECTORS_H__
+#define __TEST_CRYPTODEV_ECDH_TEST_VECTORS_H__
+
+#include "rte_crypto_asym.h"
+
+#ifndef __TEST_CRYPTODEV_EC_CURVES__
+#define __TEST_CRYPTODEV_EC_CURVES__
+/* EC curve id */
+enum curve {
+	SECP192R1,
+	SECP224R1,
+	SECP256R1,
+	SECP384R1,
+	SECP521R1,
+	END_OF_CURVE_LIST
+};
+
+const char *curve[] = {
+	"SECP192R1",
+	"SECP224R1",
+	"SECP256R1",
+	"SECP384R1",
+	"SECP521R1"
+};
+#endif
+
+struct crypto_testsuite_ecdh_params {
+	rte_crypto_param pubkey_qA_x;
+	rte_crypto_param pubkey_qA_y;
+	rte_crypto_param pkey_A;
+	rte_crypto_param pubkey_qB_x;
+	rte_crypto_param pubkey_qB_y;
+	rte_crypto_param pkey_B;
+	rte_crypto_param secret_x;
+	rte_crypto_param secret_y;
+	int curve;
+};
+
+/*
+ * Test vector reference:
+ * https://datatracker.ietf.org/doc/html/rfc5114.html
+ * Appendix A.
+ */
+
+/** SECP192R1 (P-192 NIST) test vector */
+
+static uint8_t dA_secp192r1[] = {
+	0x32, 0x3F, 0xA3, 0x16, 0x9D, 0x8E, 0x9C, 0x65,
+	0x93, 0xF5, 0x94, 0x76, 0xBC, 0x14, 0x20, 0x00,
+	0xAB, 0x5B, 0xE0, 0xE2, 0x49, 0xC4, 0x34, 0x26
+};
+
+static uint8_t x_qA_secp192r1[] = {
+	0xCD, 0x46, 0x48, 0x9E, 0xCF, 0xD6, 0xC1, 0x05,
+	0xE7, 0xB3, 0xD3, 0x25, 0x66, 0xE2, 0xB1, 0x22,
+	0xE2, 0x49, 0xAB, 0xAA, 0xDD, 0x87, 0x06, 0x12
+};
+
+static uint8_t y_qA_secp192r1[] = {
+	0x68, 0x88, 0x7B, 0x48, 0x77, 0xDF, 0x51, 0xDD,
+	0x4D, 0xC3, 0xD6, 0xFD, 0x11, 0xF0, 0xA2, 0x6F,
+	0x8F, 0xD3, 0x84, 0x43, 0x17, 0x91, 0x6E, 0x9A
+};
+
+static uint8_t dB_secp192r1[] = {
+	0x63, 0x1F, 0x95, 0xBB, 0x4A, 0x67, 0x63, 0x2C,
+	0x9C, 0x47, 0x6E, 0xEE, 0x9A, 0xB6, 0x95, 0xAB,
+	0x24, 0x0A, 0x04, 0x99, 0x30, 0x7F, 0xCF, 0x62
+};
+
+static uint8_t x_qB_secp192r1[] = {
+	0x51, 0x9A, 0x12, 0x16, 0x80, 0xE0, 0x04, 0x54,
+	0x66, 0xBA, 0x21, 0xDF, 0x2E, 0xEE, 0x47, 0xF5,
+	0x97, 0x3B, 0x50, 0x05, 0x77, 0xEF, 0x13, 0xD5
+};
+
+static uint8_t y_qB_secp192r1[] = {
+	0xFF, 0x61, 0x3A, 0xB4, 0xD6, 0x4C, 0xEE, 0x3A,
+	0x20, 0x87, 0x5B, 0xDB, 0x10, 0xF9, 0x53, 0xF6,
+	0xB3, 0x0C, 0xA0, 0x72, 0xC6, 0x0A, 0xA5, 0x7F
+};
+
+static uint8_t x_Z_secp192r1[] = {
+	0xAD, 0x42, 0x01, 0x82, 0x63, 0x3F, 0x85, 0x26,
+	0xBF, 0xE9, 0x54, 0xAC, 0xDA, 0x37, 0x6F, 0x05,
+	0xE5, 0xFF, 0x4F, 0x83, 0x7F, 0x54, 0xFE, 0xBE
+};
+
+static uint8_t y_Z_secp192r1[] = {
+	0x43, 0x71, 0x54, 0x5E, 0xD7, 0x72, 0xA5, 0x97,
+	0x41, 0xD0, 0xED, 0xA3, 0x2C, 0x67, 0x11, 0x12,
+	0xB7, 0xFD, 0xDD, 0x51, 0x46, 0x1F, 0xCF, 0x32
+};
+
+/** ECDH SECP192R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp192r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp192r1,
+		.length = sizeof(x_qA_secp192r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp192r1,
+		.length = sizeof(y_qA_secp192r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp192r1,
+		.length = sizeof(x_qB_secp192r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp192r1,
+		.length = sizeof(y_qB_secp192r1),
+	},
+	.pkey_A = {
+		.data = dA_secp192r1,
+		.length = sizeof(dA_secp192r1),
+	},
+	.pkey_B = {
+		.data = dB_secp192r1,
+		.length = sizeof(dB_secp192r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp192r1,
+		.length = sizeof(x_Z_secp192r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp192r1,
+		.length = sizeof(y_Z_secp192r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP192R1
+};
+
+/** SECP224R1 (P-224 NIST) test vector */
+
+static uint8_t dA_secp224r1[] = {
+	0xB5, 0x58, 0xEB, 0x6C, 0x28, 0x8D, 0xA7, 0x07,
+	0xBB, 0xB4, 0xF8, 0xFB, 0xAE, 0x2A, 0xB9, 0xE9,
+	0xCB, 0x62, 0xE3, 0xBC, 0x5C, 0x75, 0x73, 0xE2,
+	0x2E, 0x26, 0xD3, 0x7F
+};
+
+static uint8_t x_qA_secp224r1[] = {
+	0x49, 0xDF, 0xEF, 0x30, 0x9F, 0x81, 0x48, 0x8C,
+	0x30, 0x4C, 0xFF, 0x5A, 0xB3, 0xEE, 0x5A, 0x21,
+	0x54, 0x36, 0x7D, 0xC7, 0x83, 0x31, 0x50, 0xE0,
+	0xA5, 0x1F, 0x3E, 0xEB
+};
+
+static uint8_t y_qA_secp224r1[] = {
+	0x4F, 0x2B, 0x5E, 0xE4, 0x57, 0x62, 0xC4, 0xF6,
+	0x54, 0xC1, 0xA0, 0xC6, 0x7F, 0x54, 0xCF, 0x88,
+	0xB0, 0x16, 0xB5, 0x1B, 0xCE, 0x3D, 0x7C, 0x22,
+	0x8D, 0x57, 0xAD, 0xB4,
+};
+
+static uint8_t dB_secp224r1[] = {
+	0xAC, 0x3B, 0x1A, 0xDD, 0x3D, 0x97, 0x70, 0xE6,
+	0xF6, 0xA7, 0x08, 0xEE, 0x9F, 0x3B, 0x8E, 0x0A,
+	0xB3, 0xB4, 0x80, 0xE9, 0xF2, 0x7F, 0x85, 0xC8,
+	0x8B, 0x5E, 0x6D, 0x18,
+};
+
+static uint8_t x_qB_secp224r1[] = {
+	0x6B, 0x3A, 0xC9, 0x6A, 0x8D, 0x0C, 0xDE, 0x6A,
+	0x55, 0x99, 0xBE, 0x80, 0x32, 0xED, 0xF1, 0x0C,
+	0x16, 0x2D, 0x0A, 0x8A, 0xD2, 0x19, 0x50, 0x6D,
+	0xCD, 0x42, 0xA2, 0x07,
+};
+
+static uint8_t y_qB_secp224r1[] = {
+	0xD4, 0x91, 0xBE, 0x99, 0xC2, 0x13, 0xA7, 0xD1,
+	0xCA, 0x37, 0x06, 0xDE, 0xBF, 0xE3, 0x05, 0xF3,
+	0x61, 0xAF, 0xCB, 0xB3, 0x3E, 0x26, 0x09, 0xC8,
+	0xB1, 0x61, 0x8A, 0xD5
+};
+
+static uint8_t x_Z_secp224r1[] = {
+	0x52, 0x27, 0x2F, 0x50, 0xF4, 0x6F, 0x4E, 0xDC,
+	0x91, 0x51, 0x56, 0x90, 0x92, 0xF4, 0x6D, 0xF2,
+	0xD9, 0x6E, 0xCC, 0x3B, 0x6D, 0xC1, 0x71, 0x4A,
+	0x4E, 0xA9, 0x49, 0xFA
+};
+
+static uint8_t y_Z_secp224r1[] = {
+	0x5F, 0x30, 0xC6, 0xAA, 0x36, 0xDD, 0xC4, 0x03,
+	0xC0, 0xAC, 0xB7, 0x12, 0xBB, 0x88, 0xF1, 0x76,
+	0x3C, 0x30, 0x46, 0xF6, 0xD9, 0x19, 0xBD, 0x9C,
+	0x52, 0x43, 0x22, 0xBF
+};
+
+/** ECDH SECP224R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp224r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp224r1,
+		.length = sizeof(x_qA_secp224r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp224r1,
+		.length = sizeof(y_qA_secp224r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp224r1,
+		.length = sizeof(x_qB_secp224r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp224r1,
+		.length = sizeof(y_qB_secp224r1),
+	},
+	.pkey_A = {
+		.data = dA_secp224r1,
+		.length = sizeof(dA_secp224r1),
+	},
+	.pkey_B = {
+		.data = dB_secp224r1,
+		.length = sizeof(dB_secp224r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp224r1,
+		.length = sizeof(x_Z_secp224r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp224r1,
+		.length = sizeof(y_Z_secp224r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP224R1
+};
+
+/** SECP256R1 (P-256 NIST) test vector */
+
+static uint8_t dA_secp256r1[] = {
+	0x81, 0x42, 0x64, 0x14, 0x5F, 0x2F, 0x56, 0xF2,
+	0xE9, 0x6A, 0x8E, 0x33, 0x7A, 0x12, 0x84, 0x99,
+	0x3F, 0xAF, 0x43, 0x2A, 0x5A, 0xBC, 0xE5, 0x9E,
+	0x86, 0x7B, 0x72, 0x91, 0xD5, 0x07, 0xA3, 0xAF
+};
+
+static uint8_t x_qA_secp256r1[] = {
+	0x2A, 0xF5, 0x02, 0xF3, 0xBE, 0x89, 0x52, 0xF2,
+	0xC9, 0xB5, 0xA8, 0xD4, 0x16, 0x0D, 0x09, 0xE9,
+	0x71, 0x65, 0xBE, 0x50, 0xBC, 0x42, 0xAE, 0x4A,
+	0x5E, 0x8D, 0x3B, 0x4B, 0xA8, 0x3A, 0xEB, 0x15
+};
+
+static uint8_t y_qA_secp256r1[] = {
+	0xEB, 0x0F, 0xAF, 0x4C, 0xA9, 0x86, 0xC4, 0xD3,
+	0x86, 0x81, 0xA0, 0xF9, 0x87, 0x2D, 0x79, 0xD5,
+	0x67, 0x95, 0xBD, 0x4B, 0xFF, 0x6E, 0x6D, 0xE3,
+	0xC0, 0xF5, 0x01, 0x5E, 0xCE, 0x5E, 0xFD, 0x85
+};
+
+static uint8_t dB_secp256r1[] = {
+	0x2C, 0xE1, 0x78, 0x8E, 0xC1, 0x97, 0xE0, 0x96,
+	0xDB, 0x95, 0xA2, 0x00, 0xCC, 0x0A, 0xB2, 0x6A,
+	0x19, 0xCE, 0x6B, 0xCC, 0xAD, 0x56, 0x2B, 0x8E,
+	0xEE, 0x1B, 0x59, 0x37, 0x61, 0xCF, 0x7F, 0x41
+};
+
+static uint8_t x_qB_secp256r1[] = {
+	0xB1, 0x20, 0xDE, 0x4A, 0xA3, 0x64, 0x92, 0x79,
+	0x53, 0x46, 0xE8, 0xDE, 0x6C, 0x2C, 0x86, 0x46,
+	0xAE, 0x06, 0xAA, 0xEA, 0x27, 0x9F, 0xA7, 0x75,
+	0xB3, 0xAB, 0x07, 0x15, 0xF6, 0xCE, 0x51, 0xB0
+};
+
+static uint8_t y_qB_secp256r1[] = {
+	0x9F, 0x1B, 0x7E, 0xEC, 0xE2, 0x0D, 0x7B, 0x5E,
+	0xD8, 0xEC, 0x68, 0x5F, 0xA3, 0xF0, 0x71, 0xD8,
+	0x37, 0x27, 0x02, 0x70, 0x92, 0xA8, 0x41, 0x13,
+	0x85, 0xC3, 0x4D, 0xDE, 0x57, 0x08, 0xB2, 0xB6
+};
+
+static uint8_t x_Z_secp256r1[] = {
+	0xDD, 0x0F, 0x53, 0x96, 0x21, 0x9D, 0x1E, 0xA3,
+	0x93, 0x31, 0x04, 0x12, 0xD1, 0x9A, 0x08, 0xF1,
+	0xF5, 0x81, 0x1E, 0x9D, 0xC8, 0xEC, 0x8E, 0xEA,
+	0x7F, 0x80, 0xD2, 0x1C, 0x82, 0x0C, 0x27, 0x88
+};
+
+static uint8_t y_Z_secp256r1[] = {
+	0x03, 0x57, 0xDC, 0xCD, 0x4C, 0x80, 0x4D, 0x0D,
+	0x8D, 0x33, 0xAA, 0x42, 0xB8, 0x48, 0x83, 0x4A,
+	0xA5, 0x60, 0x5F, 0x9A, 0xB0, 0xD3, 0x72, 0x39,
+	0xA1, 0x15, 0xBB, 0xB6, 0x47, 0x93, 0x6F, 0x50
+};
+
+/** ECDH SECP256R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp256r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp256r1,
+		.length = sizeof(x_qA_secp256r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp256r1,
+		.length = sizeof(y_qA_secp256r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp256r1,
+		.length = sizeof(x_qB_secp256r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp256r1,
+		.length = sizeof(y_qB_secp256r1),
+	},
+	.pkey_A = {
+		.data = dA_secp256r1,
+		.length = sizeof(dA_secp256r1),
+	},
+	.pkey_B = {
+		.data = dB_secp256r1,
+		.length = sizeof(dB_secp256r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp256r1,
+		.length = sizeof(x_Z_secp256r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp256r1,
+		.length = sizeof(y_Z_secp256r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP256R1
+};
+
+/** SECP384R1 (P-384 NIST) test vector */
+
+static uint8_t dA_secp384r1[] = {
+	0xD2, 0x73, 0x35, 0xEA, 0x71, 0x66, 0x4A, 0xF2,
+	0x44, 0xDD, 0x14, 0xE9, 0xFD, 0x12, 0x60, 0x71,
+	0x5D, 0xFD, 0x8A, 0x79, 0x65, 0x57, 0x1C, 0x48,
+	0xD7, 0x09, 0xEE, 0x7A, 0x79, 0x62, 0xA1, 0x56,
+	0xD7, 0x06, 0xA9, 0x0C, 0xBC, 0xB5, 0xDF, 0x29,
+	0x86, 0xF0, 0x5F, 0xEA, 0xDB, 0x93, 0x76, 0xF1
+};
+
+static uint8_t x_qA_secp384r1[] = {
+	0x79, 0x31, 0x48, 0xF1, 0x78, 0x76, 0x34, 0xD5,
+	0xDA, 0x4C, 0x6D, 0x90, 0x74, 0x41, 0x7D, 0x05,
+	0xE0, 0x57, 0xAB, 0x62, 0xF8, 0x20, 0x54, 0xD1,
+	0x0E, 0xE6, 0xB0, 0x40, 0x3D, 0x62, 0x79, 0x54,
+	0x7E, 0x6A, 0x8E, 0xA9, 0xD1, 0xFD, 0x77, 0x42,
+	0x7D, 0x01, 0x6F, 0xE2, 0x7A, 0x8B, 0x8C, 0x66
+};
+
+static uint8_t y_qA_secp384r1[] = {
+	0xC6, 0xC4, 0x12, 0x94, 0x33, 0x1D, 0x23, 0xE6,
+	0xF4, 0x80, 0xF4, 0xFB, 0x4C, 0xD4, 0x05, 0x04,
+	0xC9, 0x47, 0x39, 0x2E, 0x94, 0xF4, 0xC3, 0xF0,
+	0x6B, 0x8F, 0x39, 0x8B, 0xB2, 0x9E, 0x42, 0x36,
+	0x8F, 0x7A, 0x68, 0x59, 0x23, 0xDE, 0x3B, 0x67,
+	0xBA, 0xCE, 0xD2, 0x14, 0xA1, 0xA1, 0xD1, 0x28
+};
+
+static uint8_t dB_secp384r1[] = {
+	0x52, 0xD1, 0x79, 0x1F, 0xDB, 0x4B, 0x70, 0xF8,
+	0x9C, 0x0F, 0x00, 0xD4, 0x56, 0xC2, 0xF7, 0x02,
+	0x3B, 0x61, 0x25, 0x26, 0x2C, 0x36, 0xA7, 0xDF,
+	0x1F, 0x80, 0x23, 0x11, 0x21, 0xCC, 0xE3, 0xD3,
+	0x9B, 0xE5, 0x2E, 0x00, 0xC1, 0x94, 0xA4, 0x13,
+	0x2C, 0x4A, 0x6C, 0x76, 0x8B, 0xCD, 0x94, 0xD2
+};
+
+static uint8_t x_qB_secp384r1[] = {
+	0x5C, 0xD4, 0x2A, 0xB9, 0xC4, 0x1B, 0x53, 0x47,
+	0xF7, 0x4B, 0x8D, 0x4E, 0xFB, 0x70, 0x8B, 0x3D,
+	0x5B, 0x36, 0xDB, 0x65, 0x91, 0x53, 0x59, 0xB4,
+	0x4A, 0xBC, 0x17, 0x64, 0x7B, 0x6B, 0x99, 0x99,
+	0x78, 0x9D, 0x72, 0xA8, 0x48, 0x65, 0xAE, 0x2F,
+	0x22, 0x3F, 0x12, 0xB5, 0xA1, 0xAB, 0xC1, 0x20
+};
+
+static uint8_t y_qB_secp384r1[] = {
+	0xE1, 0x71, 0x45, 0x8F, 0xEA, 0xA9, 0x39, 0xAA,
+	0xA3, 0xA8, 0xBF, 0xAC, 0x46, 0xB4, 0x04, 0xBD,
+	0x8F, 0x6D, 0x5B, 0x34, 0x8C, 0x0F, 0xA4, 0xD8,
+	0x0C, 0xEC, 0xA1, 0x63, 0x56, 0xCA, 0x93, 0x32,
+	0x40, 0xBD, 0xE8, 0x72, 0x34, 0x15, 0xA8, 0xEC,
+	0xE0, 0x35, 0xB0, 0xED, 0xF3, 0x67, 0x55, 0xDE
+};
+
+static uint8_t x_Z_secp384r1[] = {
+	0x5E, 0xA1, 0xFC, 0x4A, 0xF7, 0x25, 0x6D, 0x20,
+	0x55, 0x98, 0x1B, 0x11, 0x05, 0x75, 0xE0, 0xA8,
+	0xCA, 0xE5, 0x31, 0x60, 0x13, 0x7D, 0x90, 0x4C,
+	0x59, 0xD9, 0x26, 0xEB, 0x1B, 0x84, 0x56, 0xE4,
+	0x27, 0xAA, 0x8A, 0x45, 0x40, 0x88, 0x4C, 0x37,
+	0xDE, 0x15, 0x9A, 0x58, 0x02, 0x8A, 0xBC, 0x0E
+};
+
+static uint8_t y_Z_secp384r1[] = {
+	0x0C, 0xC5, 0x9E, 0x4B, 0x04, 0x64, 0x14, 0xA8,
+	0x1C, 0x8A, 0x3B, 0xDF, 0xDC, 0xA9, 0x25, 0x26,
+	0xC4, 0x87, 0x69, 0xDD, 0x8D, 0x31, 0x27, 0xCA,
+	0xA9, 0x9B, 0x36, 0x32, 0xD1, 0x91, 0x39, 0x42,
+	0xDE, 0x36, 0x2E, 0xAF, 0xAA, 0x96, 0x23, 0x79,
+	0x37, 0x4D, 0x9F, 0x3F, 0x06, 0x68, 0x41, 0xCA
+};
+
+/** ECDH SECP384R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp384r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp384r1,
+		.length = sizeof(x_qA_secp384r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp384r1,
+		.length = sizeof(y_qA_secp384r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp384r1,
+		.length = sizeof(x_qB_secp384r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp384r1,
+		.length = sizeof(y_qB_secp384r1),
+	},
+	.pkey_A = {
+		.data = dA_secp384r1,
+		.length = sizeof(dA_secp384r1),
+	},
+	.pkey_B = {
+		.data = dB_secp384r1,
+		.length = sizeof(dB_secp384r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp384r1,
+		.length = sizeof(x_Z_secp384r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp384r1,
+		.length = sizeof(y_Z_secp384r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP384R1
+};
+
+/** SECP521R1 (P-521 NIST) test vector */
+
+static uint8_t dA_secp521r1[] = {
+	0x01, 0x13, 0xF8, 0x2D, 0xA8, 0x25, 0x73, 0x5E,
+	0x3D, 0x97, 0x27, 0x66, 0x83, 0xB2, 0xB7, 0x42,
+	0x77, 0xBA, 0xD2, 0x73, 0x35, 0xEA, 0x71, 0x66,
+	0x4A, 0xF2, 0x43, 0x0C, 0xC4, 0xF3, 0x34, 0x59,
+	0xB9, 0x66, 0x9E, 0xE7, 0x8B, 0x3F, 0xFB, 0x9B,
+	0x86, 0x83, 0x01, 0x5D, 0x34, 0x4D, 0xCB, 0xFE,
+	0xF6, 0xFB, 0x9A, 0xF4, 0xC6, 0xC4, 0x70, 0xBE,
+	0x25, 0x45, 0x16, 0xCD, 0x3C, 0x1A, 0x1F, 0xB4,
+	0x73, 0x62
+};
+
+static uint8_t x_qA_secp521r1[] = {
+	0x01, 0xEB, 0xB3, 0x4D, 0xD7, 0x57, 0x21, 0xAB,
+	0xF8, 0xAD, 0xC9, 0xDB, 0xED, 0x17, 0x88, 0x9C,
+	0xBB, 0x97, 0x65, 0xD9, 0x0A, 0x7C, 0x60, 0xF2,
+	0xCE, 0xF0, 0x07, 0xBB, 0x0F, 0x2B, 0x26, 0xE1,
+	0x48, 0x81, 0xFD, 0x44, 0x42, 0xE6, 0x89, 0xD6,
+	0x1C, 0xB2, 0xDD, 0x04, 0x6E, 0xE3, 0x0E, 0x3F,
+	0xFD, 0x20, 0xF9, 0xA4, 0x5B, 0xBD, 0xF6, 0x41,
+	0x3D, 0x58, 0x3A, 0x2D, 0xBF, 0x59, 0x92, 0x4F,
+	0xD3, 0x5C
+};
+
+static uint8_t y_qA_secp521r1[] = {
+	0x00, 0xF6, 0xB6, 0x32, 0xD1, 0x94, 0xC0, 0x38,
+	0x8E, 0x22, 0xD8, 0x43, 0x7E, 0x55, 0x8C, 0x55,
+	0x2A, 0xE1, 0x95, 0xAD, 0xFD, 0x15, 0x3F, 0x92,
+	0xD7, 0x49, 0x08, 0x35, 0x1B, 0x2F, 0x8C, 0x4E,
+	0xDA, 0x94, 0xED, 0xB0, 0x91, 0x6D, 0x1B, 0x53,
+	0xC0, 0x20, 0xB5, 0xEE, 0xCA, 0xED, 0x1A, 0x5F,
+	0xC3, 0x8A, 0x23, 0x3E, 0x48, 0x30, 0x58, 0x7B,
+	0xB2, 0xEE, 0x34, 0x89, 0xB3, 0xB4, 0x2A, 0x5A,
+	0x86, 0xA4
+};
+
+static uint8_t dB_secp521r1[] = {
+	0x00, 0xCE, 0xE3, 0x48, 0x0D, 0x86, 0x45, 0xA1,
+	0x7D, 0x24, 0x9F, 0x27, 0x76, 0xD2, 0x8B, 0xAE,
+	0x61, 0x69, 0x52, 0xD1, 0x79, 0x1F, 0xDB, 0x4B,
+	0x70, 0xF7, 0xC3, 0x37, 0x87, 0x32, 0xAA, 0x1B,
+	0x22, 0x92, 0x84, 0x48, 0xBC, 0xD1, 0xDC, 0x24,
+	0x96, 0xD4, 0x35, 0xB0, 0x10, 0x48, 0x06, 0x6E,
+	0xBE, 0x4F, 0x72, 0x90, 0x3C, 0x36, 0x1B, 0x1A,
+	0x9D, 0xC1, 0x19, 0x3D, 0xC2, 0xC9, 0xD0, 0x89,
+	0x1B, 0x96
+};
+
+static uint8_t x_qB_secp521r1[] = {
+	0x01, 0x0E, 0xBF, 0xAF, 0xC6, 0xE8, 0x5E, 0x08,
+	0xD2, 0x4B, 0xFF, 0xFC, 0xC1, 0xA4, 0x51, 0x1D,
+	0xB0, 0xE6, 0x34, 0xBE, 0xEB, 0x1B, 0x6D, 0xEC,
+	0x8C, 0x59, 0x39, 0xAE, 0x44, 0x76, 0x62, 0x01,
+	0xAF, 0x62, 0x00, 0x43, 0x0B, 0xA9, 0x7C, 0x8A,
+	0xC6, 0xA0, 0xE9, 0xF0, 0x8B, 0x33, 0xCE, 0x7E,
+	0x9F, 0xEE, 0xB5, 0xBA, 0x4E, 0xE5, 0xE0, 0xD8,
+	0x15, 0x10, 0xC2, 0x42, 0x95, 0xB8, 0xA0, 0x8D,
+	0x02, 0x35
+};
+
+static uint8_t y_qB_secp521r1[] = {
+	0x00, 0xA4, 0xA6, 0xEC, 0x30, 0x0D, 0xF9, 0xE2,
+	0x57, 0xB0, 0x37, 0x2B, 0x5E, 0x7A, 0xBF, 0xEF,
+	0x09, 0x34, 0x36, 0x71, 0x9A, 0x77, 0x88, 0x7E,
+	0xBB, 0x0B, 0x18, 0xCF, 0x80, 0x99, 0xB9, 0xF4,
+	0x21, 0x2B, 0x6E, 0x30, 0xA1, 0x41, 0x9C, 0x18,
+	0xE0, 0x29, 0xD3, 0x68, 0x63, 0xCC, 0x9D, 0x44,
+	0x8F, 0x4D, 0xBA, 0x4D, 0x2A, 0x0E, 0x60, 0x71,
+	0x1B, 0xE5, 0x72, 0x91, 0x5F, 0xBD, 0x4F, 0xEF,
+	0x26, 0x95
+};
+
+static uint8_t x_Z_secp521r1[] = {
+	0x00, 0xCD, 0xEA, 0x89, 0x62, 0x1C, 0xFA, 0x46,
+	0xB1, 0x32, 0xF9, 0xE4, 0xCF, 0xE2, 0x26, 0x1C,
+	0xDE, 0x2D, 0x43, 0x68, 0xEB, 0x56, 0x56, 0x63,
+	0x4C, 0x7C, 0xC9, 0x8C, 0x7A, 0x00, 0xCD, 0xE5,
+	0x4E, 0xD1, 0x86, 0x6A, 0x0D, 0xD3, 0xE6, 0x12,
+	0x6C, 0x9D, 0x2F, 0x84, 0x5D, 0xAF, 0xF8, 0x2C,
+	0xEB, 0x1D, 0xA0, 0x8F, 0x5D, 0x87, 0x52, 0x1B,
+	0xB0, 0xEB, 0xEC, 0xA7, 0x79, 0x11, 0x16, 0x9C,
+	0x20, 0xCC
+};
+
+static uint8_t y_Z_secp521r1[] = {
+	0x00, 0xF9, 0xA7, 0x16, 0x41, 0x02, 0x9B, 0x7F,
+	0xC1, 0xA8, 0x08, 0xAD, 0x07, 0xCD, 0x48, 0x61,
+	0xE8, 0x68, 0x61, 0x4B, 0x86, 0x5A, 0xFB, 0xEC,
+	0xAB, 0x1F, 0x2B, 0xD4, 0xD8, 0xB5, 0x5E, 0xBC,
+	0xB5, 0xE3, 0xA5, 0x31, 0x43, 0xCE, 0xB2, 0xC5,
+	0x11, 0xB1, 0xAE, 0x0A, 0xF5, 0xAC, 0x82, 0x7F,
+	0x60, 0xF2, 0xFD, 0x87, 0x25, 0x65, 0xAC, 0x5C,
+	0xA0, 0xA1, 0x64, 0x03, 0x8F, 0xE9, 0x80, 0xA7,
+	0xE4, 0xBD
+};
+
+/** ECDH SECP521R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp521r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp521r1,
+		.length = sizeof(x_qA_secp521r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp521r1,
+		.length = sizeof(y_qA_secp521r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp521r1,
+		.length = sizeof(x_qB_secp521r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp521r1,
+		.length = sizeof(y_qB_secp521r1),
+	},
+	.pkey_A = {
+		.data = dA_secp521r1,
+		.length = sizeof(dA_secp521r1),
+	},
+	.pkey_B = {
+		.data = dB_secp521r1,
+		.length = sizeof(dB_secp521r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp521r1,
+		.length = sizeof(x_Z_secp521r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp521r1,
+		.length = sizeof(y_Z_secp521r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP521R1
+};
+
+#endif /* __TEST_CRYPTODEV_ECDSA_TEST_VECTORS_H__ */
diff --git a/app/test/test_cryptodev_ecdsa_test_vectors.h b/app/test/test_cryptodev_ecdsa_test_vectors.h
index 55fbda5979..9ac3189ce7 100644
--- a/app/test/test_cryptodev_ecdsa_test_vectors.h
+++ b/app/test/test_cryptodev_ecdsa_test_vectors.h
@@ -7,6 +7,8 @@
 
 #include "rte_crypto_asym.h"
 
+#ifndef __TEST_CRYPTODEV_EC_CURVES__
+#define __TEST_CRYPTODEV_EC_CURVES__
 /* EC curve id */
 enum curve {
 	SECP192R1,
@@ -22,6 +24,7 @@ const char *curve[] = {"SECP192R1",
 		       "SECP256R1",
 		       "SECP384R1",
 		       "SECP521R1"};
+#endif
 
 struct crypto_testsuite_ecdsa_params {
 	rte_crypto_param pubkey_qx;
-- 
2.25.1


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

* [PATCH v1 2/4] crypto/cnxk: use generic EC opcodes
  2023-10-26  8:15 [PATCH v1 0/4] test/cryptodev: add ECDH tests Gowrishankar Muthukrishnan
  2023-10-26  8:15 ` [PATCH v1 1/4] " Gowrishankar Muthukrishnan
@ 2023-10-26  8:15 ` Gowrishankar Muthukrishnan
  2023-10-26  8:15 ` [PATCH v1 3/4] crypto/cnxk: change order of ECFPM params Gowrishankar Muthukrishnan
  2023-10-26  8:15 ` [PATCH v1 4/4] crypto/cnxk: add ECDH support Gowrishankar Muthukrishnan
  3 siblings, 0 replies; 9+ messages in thread
From: Gowrishankar Muthukrishnan @ 2023-10-26  8:15 UTC (permalink / raw)
  To: dev; +Cc: anoobj, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan

Use generic EC opcodes for sign and verify ops in ECDSA and SM2
implementations.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 drivers/common/cnxk/roc_ae.h  | 14 +++++++---
 drivers/crypto/cnxk/cnxk_ae.h | 50 +++++++++++++++++++----------------
 2 files changed, 38 insertions(+), 26 deletions(-)

diff --git a/drivers/common/cnxk/roc_ae.h b/drivers/common/cnxk/roc_ae.h
index d459c5e680..eaf12ab254 100644
--- a/drivers/common/cnxk/roc_ae.h
+++ b/drivers/common/cnxk/roc_ae.h
@@ -5,9 +5,11 @@
 #ifndef __ROC_AE_H__
 #define __ROC_AE_H__
 
+#include "roc_platform.h"
+
 /* AE opcodes */
 #define ROC_AE_MAJOR_OP_MODEX	     0x03
-#define ROC_AE_MAJOR_OP_ECDSA	     0x04
+#define ROC_AE_MAJOR_OP_EC	     0x04
 #define ROC_AE_MAJOR_OP_ECC	     0x05
 #define ROC_AE_MINOR_OP_MODEX	     0x01
 #define ROC_AE_MINOR_OP_PKCS_ENC     0x02
@@ -15,8 +17,8 @@
 #define ROC_AE_MINOR_OP_PKCS_DEC     0x04
 #define ROC_AE_MINOR_OP_PKCS_DEC_CRT 0x05
 #define ROC_AE_MINOR_OP_MODEX_CRT    0x06
-#define ROC_AE_MINOR_OP_ECDSA_SIGN   0x01
-#define ROC_AE_MINOR_OP_ECDSA_VERIFY 0x02
+#define ROC_AE_MINOR_OP_EC_SIGN      0x01
+#define ROC_AE_MINOR_OP_EC_VERIFY    0x02
 #define ROC_AE_MINOR_OP_ECC_UMP	     0x03
 #define ROC_AE_MINOR_OP_ECC_FPM	     0x04
 
@@ -38,6 +40,12 @@ typedef enum {
 	ROC_AE_EC_ID_PMAX
 } roc_ae_ec_id;
 
+/* EC param1 fields */
+#define ROC_AE_EC_PARAM1_ECDSA     (0 << 7)
+#define ROC_AE_EC_PARAM1_SM2       (1 << 7)
+#define ROC_AE_EC_PARAM1_NIST      (0 << 6)
+#define ROC_AE_EC_PARAM1_NONNIST   (1 << 6)
+
 /* Prime and order fields of built-in elliptic curves */
 struct roc_ae_ec_group {
 	struct {
diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h
index 09468d58b0..6e61ccb0c5 100644
--- a/drivers/crypto/cnxk/cnxk_ae.h
+++ b/drivers/crypto/cnxk/cnxk_ae.h
@@ -588,8 +588,8 @@ cnxk_ae_ecdsa_sign_prep(struct rte_crypto_ecdsa_op_param *ecdsa,
 	dptr += p_align;
 
 	/* Setup opcodes */
-	w4.s.opcode_major = ROC_AE_MAJOR_OP_ECDSA;
-	w4.s.opcode_minor = ROC_AE_MINOR_OP_ECDSA_SIGN;
+	w4.s.opcode_major = ROC_AE_MAJOR_OP_EC;
+	w4.s.opcode_minor = ROC_AE_MINOR_OP_EC_SIGN;
 
 	w4.s.param1 = curveid | (message_len << 8);
 	w4.s.param2 = (p_align << 8) | k_len;
@@ -683,8 +683,8 @@ cnxk_ae_ecdsa_verify_prep(struct rte_crypto_ecdsa_op_param *ecdsa,
 	dptr += p_align;
 
 	/* Setup opcodes */
-	w4.s.opcode_major = ROC_AE_MAJOR_OP_ECDSA;
-	w4.s.opcode_minor = ROC_AE_MINOR_OP_ECDSA_VERIFY;
+	w4.s.opcode_major = ROC_AE_MAJOR_OP_EC;
+	w4.s.opcode_minor = ROC_AE_MINOR_OP_EC_VERIFY;
 
 	w4.s.param1 = curveid | (message_len << 8);
 	w4.s.param2 = 0;
@@ -719,9 +719,9 @@ cnxk_ae_enqueue_ecdsa_op(struct rte_crypto_op *op,
 
 static __rte_always_inline void
 cnxk_ae_sm2_sign_prep(struct rte_crypto_sm2_op_param *sm2,
-			 struct roc_ae_buf_ptr *meta_buf,
-			 uint64_t fpm_table_iova, struct roc_ae_ec_group *ec_grp,
-			 struct cnxk_ae_sess *sess, struct cpt_inst_s *inst)
+			struct roc_ae_buf_ptr *meta_buf,
+			uint64_t fpm_table_iova, struct roc_ae_ec_group *ec_grp,
+			struct cnxk_ae_sess *sess, struct cpt_inst_s *inst)
 {
 	uint16_t message_len = sm2->message.length;
 	uint16_t pkey_len = sess->ec_ctx.pkey.length;
@@ -787,10 +787,12 @@ cnxk_ae_sm2_sign_prep(struct rte_crypto_sm2_op_param *sm2,
 	dptr += p_align;
 
 	/* Setup opcodes */
-	w4.s.opcode_major = ROC_AE_MAJOR_OP_ECDSA;
-	w4.s.opcode_minor = ROC_AE_MINOR_OP_ECDSA_SIGN;
+	w4.s.opcode_major = ROC_AE_MAJOR_OP_EC;
+	w4.s.opcode_minor = ROC_AE_MINOR_OP_EC_SIGN;
 
-	w4.s.param1 = 2 | 1 << 7 | 1 << 6 | (message_len << 8);
+	/* prime length of SM2 curve is same as that of P256. */
+	w4.s.param1 = ROC_AE_EC_ID_P256 |
+		ROC_AE_EC_PARAM1_SM2 | ROC_AE_EC_PARAM1_NONNIST | (message_len << 8);
 	w4.s.param2 = (p_align << 8) | k_len;
 	w4.s.dlen = dlen;
 
@@ -800,10 +802,10 @@ cnxk_ae_sm2_sign_prep(struct rte_crypto_sm2_op_param *sm2,
 
 static __rte_always_inline void
 cnxk_ae_sm2_verify_prep(struct rte_crypto_sm2_op_param *sm2,
-			 struct roc_ae_buf_ptr *meta_buf,
-			 uint64_t fpm_table_iova,
-			 struct roc_ae_ec_group *ec_grp, struct cnxk_ae_sess *sess,
-			 struct cpt_inst_s *inst)
+			  struct roc_ae_buf_ptr *meta_buf,
+			  uint64_t fpm_table_iova,
+			  struct roc_ae_ec_group *ec_grp, struct cnxk_ae_sess *sess,
+			  struct cpt_inst_s *inst)
 {
 	uint32_t message_len = sm2->message.length;
 	uint16_t o_offset, r_offset, s_offset;
@@ -881,10 +883,12 @@ cnxk_ae_sm2_verify_prep(struct rte_crypto_sm2_op_param *sm2,
 	dptr += p_align;
 
 	/* Setup opcodes */
-	w4.s.opcode_major = ROC_AE_MAJOR_OP_ECDSA;
-	w4.s.opcode_minor = ROC_AE_MINOR_OP_ECDSA_VERIFY;
+	w4.s.opcode_major = ROC_AE_MAJOR_OP_EC;
+	w4.s.opcode_minor = ROC_AE_MINOR_OP_EC_VERIFY;
 
-	w4.s.param1 = 2 | 1 << 7 | 1 << 6 | (message_len << 8);
+	/* prime length of SM2 curve is same as that of P256. */
+	w4.s.param1 = ROC_AE_EC_ID_P256 |
+		ROC_AE_EC_PARAM1_SM2 | ROC_AE_EC_PARAM1_NONNIST | (message_len << 8);
 	w4.s.param2 = 0;
 	w4.s.dlen = dlen;
 
@@ -894,20 +898,20 @@ cnxk_ae_sm2_verify_prep(struct rte_crypto_sm2_op_param *sm2,
 
 static __rte_always_inline int __rte_hot
 cnxk_ae_enqueue_sm2_op(struct rte_crypto_op *op,
-					   struct roc_ae_buf_ptr *meta_buf,
-					   struct cnxk_ae_sess *sess, uint64_t *fpm_iova,
-					   struct roc_ae_ec_group **ec_grp,
-					   struct cpt_inst_s *inst)
+			 struct roc_ae_buf_ptr *meta_buf,
+			 struct cnxk_ae_sess *sess, uint64_t *fpm_iova,
+			 struct roc_ae_ec_group **ec_grp,
+			 struct cpt_inst_s *inst)
 {
 	struct rte_crypto_sm2_op_param *sm2 = &op->asym->sm2;
 	uint8_t curveid = sess->ec_ctx.curveid;
 
 	if (sm2->op_type == RTE_CRYPTO_ASYM_OP_SIGN)
 		cnxk_ae_sm2_sign_prep(sm2, meta_buf, fpm_iova[curveid],
-							  ec_grp[curveid], sess, inst);
+					ec_grp[curveid], sess, inst);
 	else if (sm2->op_type == RTE_CRYPTO_ASYM_OP_VERIFY)
 		cnxk_ae_sm2_verify_prep(sm2, meta_buf, fpm_iova[curveid],
-								ec_grp[curveid], sess, inst);
+					  ec_grp[curveid], sess, inst);
 	else {
 		op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
 		return -EINVAL;
-- 
2.25.1


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

* [PATCH v1 3/4] crypto/cnxk: change order of ECFPM params
  2023-10-26  8:15 [PATCH v1 0/4] test/cryptodev: add ECDH tests Gowrishankar Muthukrishnan
  2023-10-26  8:15 ` [PATCH v1 1/4] " Gowrishankar Muthukrishnan
  2023-10-26  8:15 ` [PATCH v1 2/4] crypto/cnxk: use generic EC opcodes Gowrishankar Muthukrishnan
@ 2023-10-26  8:15 ` Gowrishankar Muthukrishnan
  2023-10-26  8:15 ` [PATCH v1 4/4] crypto/cnxk: add ECDH support Gowrishankar Muthukrishnan
  3 siblings, 0 replies; 9+ messages in thread
From: Gowrishankar Muthukrishnan @ 2023-10-26  8:15 UTC (permalink / raw)
  To: dev; +Cc: anoobj, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan

Change order of ECFPM params to match changes in v2.0 microcode.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 drivers/crypto/cnxk/cnxk_ae.h | 49 ++++++++++++++---------------------
 1 file changed, 20 insertions(+), 29 deletions(-)

diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h
index 6e61ccb0c5..f05ae4f4a1 100644
--- a/drivers/crypto/cnxk/cnxk_ae.h
+++ b/drivers/crypto/cnxk/cnxk_ae.h
@@ -923,7 +923,7 @@ static __rte_always_inline int
 cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 		   struct roc_ae_buf_ptr *meta_buf, uint64_t *fpm_iova,
 		   struct roc_ae_ec_group *ec_grp, uint8_t curveid,
-		   struct cpt_inst_s *inst, int cpt_ver)
+		   struct cpt_inst_s *inst)
 {
 	uint16_t scalar_align, p_align;
 	uint16_t dlen, prime_len;
@@ -942,34 +942,26 @@ cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	scalar_align = RTE_ALIGN_CEIL(ecpm->scalar.length, 8);
 
 	/*
-	 * Set dlen = sum(prime, scalar length, table address and
-	 * optionally ROUNDUP8(input point(x and y coordinates)).
+	 * Set dlen = sum(ROUNDUP8(input point(x and y coordinates), prime,
+	 * scalar length),
 	 * Please note point length is equivalent to prime of the curve
 	 */
-	if (cpt_ver == ROC_CPT_REVISION_ID_96XX_B0 || cpt_ver == ROC_CPT_REVISION_ID_96XX_C0 ||
-	    cpt_ver == ROC_CPT_REVISION_ID_98XX) {
-		dlen = sizeof(fpm_table_iova) + 3 * p_align + scalar_align;
-		memset(dptr, 0, dlen);
-		*(uint64_t *)dptr = fpm_table_iova;
-		dptr += sizeof(fpm_table_iova);
-		memcpy(dptr, ecpm->scalar.data, ecpm->scalar.length);
-		dptr += scalar_align;
-		memcpy(dptr, ec_grp->prime.data, ec_grp->prime.length);
-		dptr += p_align;
-		memcpy(dptr, ec_grp->consta.data, ec_grp->consta.length);
-		dptr += p_align;
-		memcpy(dptr, ec_grp->constb.data, ec_grp->constb.length);
-		dptr += p_align;
-	} else {
-		dlen = sizeof(fpm_table_iova) + p_align + scalar_align;
-		memset(dptr, 0, dlen);
-		memcpy(dptr, ecpm->scalar.data, ecpm->scalar.length);
-		dptr += scalar_align;
-		memcpy(dptr, ec_grp->prime.data, ec_grp->prime.length);
-		dptr += p_align;
-		*(uint64_t *)dptr = fpm_table_iova;
-		dptr += sizeof(fpm_table_iova);
-	}
+	dlen = sizeof(fpm_table_iova) + 3 * p_align + scalar_align;
+
+	memset(dptr, 0, dlen);
+
+	*(uint64_t *)dptr = fpm_table_iova;
+	dptr += sizeof(fpm_table_iova);
+
+	/* Copy scalar, prime */
+	memcpy(dptr, ecpm->scalar.data, ecpm->scalar.length);
+	dptr += scalar_align;
+	memcpy(dptr, ec_grp->prime.data, ec_grp->prime.length);
+	dptr += p_align;
+	memcpy(dptr, ec_grp->consta.data, ec_grp->consta.length);
+	dptr += p_align;
+	memcpy(dptr, ec_grp->constb.data, ec_grp->constb.length);
+	dptr += p_align;
 
 	/* Setup opcodes */
 	w4.s.opcode_major = ROC_AE_MAJOR_OP_ECC;
@@ -1224,8 +1216,7 @@ cnxk_ae_enqueue(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
 		ret = cnxk_ae_ecfpm_prep(&asym_op->ecpm, &meta_buf,
 					 sess->cnxk_fpm_iova,
 					 sess->ec_grp[sess->ec_ctx.curveid],
-					 sess->ec_ctx.curveid, inst,
-					 sess->lf->roc_cpt->cpt_revision);
+					 sess->ec_ctx.curveid, inst);
 		if (unlikely(ret))
 			goto req_fail;
 		break;
-- 
2.25.1


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

* [PATCH v1 4/4] crypto/cnxk: add ECDH support
  2023-10-26  8:15 [PATCH v1 0/4] test/cryptodev: add ECDH tests Gowrishankar Muthukrishnan
                   ` (2 preceding siblings ...)
  2023-10-26  8:15 ` [PATCH v1 3/4] crypto/cnxk: change order of ECFPM params Gowrishankar Muthukrishnan
@ 2023-10-26  8:15 ` Gowrishankar Muthukrishnan
  2023-10-30 18:49   ` Akhil Goyal
  3 siblings, 1 reply; 9+ messages in thread
From: Gowrishankar Muthukrishnan @ 2023-10-26  8:15 UTC (permalink / raw)
  To: dev; +Cc: anoobj, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan

Add ECDH support in CNXK PMD.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 doc/guides/cryptodevs/features/cn10k.ini      |   1 +
 doc/guides/cryptodevs/features/cn9k.ini       |   1 +
 drivers/common/cnxk/roc_ae.h                  |   7 +
 drivers/crypto/cnxk/cn10k_cryptodev_ops.c     |  12 ++
 drivers/crypto/cnxk/cnxk_ae.h                 | 143 ++++++++++++++++--
 drivers/crypto/cnxk/cnxk_cryptodev.h          |   2 +-
 .../crypto/cnxk/cnxk_cryptodev_capabilities.c |  14 ++
 7 files changed, 165 insertions(+), 15 deletions(-)

diff --git a/doc/guides/cryptodevs/features/cn10k.ini b/doc/guides/cryptodevs/features/cn10k.ini
index 4f542c6038..ea8a22eb46 100644
--- a/doc/guides/cryptodevs/features/cn10k.ini
+++ b/doc/guides/cryptodevs/features/cn10k.ini
@@ -102,6 +102,7 @@ DSA                     =
 Modular Exponentiation  = Y
 Modular Inversion       =
 Diffie-hellman          =
+ECDH                    = Y
 ECDSA                   = Y
 ECPM                    = Y
 SM2                     = Y
diff --git a/doc/guides/cryptodevs/features/cn9k.ini b/doc/guides/cryptodevs/features/cn9k.ini
index bf0e1a98b2..d70771d9bd 100644
--- a/doc/guides/cryptodevs/features/cn9k.ini
+++ b/doc/guides/cryptodevs/features/cn9k.ini
@@ -96,6 +96,7 @@ DSA                     =
 Modular Exponentiation  = Y
 Modular Inversion       =
 Diffie-hellman          =
+ECDH                    = Y
 ECDSA                   = Y
 ECPM                    = Y
 
diff --git a/drivers/common/cnxk/roc_ae.h b/drivers/common/cnxk/roc_ae.h
index eaf12ab254..a9a08d9fb9 100644
--- a/drivers/common/cnxk/roc_ae.h
+++ b/drivers/common/cnxk/roc_ae.h
@@ -8,9 +8,11 @@
 #include "roc_platform.h"
 
 /* AE opcodes */
+#define ROC_AE_MAJOR_OP_RANDOM	     0x32
 #define ROC_AE_MAJOR_OP_MODEX	     0x03
 #define ROC_AE_MAJOR_OP_EC	     0x04
 #define ROC_AE_MAJOR_OP_ECC	     0x05
+#define ROC_AE_MINOR_OP_RANDOM	     0x00
 #define ROC_AE_MINOR_OP_MODEX	     0x01
 #define ROC_AE_MINOR_OP_PKCS_ENC     0x02
 #define ROC_AE_MINOR_OP_PKCS_ENC_CRT 0x03
@@ -46,6 +48,11 @@ typedef enum {
 #define ROC_AE_EC_PARAM1_NIST      (0 << 6)
 #define ROC_AE_EC_PARAM1_NONNIST   (1 << 6)
 
+typedef enum {
+	ROC_AE_ERR_ECC_PAI = 0x0b,
+	ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE = 0x11
+} roc_ae_error_code;
+
 /* Prime and order fields of built-in elliptic curves */
 struct roc_ae_ec_group {
 	struct {
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 5f181e8839..997110e3d3 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -860,6 +860,18 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp,
 		}
 
 		return;
+	} else if (cop->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC &&
+			   cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION &&
+			   cop->asym->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) {
+		if (likely(compcode == CPT_COMP_GOOD)) {
+			if (uc_compcode == ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE) {
+				cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
+				return;
+			} else if (uc_compcode == ROC_AE_ERR_ECC_PAI) {
+				cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+				return;
+			}
+		}
 	}
 
 	if (likely(compcode == CPT_COMP_GOOD)) {
diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h
index f05ae4f4a1..ea11e093bf 100644
--- a/drivers/crypto/cnxk/cnxk_ae.h
+++ b/drivers/crypto/cnxk/cnxk_ae.h
@@ -236,6 +236,7 @@ cnxk_ae_fill_session_parameters(struct cnxk_ae_sess *sess,
 		break;
 	case RTE_CRYPTO_ASYM_XFORM_ECDSA:
 		/* Fall through */
+	case RTE_CRYPTO_ASYM_XFORM_ECDH:
 	case RTE_CRYPTO_ASYM_XFORM_ECPM:
 	case RTE_CRYPTO_ASYM_XFORM_ECFPM:
 	case RTE_CRYPTO_ASYM_XFORM_SM2:
@@ -920,7 +921,7 @@ cnxk_ae_enqueue_sm2_op(struct rte_crypto_op *op,
 }
 
 static __rte_always_inline int
-cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
+cnxk_ae_ecfpm_prep(rte_crypto_param *scalar,
 		   struct roc_ae_buf_ptr *meta_buf, uint64_t *fpm_iova,
 		   struct roc_ae_ec_group *ec_grp, uint8_t curveid,
 		   struct cpt_inst_s *inst)
@@ -939,7 +940,7 @@ cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	inst->dptr = (uintptr_t)dptr;
 
 	p_align = RTE_ALIGN_CEIL(prime_len, 8);
-	scalar_align = RTE_ALIGN_CEIL(ecpm->scalar.length, 8);
+	scalar_align = RTE_ALIGN_CEIL(scalar->length, 8);
 
 	/*
 	 * Set dlen = sum(ROUNDUP8(input point(x and y coordinates), prime,
@@ -954,7 +955,7 @@ cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	dptr += sizeof(fpm_table_iova);
 
 	/* Copy scalar, prime */
-	memcpy(dptr, ecpm->scalar.data, ecpm->scalar.length);
+	memcpy(dptr, scalar->data, scalar->length);
 	dptr += scalar_align;
 	memcpy(dptr, ec_grp->prime.data, ec_grp->prime.length);
 	dptr += p_align;
@@ -968,7 +969,7 @@ cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	w4.s.opcode_minor = ROC_AE_MINOR_OP_ECC_FPM;
 
 	w4.s.param1 = curveid | (1 << 8);
-	w4.s.param2 = ecpm->scalar.length;
+	w4.s.param2 = scalar->length;
 	w4.s.dlen = dlen;
 
 	inst->w4.u64 = w4.u64;
@@ -978,13 +979,13 @@ cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 }
 
 static __rte_always_inline int
-cnxk_ae_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
+cnxk_ae_ecpm_prep(rte_crypto_param *scalar, struct rte_crypto_ec_point *p,
 		  struct roc_ae_buf_ptr *meta_buf,
 		  struct roc_ae_ec_group *ec_grp, uint8_t curveid,
 		  struct cpt_inst_s *inst)
 {
-	uint16_t x1_len = ecpm->p.x.length;
-	uint16_t y1_len = ecpm->p.y.length;
+	uint16_t x1_len = p->x.length;
+	uint16_t y1_len = p->y.length;
 	uint16_t scalar_align, p_align;
 	uint16_t x1_offset, y1_offset;
 	uint16_t dlen, prime_len;
@@ -998,7 +999,7 @@ cnxk_ae_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	inst->dptr = (uintptr_t)dptr;
 
 	p_align = RTE_ALIGN_CEIL(prime_len, 8);
-	scalar_align = RTE_ALIGN_CEIL(ecpm->scalar.length, 8);
+	scalar_align = RTE_ALIGN_CEIL(scalar->length, 8);
 
 	/*
 	 * Set dlen = sum(ROUNDUP8(input point(x and y coordinates), prime,
@@ -1013,11 +1014,11 @@ cnxk_ae_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	memset(dptr, 0, dlen);
 
 	/* Copy input point, scalar, prime */
-	memcpy(dptr + x1_offset, ecpm->p.x.data, x1_len);
+	memcpy(dptr + x1_offset, p->x.data, x1_len);
 	dptr += p_align;
-	memcpy(dptr + y1_offset, ecpm->p.y.data, y1_len);
+	memcpy(dptr + y1_offset, p->y.data, y1_len);
 	dptr += p_align;
-	memcpy(dptr, ecpm->scalar.data, ecpm->scalar.length);
+	memcpy(dptr, scalar->data, scalar->length);
 	dptr += scalar_align;
 	memcpy(dptr, ec_grp->prime.data, ec_grp->prime.length);
 	dptr += p_align;
@@ -1031,7 +1032,7 @@ cnxk_ae_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	w4.s.opcode_minor = ROC_AE_MINOR_OP_ECC_UMP;
 
 	w4.s.param1 = curveid;
-	w4.s.param2 = ecpm->scalar.length;
+	w4.s.param2 = scalar->length;
 	w4.s.dlen = dlen;
 
 	inst->w4.u64 = w4.u64;
@@ -1040,6 +1041,78 @@ cnxk_ae_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	return 0;
 }
 
+static __rte_always_inline int
+cnxk_ae_random_prep(uint16_t len, struct roc_ae_buf_ptr *meta_buf,
+		   struct cpt_inst_s *inst)
+{
+	union cpt_inst_w4 w4;
+	uint8_t *dptr;
+
+	/* Input buffer */
+	dptr = meta_buf->vaddr;
+	inst->dptr = (uintptr_t)dptr;
+
+	/* Setup opcodes */
+	w4.s.opcode_major = ROC_AE_MAJOR_OP_RANDOM;
+	w4.s.opcode_minor = ROC_AE_MINOR_OP_RANDOM;
+
+	w4.s.param1 = len;
+	w4.s.param2 = 0;
+	w4.s.dlen = 0;
+
+	inst->w4.u64 = w4.u64;
+	inst->rptr = (uintptr_t)dptr;
+
+	return 0;
+}
+
+static __rte_always_inline int __rte_hot
+cnxk_ae_enqueue_ecdh_op(struct rte_crypto_op *op,
+			 struct roc_ae_buf_ptr *meta_buf,
+			 struct cnxk_ae_sess *sess, uint64_t *fpm_iova,
+			 struct roc_ae_ec_group **ec_grp,
+			 struct cpt_inst_s *inst)
+{
+	struct rte_crypto_ecdh_op_param *ecdh = &op->asym->ecdh;
+	uint8_t curveid = sess->ec_ctx.curveid;
+	struct rte_crypto_ec_point point;
+	rte_crypto_uint scalar;
+	int ret = 0;
+
+	switch (ecdh->ke_type) {
+	case RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE:
+		cnxk_ae_random_prep(ecdh->priv_key.length, meta_buf, inst);
+		break;
+	case RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE:
+		scalar.data = sess->ec_ctx.pkey.data;
+		scalar.length = sess->ec_ctx.pkey.length;
+		cnxk_ae_ecfpm_prep(&scalar, meta_buf, fpm_iova, ec_grp[curveid],
+			curveid, inst);
+		break;
+	case RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY:
+		scalar.data = ec_grp[curveid]->order.data;
+		scalar.length = ec_grp[curveid]->order.length;
+		cnxk_ae_ecpm_prep(&scalar, &ecdh->pub_key, meta_buf,
+			ec_grp[curveid], curveid, inst);
+		break;
+	case RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE:
+		scalar.data = sess->ec_ctx.pkey.data;
+		scalar.length = sess->ec_ctx.pkey.length;
+		point.x.data = sess->ec_ctx.q.x.data;
+		point.x.length = sess->ec_ctx.q.x.length;
+		point.y.data = sess->ec_ctx.q.y.data;
+		point.y.length = sess->ec_ctx.q.y.length;
+		cnxk_ae_ecpm_prep(&scalar, &point, meta_buf,
+			ec_grp[curveid], curveid, inst);
+		break;
+	default:
+		op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+		ret = -EINVAL;
+	}
+
+	return ret;
+}
+
 static __rte_always_inline void
 cnxk_ae_dequeue_rsa_op(struct rte_crypto_op *cop, uint8_t *rptr,
 		       struct rte_crypto_rsa_xform *rsa_ctx)
@@ -1143,6 +1216,37 @@ cnxk_ae_dequeue_ecpm_op(struct rte_crypto_ecpm_op_param *ecpm, uint8_t *rptr,
 	ecpm->r.y.length = prime_len;
 }
 
+static __rte_always_inline void
+cnxk_ae_dequeue_ecdh_op(struct rte_crypto_ecdh_op_param *ecdh, uint8_t *rptr,
+			struct roc_ae_ec_ctx *ec,
+			struct roc_ae_ec_group **ec_grp)
+{
+	int prime_len = ec_grp[ec->curveid]->prime.length;
+
+	switch (ecdh->ke_type) {
+	case RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE:
+		memcpy(ecdh->priv_key.data, rptr, prime_len);
+		ecdh->priv_key.length = prime_len;
+		break;
+	case RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE:
+		memcpy(ecdh->pub_key.x.data, rptr, prime_len);
+		memcpy(ecdh->pub_key.y.data, rptr + RTE_ALIGN_CEIL(prime_len, 8), prime_len);
+		ecdh->pub_key.x.length = prime_len;
+		ecdh->pub_key.y.length = prime_len;
+		break;
+	case RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY:
+		break;
+	case RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE:
+		memcpy(ecdh->shared_secret.x.data, rptr, prime_len);
+		memcpy(ecdh->shared_secret.y.data, rptr + RTE_ALIGN_CEIL(prime_len, 8), prime_len);
+		ecdh->shared_secret.x.length = prime_len;
+		ecdh->shared_secret.y.length = prime_len;
+		break;
+	default:
+		break;
+	}
+}
+
 static __rte_always_inline void *
 cnxk_ae_alloc_meta(struct roc_ae_buf_ptr *buf,
 		   struct rte_mempool *cpt_meta_pool,
@@ -1206,20 +1310,27 @@ cnxk_ae_enqueue(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
 			goto req_fail;
 		break;
 	case RTE_CRYPTO_ASYM_XFORM_ECPM:
-		ret = cnxk_ae_ecpm_prep(&asym_op->ecpm, &meta_buf,
+		ret = cnxk_ae_ecpm_prep(&asym_op->ecpm.scalar, &asym_op->ecpm.p, &meta_buf,
 					sess->ec_grp[sess->ec_ctx.curveid],
 					sess->ec_ctx.curveid, inst);
 		if (unlikely(ret))
 			goto req_fail;
 		break;
 	case RTE_CRYPTO_ASYM_XFORM_ECFPM:
-		ret = cnxk_ae_ecfpm_prep(&asym_op->ecpm, &meta_buf,
+		ret = cnxk_ae_ecfpm_prep(&asym_op->ecpm.scalar, &meta_buf,
 					 sess->cnxk_fpm_iova,
 					 sess->ec_grp[sess->ec_ctx.curveid],
 					 sess->ec_ctx.curveid, inst);
 		if (unlikely(ret))
 			goto req_fail;
 		break;
+	case RTE_CRYPTO_ASYM_XFORM_ECDH:
+		ret = cnxk_ae_enqueue_ecdh_op(op, &meta_buf, sess,
+					       sess->cnxk_fpm_iova,
+					       sess->ec_grp, inst);
+		if (unlikely(ret))
+			goto req_fail;
+		break;
 	default:
 		op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
 		ret = -EINVAL;
@@ -1262,6 +1373,10 @@ cnxk_ae_post_process(struct rte_crypto_op *cop, struct cnxk_ae_sess *sess,
 		cnxk_ae_dequeue_ecpm_op(&op->ecpm, rptr, &sess->ec_ctx,
 					sess->ec_grp);
 		break;
+	case RTE_CRYPTO_ASYM_XFORM_ECDH:
+		cnxk_ae_dequeue_ecdh_op(&op->ecdh, rptr, &sess->ec_ctx,
+					sess->ec_grp);
+		break;
 	default:
 		cop->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
 		break;
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h
index 9a321aa8c9..d0ad881f2f 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev.h
@@ -10,7 +10,7 @@
 
 #include "roc_cpt.h"
 
-#define CNXK_CPT_MAX_CAPS	 54
+#define CNXK_CPT_MAX_CAPS	 55
 #define CNXK_SEC_CRYPTO_MAX_CAPS 16
 #define CNXK_SEC_MAX_CAPS	 9
 #define CNXK_AE_EC_ID_MAX	 9
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
index b4864f66bf..2676b52832 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
@@ -92,6 +92,20 @@ static const struct rte_cryptodev_capabilities caps_mul[] = {
 			},
 		}
 	},
+	{	/* ECDH */
+		.op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
+		{.asym = {
+			.xform_capa = {
+				.xform_type = RTE_CRYPTO_ASYM_XFORM_ECDH,
+				.op_types = ((1 << RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE) |
+						(1 << RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE) |
+						(1 << RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) |
+						(1 << RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE)
+						),
+				}
+			},
+		}
+	},
 };
 
 static const struct rte_cryptodev_capabilities caps_sha1_sha2[] = {
-- 
2.25.1


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

* RE: [PATCH v1 1/4] test/cryptodev: add ECDH tests
  2023-10-26  8:15 ` [PATCH v1 1/4] " Gowrishankar Muthukrishnan
@ 2023-10-30 18:48   ` Akhil Goyal
  2023-11-08 13:17   ` [PATCH v2] " Gowrishankar Muthukrishnan
  1 sibling, 0 replies; 9+ messages in thread
From: Akhil Goyal @ 2023-10-30 18:48 UTC (permalink / raw)
  To: Gowrishankar Muthukrishnan, dev
  Cc: Anoob Joseph, Fan Zhang, Gowrishankar Muthukrishnan

> Subject: [PATCH v1 1/4] test/cryptodev: add ECDH tests
> 
> Add ECDH tests.
> 
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> ---
Please rebase this patch.

Applied the PMD patches of this series on dpdk-next-crypto.
Send the test app patch again after rebasing on next-crypto.

Thanks.



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

* RE: [PATCH v1 4/4] crypto/cnxk: add ECDH support
  2023-10-26  8:15 ` [PATCH v1 4/4] crypto/cnxk: add ECDH support Gowrishankar Muthukrishnan
@ 2023-10-30 18:49   ` Akhil Goyal
  0 siblings, 0 replies; 9+ messages in thread
From: Akhil Goyal @ 2023-10-30 18:49 UTC (permalink / raw)
  To: Gowrishankar Muthukrishnan, dev
  Cc: Anoob Joseph, Fan Zhang, Gowrishankar Muthukrishnan


> Subject: [PATCH v1 4/4] crypto/cnxk: add ECDH support
> 
> Add ECDH support in CNXK PMD.
> 
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Added release notes while applying.


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

* [PATCH v2] test/cryptodev: add ECDH tests
  2023-10-26  8:15 ` [PATCH v1 1/4] " Gowrishankar Muthukrishnan
  2023-10-30 18:48   ` Akhil Goyal
@ 2023-11-08 13:17   ` Gowrishankar Muthukrishnan
  2023-11-09 20:24     ` Akhil Goyal
  1 sibling, 1 reply; 9+ messages in thread
From: Gowrishankar Muthukrishnan @ 2023-11-08 13:17 UTC (permalink / raw)
  To: dev; +Cc: anoobj, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan

Add ECDH tests.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Change-Id: I88099e2ba8e058fbb519a06d09ebb3ece7c7e27f
---
v2:
 - rebased due to patch conflict.
---
 app/test/test_cryptodev_asym.c              | 741 ++++++++++++++++++++
 app/test/test_cryptodev_asym_util.h         |  12 +
 app/test/test_cryptodev_ecdh_test_vectors.h | 556 +++++++++++++++
 3 files changed, 1309 insertions(+)
 create mode 100644 app/test/test_cryptodev_ecdh_test_vectors.h

diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index c4f985dba0..17daf734e8 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -17,6 +17,7 @@
 #include "test_cryptodev.h"
 #include "test_cryptodev_dh_test_vectors.h"
 #include "test_cryptodev_dsa_test_vectors.h"
+#include "test_cryptodev_ecdh_test_vectors.h"
 #include "test_cryptodev_ecdsa_test_vectors.h"
 #include "test_cryptodev_ecpm_test_vectors.h"
 #include "test_cryptodev_mod_test_vectors.h"
@@ -1811,6 +1812,744 @@ test_ecpm_all_curve(void)
 	return overall_status;
 }
 
+static int
+test_ecdh_priv_key_generate(enum curve curve_id)
+{
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	const struct rte_cryptodev_asymmetric_xform_capability *capa;
+	struct rte_mempool *sess_mpool = ts_params->session_mpool;
+	struct rte_mempool *op_mpool = ts_params->op_mpool;
+	struct rte_cryptodev_asym_capability_idx idx;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_crypto_asym_xform xform = {0};
+	struct rte_crypto_op *result_op = NULL;
+	uint8_t output_buf[TEST_DATA_SIZE];
+	struct rte_crypto_asym_op *asym_op;
+	struct rte_crypto_op *op = NULL;
+	int ret, status = TEST_SUCCESS;
+	uint16_t output_buflen = 0;
+	void *sess = NULL;
+	int curve;
+
+	/* Check ECDH capability */
+	idx.type = RTE_CRYPTO_ASYM_XFORM_ECDH;
+	capa = rte_cryptodev_asym_capability_get(dev_id, &idx);
+	if (capa == NULL)
+		return -ENOTSUP;
+
+	if (!(capa->op_types & (1 <<  RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE)))
+		return -ENOTSUP;
+
+	switch (curve_id) {
+	case SECP192R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP192R1;
+		output_buflen = 24;
+		break;
+	case SECP224R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP224R1;
+		output_buflen = 28;
+		break;
+	case SECP256R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP256R1;
+		output_buflen = 32;
+		break;
+	case SECP384R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP384R1;
+		output_buflen = 48;
+		break;
+	case SECP521R1:
+		curve = RTE_CRYPTO_EC_GROUP_SECP521R1;
+		output_buflen = 66;
+		break;
+	default:
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Unsupported curve id\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_ECDH;
+	xform.ec.curve_id = curve;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE;
+
+	/* Init out buf */
+	asym_op->ecdh.priv_key.data = output_buf;
+	asym_op->ecdh.priv_key.length = output_buflen;
+
+	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, "priv_key:",
+		asym_op->ecdh.priv_key.data, asym_op->ecdh.priv_key.length);
+
+exit:
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+	return status;
+}
+
+static int
+test_ecdh_pub_key_generate(enum curve curve_id)
+{
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	const struct rte_cryptodev_asymmetric_xform_capability *capa;
+	struct rte_mempool *sess_mpool = ts_params->session_mpool;
+	struct rte_mempool *op_mpool = ts_params->op_mpool;
+	struct crypto_testsuite_ecdh_params input_params;
+	struct rte_cryptodev_asym_capability_idx idx;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_crypto_asym_xform xform = {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_op *asym_op;
+	struct rte_crypto_op *op = NULL;
+	int ret, status = TEST_SUCCESS;
+	void *sess = NULL;
+
+	/* Check ECDH capability */
+	idx.type = RTE_CRYPTO_ASYM_XFORM_ECDH;
+	capa = rte_cryptodev_asym_capability_get(dev_id, &idx);
+	if (capa == NULL)
+		return -ENOTSUP;
+
+	if (!(capa->op_types & (1 <<  RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE)))
+		return -ENOTSUP;
+
+	switch (curve_id) {
+	case SECP192R1:
+		input_params = ecdh_param_secp192r1;
+		break;
+	case SECP224R1:
+		input_params = ecdh_param_secp224r1;
+		break;
+	case SECP256R1:
+		input_params = ecdh_param_secp256r1;
+		break;
+	case SECP384R1:
+		input_params = ecdh_param_secp384r1;
+		break;
+	case SECP521R1:
+		input_params = ecdh_param_secp521r1;
+		break;
+	default:
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Unsupported curve id\n");
+		status = TEST_FAILED;
+		goto exit;
+	}
+
+	debug_hexdump(stdout, "pkey:",
+		input_params.pkey_A.data, input_params.pkey_A.length);
+
+	/* 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_ECDH;
+	xform.ec.curve_id = input_params.curve;
+	xform.ec.pkey.data = input_params.pkey_A.data;
+	xform.ec.pkey.length = input_params.pkey_A.length;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE;
+
+	/* Init out buf */
+	asym_op->ecdh.pub_key.x.data = output_buf_x;
+	asym_op->ecdh.pub_key.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, "qx:",
+		asym_op->ecdh.pub_key.x.data, asym_op->ecdh.pub_key.x.length);
+	debug_hexdump(stdout, "qy:",
+		asym_op->ecdh.pub_key.y.data, asym_op->ecdh.pub_key.y.length);
+
+	ret = verify_ecdh_secret(input_params.pubkey_qA_x.data,
+				input_params.pubkey_qA_y.data, result_op);
+	if (ret) {
+		status = TEST_FAILED;
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"ECDH public key generation failed.\n");
+		goto exit;
+	}
+
+exit:
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+	return status;
+}
+
+static int
+test_ecdh_pub_key_verify(enum curve curve_id)
+{
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	const struct rte_cryptodev_asymmetric_xform_capability *capa;
+	struct rte_mempool *sess_mpool = ts_params->session_mpool;
+	struct rte_mempool *op_mpool = ts_params->op_mpool;
+	struct crypto_testsuite_ecdh_params input_params;
+	struct rte_cryptodev_asym_capability_idx idx;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_crypto_asym_xform xform = {0};
+	struct rte_crypto_op *result_op = NULL;
+	struct rte_crypto_asym_op *asym_op;
+	struct rte_crypto_op *op = NULL;
+	int ret, status = TEST_SUCCESS;
+	void *sess = NULL;
+
+	/* Check ECDH capability */
+	idx.type = RTE_CRYPTO_ASYM_XFORM_ECDH;
+	capa = rte_cryptodev_asym_capability_get(dev_id, &idx);
+	if (capa == NULL)
+		return -ENOTSUP;
+
+	if (!(capa->op_types & (1 <<  RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY)))
+		return -ENOTSUP;
+
+	switch (curve_id) {
+	case SECP192R1:
+		input_params = ecdh_param_secp192r1;
+		break;
+	case SECP224R1:
+		input_params = ecdh_param_secp224r1;
+		break;
+	case SECP256R1:
+		input_params = ecdh_param_secp256r1;
+		break;
+	case SECP384R1:
+		input_params = ecdh_param_secp384r1;
+		break;
+	case SECP521R1:
+		input_params = ecdh_param_secp521r1;
+		break;
+	default:
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Unsupported curve id\n");
+		status = TEST_FAILED;
+		goto exit;
+	}
+
+	debug_hexdump(stdout, "qx:",
+		input_params.pubkey_qA_x.data, input_params.pubkey_qA_x.length);
+	debug_hexdump(stdout, "qy:",
+		input_params.pubkey_qA_y.data, input_params.pubkey_qA_y.length);
+
+	/* 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_ECDH;
+	xform.ec.curve_id = input_params.curve;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY;
+	asym_op->ecdh.pub_key.x.data = input_params.pubkey_qA_x.data;
+	asym_op->ecdh.pub_key.x.length = input_params.pubkey_qA_x.length;
+	asym_op->ecdh.pub_key.y.data = input_params.pubkey_qA_y.data;
+	asym_op->ecdh.pub_key.y.length = input_params.pubkey_qA_y.length;
+
+	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;
+	}
+
+exit:
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+	return status;
+}
+
+static int
+test_ecdh_shared_secret(enum curve curve_id)
+{
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
+	const struct rte_cryptodev_asymmetric_xform_capability *capa;
+	struct rte_mempool *sess_mpool = ts_params->session_mpool;
+	struct rte_mempool *op_mpool = ts_params->op_mpool;
+	struct crypto_testsuite_ecdh_params input_params;
+	struct rte_cryptodev_asym_capability_idx idx;
+	uint8_t dev_id = ts_params->valid_devs[0];
+	struct rte_crypto_asym_xform xform = {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_op *asym_op;
+	struct rte_crypto_op *op = NULL;
+	int ret, status = TEST_SUCCESS;
+	void *sess = NULL;
+
+	/* Check ECDH capability */
+	idx.type = RTE_CRYPTO_ASYM_XFORM_ECDH;
+	capa = rte_cryptodev_asym_capability_get(dev_id, &idx);
+	if (capa == NULL)
+		return -ENOTSUP;
+
+	if (!(capa->op_types & (1 <<  RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE)))
+		return -ENOTSUP;
+
+	switch (curve_id) {
+	case SECP192R1:
+		input_params = ecdh_param_secp192r1;
+		break;
+	case SECP224R1:
+		input_params = ecdh_param_secp224r1;
+		break;
+	case SECP256R1:
+		input_params = ecdh_param_secp256r1;
+		break;
+	case SECP384R1:
+		input_params = ecdh_param_secp384r1;
+		break;
+	case SECP521R1:
+		input_params = ecdh_param_secp521r1;
+		break;
+	default:
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Unsupported curve id\n");
+		status = TEST_FAILED;
+		goto exit;
+	}
+
+	/* zA = dA.QB */
+	debug_hexdump(stdout, "pkey:",
+		input_params.pkey_A.data, input_params.pkey_A.length);
+	debug_hexdump(stdout, "qx:",
+		input_params.pubkey_qB_x.data, input_params.pubkey_qB_x.length);
+	debug_hexdump(stdout, "qy:",
+		input_params.pubkey_qB_y.data, input_params.pubkey_qB_y.length);
+
+	/* 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_ECDH;
+	xform.ec.curve_id = input_params.curve;
+	xform.ec.pkey.data = input_params.pkey_A.data;
+	xform.ec.pkey.length = input_params.pkey_A.length;
+	xform.ec.q.x.data = input_params.pubkey_qB_x.data;
+	xform.ec.q.x.length = input_params.pubkey_qB_x.length;
+	xform.ec.q.y.data = input_params.pubkey_qB_y.data;
+	xform.ec.q.y.length = input_params.pubkey_qB_y.length;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE;
+
+	/* Init out buf */
+	asym_op->ecdh.shared_secret.x.data = output_buf_x;
+	asym_op->ecdh.shared_secret.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, "secret_x:",
+		asym_op->ecdh.shared_secret.x.data, asym_op->ecdh.shared_secret.x.length);
+	debug_hexdump(stdout, "secret_y:",
+		asym_op->ecdh.shared_secret.y.data, asym_op->ecdh.shared_secret.y.length);
+
+	ret = verify_ecdh_secret(input_params.secret_x.data,
+				input_params.secret_y.data, result_op);
+	if (ret) {
+		status = TEST_FAILED;
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"ECDH shared secret compute failed.\n");
+		goto exit;
+	}
+
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+
+	/* zB = dB.QA */
+	debug_hexdump(stdout, "pkey:",
+		input_params.pkey_B.data, input_params.pkey_B.length);
+	debug_hexdump(stdout, "qx:",
+		input_params.pubkey_qA_x.data, input_params.pubkey_qA_x.length);
+	debug_hexdump(stdout, "qy:",
+		input_params.pubkey_qA_y.data, input_params.pubkey_qA_y.length);
+
+	/* 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_ECDH;
+	xform.ec.curve_id = input_params.curve;
+	xform.ec.pkey.data = input_params.pkey_B.data;
+	xform.ec.pkey.length = input_params.pkey_B.length;
+	xform.ec.q.x.data = input_params.pubkey_qA_x.data;
+	xform.ec.q.x.length = input_params.pubkey_qA_x.length;
+	xform.ec.q.y.data = input_params.pubkey_qA_y.data;
+	xform.ec.q.y.length = input_params.pubkey_qA_y.length;
+
+	ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+	if (ret < 0) {
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"Session creation failed\n");
+		status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+		goto exit;
+	}
+
+	/* Attach asymmetric crypto session to crypto operations */
+	rte_crypto_op_attach_asym_session(op, sess);
+
+	/* Populate op with operational details */
+	asym_op->ecdh.ke_type = RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE;
+
+	/* Init out buf */
+	asym_op->ecdh.shared_secret.x.data = output_buf_x;
+	asym_op->ecdh.shared_secret.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, "secret_x:",
+			asym_op->ecdh.shared_secret.x.data, asym_op->ecdh.shared_secret.x.length);
+	debug_hexdump(stdout, "secret_y:",
+			asym_op->ecdh.shared_secret.y.data, asym_op->ecdh.shared_secret.y.length);
+
+	ret = verify_ecdh_secret(input_params.secret_x.data,
+				input_params.secret_y.data, result_op);
+	if (ret) {
+		status = TEST_FAILED;
+		RTE_LOG(ERR, USER1,
+				"line %u FAILED: %s", __LINE__,
+				"ECDH shared secret compute failed.\n");
+		goto exit;
+	}
+
+exit:
+	if (sess != NULL)
+		rte_cryptodev_asym_session_free(dev_id, sess);
+	rte_crypto_op_free(op);
+	return status;
+}
+
+static int
+test_ecdh_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++) {
+		if (curve_id == SECP521R1_UA)
+			continue;
+
+		status = test_ecdh_priv_key_generate(curve_id);
+		if (status == TEST_SUCCESS) {
+			msg = "succeeded";
+		} else {
+			msg = "failed";
+			overall_status = status;
+		}
+		printf("  %u) TestCase ECDH private key generation for Curve %s %s\n",
+		       test_index ++, curve[curve_id], msg);
+	}
+
+	for (curve_id = SECP192R1; curve_id < END_OF_CURVE_LIST; curve_id++) {
+		if (curve_id == SECP521R1_UA)
+			continue;
+
+		status = test_ecdh_pub_key_generate(curve_id);
+		if (status == TEST_SUCCESS) {
+			msg = "succeeded";
+		} else {
+			msg = "failed";
+			overall_status = status;
+		}
+		printf("  %u) TestCase ECDH public key generation for Curve %s %s\n",
+		       test_index ++, curve[curve_id], msg);
+	}
+
+	for (curve_id = SECP192R1; curve_id < END_OF_CURVE_LIST; curve_id++) {
+		if (curve_id == SECP521R1_UA)
+			continue;
+
+		status = test_ecdh_pub_key_verify(curve_id);
+		if (status == TEST_SUCCESS) {
+			msg = "succeeded";
+		} else {
+			msg = "failed";
+			overall_status = status;
+		}
+		printf("  %u) TestCase ECDH public key verification for Curve %s %s\n",
+		       test_index ++, curve[curve_id], msg);
+	}
+
+	for (curve_id = SECP192R1; curve_id < END_OF_CURVE_LIST; curve_id++) {
+		if (curve_id == SECP521R1_UA)
+			continue;
+
+		status = test_ecdh_shared_secret(curve_id);
+		if (status == TEST_SUCCESS) {
+			msg = "succeeded";
+		} else {
+			msg = "failed";
+			overall_status = status;
+		}
+		printf("  %u) TestCase ECDH shared secret compute for Curve %s %s\n",
+		       test_index ++, curve[curve_id], msg);
+	}
+
+	return overall_status;
+}
+
 static int
 test_sm2_sign(void)
 {
@@ -2853,6 +3592,8 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite  = {
 			     test_ecdsa_sign_verify_all_curve),
 		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_sm2_sign),
 		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_sm2_verify),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+				test_ecdh_all_curve),
 		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
 				test_ecpm_all_curve),
 		TEST_CASES_END() /**< NULL terminate unit test array */
diff --git a/app/test/test_cryptodev_asym_util.h b/app/test/test_cryptodev_asym_util.h
index 83dc265dd7..07e6e831e8 100644
--- a/app/test/test_cryptodev_asym_util.h
+++ b/app/test/test_cryptodev_asym_util.h
@@ -57,4 +57,16 @@ static inline int verify_ecpm(uint8_t *result_x, uint8_t *result_y,
 
 	return 0;
 }
+
+static inline int verify_ecdh_secret(uint8_t *result_x, uint8_t *result_y,
+			      struct rte_crypto_op *result_op)
+{
+	if (memcmp(result_x, result_op->asym->ecdh.shared_secret.x.data,
+		   result_op->asym->ecdh.shared_secret.x.length) ||
+		   memcmp(result_y, result_op->asym->ecdh.shared_secret.y.data,
+		   result_op->asym->ecdh.shared_secret.y.length))
+		return -1;
+
+	return 0;
+}
 #endif /* TEST_CRYPTODEV_ASYM_TEST_UTIL_H__ */
diff --git a/app/test/test_cryptodev_ecdh_test_vectors.h b/app/test/test_cryptodev_ecdh_test_vectors.h
new file mode 100644
index 0000000000..b577c179c8
--- /dev/null
+++ b/app/test/test_cryptodev_ecdh_test_vectors.h
@@ -0,0 +1,556 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2023 Marvell International Ltd.
+ */
+
+#ifndef __TEST_CRYPTODEV_ECDH_TEST_VECTORS_H__
+#define __TEST_CRYPTODEV_ECDH_TEST_VECTORS_H__
+
+#include "rte_crypto_asym.h"
+
+struct crypto_testsuite_ecdh_params {
+	rte_crypto_param pubkey_qA_x;
+	rte_crypto_param pubkey_qA_y;
+	rte_crypto_param pkey_A;
+	rte_crypto_param pubkey_qB_x;
+	rte_crypto_param pubkey_qB_y;
+	rte_crypto_param pkey_B;
+	rte_crypto_param secret_x;
+	rte_crypto_param secret_y;
+	int curve;
+};
+
+/*
+ * Test vector reference:
+ * https://datatracker.ietf.org/doc/html/rfc5114.html
+ * Appendix A.
+ */
+
+/** SECP192R1 (P-192 NIST) test vector */
+
+static uint8_t dA_secp192r1[] = {
+	0x32, 0x3F, 0xA3, 0x16, 0x9D, 0x8E, 0x9C, 0x65,
+	0x93, 0xF5, 0x94, 0x76, 0xBC, 0x14, 0x20, 0x00,
+	0xAB, 0x5B, 0xE0, 0xE2, 0x49, 0xC4, 0x34, 0x26
+};
+
+static uint8_t x_qA_secp192r1[] = {
+	0xCD, 0x46, 0x48, 0x9E, 0xCF, 0xD6, 0xC1, 0x05,
+	0xE7, 0xB3, 0xD3, 0x25, 0x66, 0xE2, 0xB1, 0x22,
+	0xE2, 0x49, 0xAB, 0xAA, 0xDD, 0x87, 0x06, 0x12
+};
+
+static uint8_t y_qA_secp192r1[] = {
+	0x68, 0x88, 0x7B, 0x48, 0x77, 0xDF, 0x51, 0xDD,
+	0x4D, 0xC3, 0xD6, 0xFD, 0x11, 0xF0, 0xA2, 0x6F,
+	0x8F, 0xD3, 0x84, 0x43, 0x17, 0x91, 0x6E, 0x9A
+};
+
+static uint8_t dB_secp192r1[] = {
+	0x63, 0x1F, 0x95, 0xBB, 0x4A, 0x67, 0x63, 0x2C,
+	0x9C, 0x47, 0x6E, 0xEE, 0x9A, 0xB6, 0x95, 0xAB,
+	0x24, 0x0A, 0x04, 0x99, 0x30, 0x7F, 0xCF, 0x62
+};
+
+static uint8_t x_qB_secp192r1[] = {
+	0x51, 0x9A, 0x12, 0x16, 0x80, 0xE0, 0x04, 0x54,
+	0x66, 0xBA, 0x21, 0xDF, 0x2E, 0xEE, 0x47, 0xF5,
+	0x97, 0x3B, 0x50, 0x05, 0x77, 0xEF, 0x13, 0xD5
+};
+
+static uint8_t y_qB_secp192r1[] = {
+	0xFF, 0x61, 0x3A, 0xB4, 0xD6, 0x4C, 0xEE, 0x3A,
+	0x20, 0x87, 0x5B, 0xDB, 0x10, 0xF9, 0x53, 0xF6,
+	0xB3, 0x0C, 0xA0, 0x72, 0xC6, 0x0A, 0xA5, 0x7F
+};
+
+static uint8_t x_Z_secp192r1[] = {
+	0xAD, 0x42, 0x01, 0x82, 0x63, 0x3F, 0x85, 0x26,
+	0xBF, 0xE9, 0x54, 0xAC, 0xDA, 0x37, 0x6F, 0x05,
+	0xE5, 0xFF, 0x4F, 0x83, 0x7F, 0x54, 0xFE, 0xBE
+};
+
+static uint8_t y_Z_secp192r1[] = {
+	0x43, 0x71, 0x54, 0x5E, 0xD7, 0x72, 0xA5, 0x97,
+	0x41, 0xD0, 0xED, 0xA3, 0x2C, 0x67, 0x11, 0x12,
+	0xB7, 0xFD, 0xDD, 0x51, 0x46, 0x1F, 0xCF, 0x32
+};
+
+/** ECDH SECP192R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp192r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp192r1,
+		.length = sizeof(x_qA_secp192r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp192r1,
+		.length = sizeof(y_qA_secp192r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp192r1,
+		.length = sizeof(x_qB_secp192r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp192r1,
+		.length = sizeof(y_qB_secp192r1),
+	},
+	.pkey_A = {
+		.data = dA_secp192r1,
+		.length = sizeof(dA_secp192r1),
+	},
+	.pkey_B = {
+		.data = dB_secp192r1,
+		.length = sizeof(dB_secp192r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp192r1,
+		.length = sizeof(x_Z_secp192r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp192r1,
+		.length = sizeof(y_Z_secp192r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP192R1
+};
+
+/** SECP224R1 (P-224 NIST) test vector */
+
+static uint8_t dA_secp224r1[] = {
+	0xB5, 0x58, 0xEB, 0x6C, 0x28, 0x8D, 0xA7, 0x07,
+	0xBB, 0xB4, 0xF8, 0xFB, 0xAE, 0x2A, 0xB9, 0xE9,
+	0xCB, 0x62, 0xE3, 0xBC, 0x5C, 0x75, 0x73, 0xE2,
+	0x2E, 0x26, 0xD3, 0x7F
+};
+
+static uint8_t x_qA_secp224r1[] = {
+	0x49, 0xDF, 0xEF, 0x30, 0x9F, 0x81, 0x48, 0x8C,
+	0x30, 0x4C, 0xFF, 0x5A, 0xB3, 0xEE, 0x5A, 0x21,
+	0x54, 0x36, 0x7D, 0xC7, 0x83, 0x31, 0x50, 0xE0,
+	0xA5, 0x1F, 0x3E, 0xEB
+};
+
+static uint8_t y_qA_secp224r1[] = {
+	0x4F, 0x2B, 0x5E, 0xE4, 0x57, 0x62, 0xC4, 0xF6,
+	0x54, 0xC1, 0xA0, 0xC6, 0x7F, 0x54, 0xCF, 0x88,
+	0xB0, 0x16, 0xB5, 0x1B, 0xCE, 0x3D, 0x7C, 0x22,
+	0x8D, 0x57, 0xAD, 0xB4,
+};
+
+static uint8_t dB_secp224r1[] = {
+	0xAC, 0x3B, 0x1A, 0xDD, 0x3D, 0x97, 0x70, 0xE6,
+	0xF6, 0xA7, 0x08, 0xEE, 0x9F, 0x3B, 0x8E, 0x0A,
+	0xB3, 0xB4, 0x80, 0xE9, 0xF2, 0x7F, 0x85, 0xC8,
+	0x8B, 0x5E, 0x6D, 0x18,
+};
+
+static uint8_t x_qB_secp224r1[] = {
+	0x6B, 0x3A, 0xC9, 0x6A, 0x8D, 0x0C, 0xDE, 0x6A,
+	0x55, 0x99, 0xBE, 0x80, 0x32, 0xED, 0xF1, 0x0C,
+	0x16, 0x2D, 0x0A, 0x8A, 0xD2, 0x19, 0x50, 0x6D,
+	0xCD, 0x42, 0xA2, 0x07,
+};
+
+static uint8_t y_qB_secp224r1[] = {
+	0xD4, 0x91, 0xBE, 0x99, 0xC2, 0x13, 0xA7, 0xD1,
+	0xCA, 0x37, 0x06, 0xDE, 0xBF, 0xE3, 0x05, 0xF3,
+	0x61, 0xAF, 0xCB, 0xB3, 0x3E, 0x26, 0x09, 0xC8,
+	0xB1, 0x61, 0x8A, 0xD5
+};
+
+static uint8_t x_Z_secp224r1[] = {
+	0x52, 0x27, 0x2F, 0x50, 0xF4, 0x6F, 0x4E, 0xDC,
+	0x91, 0x51, 0x56, 0x90, 0x92, 0xF4, 0x6D, 0xF2,
+	0xD9, 0x6E, 0xCC, 0x3B, 0x6D, 0xC1, 0x71, 0x4A,
+	0x4E, 0xA9, 0x49, 0xFA
+};
+
+static uint8_t y_Z_secp224r1[] = {
+	0x5F, 0x30, 0xC6, 0xAA, 0x36, 0xDD, 0xC4, 0x03,
+	0xC0, 0xAC, 0xB7, 0x12, 0xBB, 0x88, 0xF1, 0x76,
+	0x3C, 0x30, 0x46, 0xF6, 0xD9, 0x19, 0xBD, 0x9C,
+	0x52, 0x43, 0x22, 0xBF
+};
+
+/** ECDH SECP224R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp224r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp224r1,
+		.length = sizeof(x_qA_secp224r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp224r1,
+		.length = sizeof(y_qA_secp224r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp224r1,
+		.length = sizeof(x_qB_secp224r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp224r1,
+		.length = sizeof(y_qB_secp224r1),
+	},
+	.pkey_A = {
+		.data = dA_secp224r1,
+		.length = sizeof(dA_secp224r1),
+	},
+	.pkey_B = {
+		.data = dB_secp224r1,
+		.length = sizeof(dB_secp224r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp224r1,
+		.length = sizeof(x_Z_secp224r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp224r1,
+		.length = sizeof(y_Z_secp224r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP224R1
+};
+
+/** SECP256R1 (P-256 NIST) test vector */
+
+static uint8_t dA_secp256r1[] = {
+	0x81, 0x42, 0x64, 0x14, 0x5F, 0x2F, 0x56, 0xF2,
+	0xE9, 0x6A, 0x8E, 0x33, 0x7A, 0x12, 0x84, 0x99,
+	0x3F, 0xAF, 0x43, 0x2A, 0x5A, 0xBC, 0xE5, 0x9E,
+	0x86, 0x7B, 0x72, 0x91, 0xD5, 0x07, 0xA3, 0xAF
+};
+
+static uint8_t x_qA_secp256r1[] = {
+	0x2A, 0xF5, 0x02, 0xF3, 0xBE, 0x89, 0x52, 0xF2,
+	0xC9, 0xB5, 0xA8, 0xD4, 0x16, 0x0D, 0x09, 0xE9,
+	0x71, 0x65, 0xBE, 0x50, 0xBC, 0x42, 0xAE, 0x4A,
+	0x5E, 0x8D, 0x3B, 0x4B, 0xA8, 0x3A, 0xEB, 0x15
+};
+
+static uint8_t y_qA_secp256r1[] = {
+	0xEB, 0x0F, 0xAF, 0x4C, 0xA9, 0x86, 0xC4, 0xD3,
+	0x86, 0x81, 0xA0, 0xF9, 0x87, 0x2D, 0x79, 0xD5,
+	0x67, 0x95, 0xBD, 0x4B, 0xFF, 0x6E, 0x6D, 0xE3,
+	0xC0, 0xF5, 0x01, 0x5E, 0xCE, 0x5E, 0xFD, 0x85
+};
+
+static uint8_t dB_secp256r1[] = {
+	0x2C, 0xE1, 0x78, 0x8E, 0xC1, 0x97, 0xE0, 0x96,
+	0xDB, 0x95, 0xA2, 0x00, 0xCC, 0x0A, 0xB2, 0x6A,
+	0x19, 0xCE, 0x6B, 0xCC, 0xAD, 0x56, 0x2B, 0x8E,
+	0xEE, 0x1B, 0x59, 0x37, 0x61, 0xCF, 0x7F, 0x41
+};
+
+static uint8_t x_qB_secp256r1[] = {
+	0xB1, 0x20, 0xDE, 0x4A, 0xA3, 0x64, 0x92, 0x79,
+	0x53, 0x46, 0xE8, 0xDE, 0x6C, 0x2C, 0x86, 0x46,
+	0xAE, 0x06, 0xAA, 0xEA, 0x27, 0x9F, 0xA7, 0x75,
+	0xB3, 0xAB, 0x07, 0x15, 0xF6, 0xCE, 0x51, 0xB0
+};
+
+static uint8_t y_qB_secp256r1[] = {
+	0x9F, 0x1B, 0x7E, 0xEC, 0xE2, 0x0D, 0x7B, 0x5E,
+	0xD8, 0xEC, 0x68, 0x5F, 0xA3, 0xF0, 0x71, 0xD8,
+	0x37, 0x27, 0x02, 0x70, 0x92, 0xA8, 0x41, 0x13,
+	0x85, 0xC3, 0x4D, 0xDE, 0x57, 0x08, 0xB2, 0xB6
+};
+
+static uint8_t x_Z_secp256r1[] = {
+	0xDD, 0x0F, 0x53, 0x96, 0x21, 0x9D, 0x1E, 0xA3,
+	0x93, 0x31, 0x04, 0x12, 0xD1, 0x9A, 0x08, 0xF1,
+	0xF5, 0x81, 0x1E, 0x9D, 0xC8, 0xEC, 0x8E, 0xEA,
+	0x7F, 0x80, 0xD2, 0x1C, 0x82, 0x0C, 0x27, 0x88
+};
+
+static uint8_t y_Z_secp256r1[] = {
+	0x03, 0x57, 0xDC, 0xCD, 0x4C, 0x80, 0x4D, 0x0D,
+	0x8D, 0x33, 0xAA, 0x42, 0xB8, 0x48, 0x83, 0x4A,
+	0xA5, 0x60, 0x5F, 0x9A, 0xB0, 0xD3, 0x72, 0x39,
+	0xA1, 0x15, 0xBB, 0xB6, 0x47, 0x93, 0x6F, 0x50
+};
+
+/** ECDH SECP256R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp256r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp256r1,
+		.length = sizeof(x_qA_secp256r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp256r1,
+		.length = sizeof(y_qA_secp256r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp256r1,
+		.length = sizeof(x_qB_secp256r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp256r1,
+		.length = sizeof(y_qB_secp256r1),
+	},
+	.pkey_A = {
+		.data = dA_secp256r1,
+		.length = sizeof(dA_secp256r1),
+	},
+	.pkey_B = {
+		.data = dB_secp256r1,
+		.length = sizeof(dB_secp256r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp256r1,
+		.length = sizeof(x_Z_secp256r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp256r1,
+		.length = sizeof(y_Z_secp256r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP256R1
+};
+
+/** SECP384R1 (P-384 NIST) test vector */
+
+static uint8_t dA_secp384r1[] = {
+	0xD2, 0x73, 0x35, 0xEA, 0x71, 0x66, 0x4A, 0xF2,
+	0x44, 0xDD, 0x14, 0xE9, 0xFD, 0x12, 0x60, 0x71,
+	0x5D, 0xFD, 0x8A, 0x79, 0x65, 0x57, 0x1C, 0x48,
+	0xD7, 0x09, 0xEE, 0x7A, 0x79, 0x62, 0xA1, 0x56,
+	0xD7, 0x06, 0xA9, 0x0C, 0xBC, 0xB5, 0xDF, 0x29,
+	0x86, 0xF0, 0x5F, 0xEA, 0xDB, 0x93, 0x76, 0xF1
+};
+
+static uint8_t x_qA_secp384r1[] = {
+	0x79, 0x31, 0x48, 0xF1, 0x78, 0x76, 0x34, 0xD5,
+	0xDA, 0x4C, 0x6D, 0x90, 0x74, 0x41, 0x7D, 0x05,
+	0xE0, 0x57, 0xAB, 0x62, 0xF8, 0x20, 0x54, 0xD1,
+	0x0E, 0xE6, 0xB0, 0x40, 0x3D, 0x62, 0x79, 0x54,
+	0x7E, 0x6A, 0x8E, 0xA9, 0xD1, 0xFD, 0x77, 0x42,
+	0x7D, 0x01, 0x6F, 0xE2, 0x7A, 0x8B, 0x8C, 0x66
+};
+
+static uint8_t y_qA_secp384r1[] = {
+	0xC6, 0xC4, 0x12, 0x94, 0x33, 0x1D, 0x23, 0xE6,
+	0xF4, 0x80, 0xF4, 0xFB, 0x4C, 0xD4, 0x05, 0x04,
+	0xC9, 0x47, 0x39, 0x2E, 0x94, 0xF4, 0xC3, 0xF0,
+	0x6B, 0x8F, 0x39, 0x8B, 0xB2, 0x9E, 0x42, 0x36,
+	0x8F, 0x7A, 0x68, 0x59, 0x23, 0xDE, 0x3B, 0x67,
+	0xBA, 0xCE, 0xD2, 0x14, 0xA1, 0xA1, 0xD1, 0x28
+};
+
+static uint8_t dB_secp384r1[] = {
+	0x52, 0xD1, 0x79, 0x1F, 0xDB, 0x4B, 0x70, 0xF8,
+	0x9C, 0x0F, 0x00, 0xD4, 0x56, 0xC2, 0xF7, 0x02,
+	0x3B, 0x61, 0x25, 0x26, 0x2C, 0x36, 0xA7, 0xDF,
+	0x1F, 0x80, 0x23, 0x11, 0x21, 0xCC, 0xE3, 0xD3,
+	0x9B, 0xE5, 0x2E, 0x00, 0xC1, 0x94, 0xA4, 0x13,
+	0x2C, 0x4A, 0x6C, 0x76, 0x8B, 0xCD, 0x94, 0xD2
+};
+
+static uint8_t x_qB_secp384r1[] = {
+	0x5C, 0xD4, 0x2A, 0xB9, 0xC4, 0x1B, 0x53, 0x47,
+	0xF7, 0x4B, 0x8D, 0x4E, 0xFB, 0x70, 0x8B, 0x3D,
+	0x5B, 0x36, 0xDB, 0x65, 0x91, 0x53, 0x59, 0xB4,
+	0x4A, 0xBC, 0x17, 0x64, 0x7B, 0x6B, 0x99, 0x99,
+	0x78, 0x9D, 0x72, 0xA8, 0x48, 0x65, 0xAE, 0x2F,
+	0x22, 0x3F, 0x12, 0xB5, 0xA1, 0xAB, 0xC1, 0x20
+};
+
+static uint8_t y_qB_secp384r1[] = {
+	0xE1, 0x71, 0x45, 0x8F, 0xEA, 0xA9, 0x39, 0xAA,
+	0xA3, 0xA8, 0xBF, 0xAC, 0x46, 0xB4, 0x04, 0xBD,
+	0x8F, 0x6D, 0x5B, 0x34, 0x8C, 0x0F, 0xA4, 0xD8,
+	0x0C, 0xEC, 0xA1, 0x63, 0x56, 0xCA, 0x93, 0x32,
+	0x40, 0xBD, 0xE8, 0x72, 0x34, 0x15, 0xA8, 0xEC,
+	0xE0, 0x35, 0xB0, 0xED, 0xF3, 0x67, 0x55, 0xDE
+};
+
+static uint8_t x_Z_secp384r1[] = {
+	0x5E, 0xA1, 0xFC, 0x4A, 0xF7, 0x25, 0x6D, 0x20,
+	0x55, 0x98, 0x1B, 0x11, 0x05, 0x75, 0xE0, 0xA8,
+	0xCA, 0xE5, 0x31, 0x60, 0x13, 0x7D, 0x90, 0x4C,
+	0x59, 0xD9, 0x26, 0xEB, 0x1B, 0x84, 0x56, 0xE4,
+	0x27, 0xAA, 0x8A, 0x45, 0x40, 0x88, 0x4C, 0x37,
+	0xDE, 0x15, 0x9A, 0x58, 0x02, 0x8A, 0xBC, 0x0E
+};
+
+static uint8_t y_Z_secp384r1[] = {
+	0x0C, 0xC5, 0x9E, 0x4B, 0x04, 0x64, 0x14, 0xA8,
+	0x1C, 0x8A, 0x3B, 0xDF, 0xDC, 0xA9, 0x25, 0x26,
+	0xC4, 0x87, 0x69, 0xDD, 0x8D, 0x31, 0x27, 0xCA,
+	0xA9, 0x9B, 0x36, 0x32, 0xD1, 0x91, 0x39, 0x42,
+	0xDE, 0x36, 0x2E, 0xAF, 0xAA, 0x96, 0x23, 0x79,
+	0x37, 0x4D, 0x9F, 0x3F, 0x06, 0x68, 0x41, 0xCA
+};
+
+/** ECDH SECP384R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp384r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp384r1,
+		.length = sizeof(x_qA_secp384r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp384r1,
+		.length = sizeof(y_qA_secp384r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp384r1,
+		.length = sizeof(x_qB_secp384r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp384r1,
+		.length = sizeof(y_qB_secp384r1),
+	},
+	.pkey_A = {
+		.data = dA_secp384r1,
+		.length = sizeof(dA_secp384r1),
+	},
+	.pkey_B = {
+		.data = dB_secp384r1,
+		.length = sizeof(dB_secp384r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp384r1,
+		.length = sizeof(x_Z_secp384r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp384r1,
+		.length = sizeof(y_Z_secp384r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP384R1
+};
+
+/** SECP521R1 (P-521 NIST) test vector */
+
+static uint8_t dA_secp521r1[] = {
+	0x01, 0x13, 0xF8, 0x2D, 0xA8, 0x25, 0x73, 0x5E,
+	0x3D, 0x97, 0x27, 0x66, 0x83, 0xB2, 0xB7, 0x42,
+	0x77, 0xBA, 0xD2, 0x73, 0x35, 0xEA, 0x71, 0x66,
+	0x4A, 0xF2, 0x43, 0x0C, 0xC4, 0xF3, 0x34, 0x59,
+	0xB9, 0x66, 0x9E, 0xE7, 0x8B, 0x3F, 0xFB, 0x9B,
+	0x86, 0x83, 0x01, 0x5D, 0x34, 0x4D, 0xCB, 0xFE,
+	0xF6, 0xFB, 0x9A, 0xF4, 0xC6, 0xC4, 0x70, 0xBE,
+	0x25, 0x45, 0x16, 0xCD, 0x3C, 0x1A, 0x1F, 0xB4,
+	0x73, 0x62
+};
+
+static uint8_t x_qA_secp521r1[] = {
+	0x01, 0xEB, 0xB3, 0x4D, 0xD7, 0x57, 0x21, 0xAB,
+	0xF8, 0xAD, 0xC9, 0xDB, 0xED, 0x17, 0x88, 0x9C,
+	0xBB, 0x97, 0x65, 0xD9, 0x0A, 0x7C, 0x60, 0xF2,
+	0xCE, 0xF0, 0x07, 0xBB, 0x0F, 0x2B, 0x26, 0xE1,
+	0x48, 0x81, 0xFD, 0x44, 0x42, 0xE6, 0x89, 0xD6,
+	0x1C, 0xB2, 0xDD, 0x04, 0x6E, 0xE3, 0x0E, 0x3F,
+	0xFD, 0x20, 0xF9, 0xA4, 0x5B, 0xBD, 0xF6, 0x41,
+	0x3D, 0x58, 0x3A, 0x2D, 0xBF, 0x59, 0x92, 0x4F,
+	0xD3, 0x5C
+};
+
+static uint8_t y_qA_secp521r1[] = {
+	0x00, 0xF6, 0xB6, 0x32, 0xD1, 0x94, 0xC0, 0x38,
+	0x8E, 0x22, 0xD8, 0x43, 0x7E, 0x55, 0x8C, 0x55,
+	0x2A, 0xE1, 0x95, 0xAD, 0xFD, 0x15, 0x3F, 0x92,
+	0xD7, 0x49, 0x08, 0x35, 0x1B, 0x2F, 0x8C, 0x4E,
+	0xDA, 0x94, 0xED, 0xB0, 0x91, 0x6D, 0x1B, 0x53,
+	0xC0, 0x20, 0xB5, 0xEE, 0xCA, 0xED, 0x1A, 0x5F,
+	0xC3, 0x8A, 0x23, 0x3E, 0x48, 0x30, 0x58, 0x7B,
+	0xB2, 0xEE, 0x34, 0x89, 0xB3, 0xB4, 0x2A, 0x5A,
+	0x86, 0xA4
+};
+
+static uint8_t dB_secp521r1[] = {
+	0x00, 0xCE, 0xE3, 0x48, 0x0D, 0x86, 0x45, 0xA1,
+	0x7D, 0x24, 0x9F, 0x27, 0x76, 0xD2, 0x8B, 0xAE,
+	0x61, 0x69, 0x52, 0xD1, 0x79, 0x1F, 0xDB, 0x4B,
+	0x70, 0xF7, 0xC3, 0x37, 0x87, 0x32, 0xAA, 0x1B,
+	0x22, 0x92, 0x84, 0x48, 0xBC, 0xD1, 0xDC, 0x24,
+	0x96, 0xD4, 0x35, 0xB0, 0x10, 0x48, 0x06, 0x6E,
+	0xBE, 0x4F, 0x72, 0x90, 0x3C, 0x36, 0x1B, 0x1A,
+	0x9D, 0xC1, 0x19, 0x3D, 0xC2, 0xC9, 0xD0, 0x89,
+	0x1B, 0x96
+};
+
+static uint8_t x_qB_secp521r1[] = {
+	0x01, 0x0E, 0xBF, 0xAF, 0xC6, 0xE8, 0x5E, 0x08,
+	0xD2, 0x4B, 0xFF, 0xFC, 0xC1, 0xA4, 0x51, 0x1D,
+	0xB0, 0xE6, 0x34, 0xBE, 0xEB, 0x1B, 0x6D, 0xEC,
+	0x8C, 0x59, 0x39, 0xAE, 0x44, 0x76, 0x62, 0x01,
+	0xAF, 0x62, 0x00, 0x43, 0x0B, 0xA9, 0x7C, 0x8A,
+	0xC6, 0xA0, 0xE9, 0xF0, 0x8B, 0x33, 0xCE, 0x7E,
+	0x9F, 0xEE, 0xB5, 0xBA, 0x4E, 0xE5, 0xE0, 0xD8,
+	0x15, 0x10, 0xC2, 0x42, 0x95, 0xB8, 0xA0, 0x8D,
+	0x02, 0x35
+};
+
+static uint8_t y_qB_secp521r1[] = {
+	0x00, 0xA4, 0xA6, 0xEC, 0x30, 0x0D, 0xF9, 0xE2,
+	0x57, 0xB0, 0x37, 0x2B, 0x5E, 0x7A, 0xBF, 0xEF,
+	0x09, 0x34, 0x36, 0x71, 0x9A, 0x77, 0x88, 0x7E,
+	0xBB, 0x0B, 0x18, 0xCF, 0x80, 0x99, 0xB9, 0xF4,
+	0x21, 0x2B, 0x6E, 0x30, 0xA1, 0x41, 0x9C, 0x18,
+	0xE0, 0x29, 0xD3, 0x68, 0x63, 0xCC, 0x9D, 0x44,
+	0x8F, 0x4D, 0xBA, 0x4D, 0x2A, 0x0E, 0x60, 0x71,
+	0x1B, 0xE5, 0x72, 0x91, 0x5F, 0xBD, 0x4F, 0xEF,
+	0x26, 0x95
+};
+
+static uint8_t x_Z_secp521r1[] = {
+	0x00, 0xCD, 0xEA, 0x89, 0x62, 0x1C, 0xFA, 0x46,
+	0xB1, 0x32, 0xF9, 0xE4, 0xCF, 0xE2, 0x26, 0x1C,
+	0xDE, 0x2D, 0x43, 0x68, 0xEB, 0x56, 0x56, 0x63,
+	0x4C, 0x7C, 0xC9, 0x8C, 0x7A, 0x00, 0xCD, 0xE5,
+	0x4E, 0xD1, 0x86, 0x6A, 0x0D, 0xD3, 0xE6, 0x12,
+	0x6C, 0x9D, 0x2F, 0x84, 0x5D, 0xAF, 0xF8, 0x2C,
+	0xEB, 0x1D, 0xA0, 0x8F, 0x5D, 0x87, 0x52, 0x1B,
+	0xB0, 0xEB, 0xEC, 0xA7, 0x79, 0x11, 0x16, 0x9C,
+	0x20, 0xCC
+};
+
+static uint8_t y_Z_secp521r1[] = {
+	0x00, 0xF9, 0xA7, 0x16, 0x41, 0x02, 0x9B, 0x7F,
+	0xC1, 0xA8, 0x08, 0xAD, 0x07, 0xCD, 0x48, 0x61,
+	0xE8, 0x68, 0x61, 0x4B, 0x86, 0x5A, 0xFB, 0xEC,
+	0xAB, 0x1F, 0x2B, 0xD4, 0xD8, 0xB5, 0x5E, 0xBC,
+	0xB5, 0xE3, 0xA5, 0x31, 0x43, 0xCE, 0xB2, 0xC5,
+	0x11, 0xB1, 0xAE, 0x0A, 0xF5, 0xAC, 0x82, 0x7F,
+	0x60, 0xF2, 0xFD, 0x87, 0x25, 0x65, 0xAC, 0x5C,
+	0xA0, 0xA1, 0x64, 0x03, 0x8F, 0xE9, 0x80, 0xA7,
+	0xE4, 0xBD
+};
+
+/** ECDH SECP521R1 elliptic curve param */
+
+struct crypto_testsuite_ecdh_params ecdh_param_secp521r1 = {
+	.pubkey_qA_x = {
+		.data = x_qA_secp521r1,
+		.length = sizeof(x_qA_secp521r1),
+	},
+	.pubkey_qA_y = {
+		.data = y_qA_secp521r1,
+		.length = sizeof(y_qA_secp521r1),
+	},
+	.pubkey_qB_x = {
+		.data = x_qB_secp521r1,
+		.length = sizeof(x_qB_secp521r1),
+	},
+	.pubkey_qB_y = {
+		.data = y_qB_secp521r1,
+		.length = sizeof(y_qB_secp521r1),
+	},
+	.pkey_A = {
+		.data = dA_secp521r1,
+		.length = sizeof(dA_secp521r1),
+	},
+	.pkey_B = {
+		.data = dB_secp521r1,
+		.length = sizeof(dB_secp521r1),
+	},
+	.secret_x = {
+		.data = x_Z_secp521r1,
+		.length = sizeof(x_Z_secp521r1),
+	},
+	.secret_y = {
+		.data = y_Z_secp521r1,
+		.length = sizeof(y_Z_secp521r1),
+	},
+	.curve = RTE_CRYPTO_EC_GROUP_SECP521R1
+};
+
+#endif /* __TEST_CRYPTODEV_ECDSA_TEST_VECTORS_H__ */
-- 
2.25.1


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

* RE: [PATCH v2] test/cryptodev: add ECDH tests
  2023-11-08 13:17   ` [PATCH v2] " Gowrishankar Muthukrishnan
@ 2023-11-09 20:24     ` Akhil Goyal
  0 siblings, 0 replies; 9+ messages in thread
From: Akhil Goyal @ 2023-11-09 20:24 UTC (permalink / raw)
  To: Gowrishankar Muthukrishnan, dev
  Cc: Anoob Joseph, Fan Zhang, Gowrishankar Muthukrishnan

> Subject: [PATCH v2] test/cryptodev: add ECDH tests
> 
> Add ECDH tests.
> 
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> Change-Id: I88099e2ba8e058fbb519a06d09ebb3ece7c7e27f
> ---
> v2:
>  - rebased due to patch conflict.

Applied to dpdk-next-crypto
Removed change-id while merging.

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

end of thread, other threads:[~2023-11-09 20:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26  8:15 [PATCH v1 0/4] test/cryptodev: add ECDH tests Gowrishankar Muthukrishnan
2023-10-26  8:15 ` [PATCH v1 1/4] " Gowrishankar Muthukrishnan
2023-10-30 18:48   ` Akhil Goyal
2023-11-08 13:17   ` [PATCH v2] " Gowrishankar Muthukrishnan
2023-11-09 20:24     ` Akhil Goyal
2023-10-26  8:15 ` [PATCH v1 2/4] crypto/cnxk: use generic EC opcodes Gowrishankar Muthukrishnan
2023-10-26  8:15 ` [PATCH v1 3/4] crypto/cnxk: change order of ECFPM params Gowrishankar Muthukrishnan
2023-10-26  8:15 ` [PATCH v1 4/4] crypto/cnxk: add ECDH support Gowrishankar Muthukrishnan
2023-10-30 18:49   ` Akhil Goyal

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