From: Kai Ji <kai.ji@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, stable@dpdk.org,
Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>,
Kai Ji <kai.ji@intel.com>
Subject: [dpdk-dev v2 1/3] app/test: add diffie-hellman test cases
Date: Wed, 15 Mar 2023 02:34:55 +0800 [thread overview]
Message-ID: <20230314183457.13918-2-kai.ji@intel.com> (raw)
In-Reply-To: <20230314183457.13918-1-kai.ji@intel.com>
From: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Added Diffie-Hellman tests. This tests adding possibility
to check correctness of particular DH phases, which is not
possible with current tests cases.
Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Kai Ji <kai.ji@intel.com>
---
app/test/test_cryptodev_asym.c | 264 ++++++++++++++++++
app/test/test_cryptodev_dh_test_vectors.h | 318 ++++++++++++++++++++++
2 files changed, 582 insertions(+)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 5b16dcab56..b9034b637a 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -64,6 +64,39 @@ static uint32_t test_index;
static struct crypto_testsuite_params_asym testsuite_params = { NULL };
+static void
+test_crypto_rand(int len, uint8_t *buffer)
+{
+ int i;
+
+ for (i = 0; i < len; ++i)
+ buffer[i] = (uint8_t)(rand() % ((uint8_t)-1)) | 1;
+}
+
+static int
+process_crypto_request(uint8_t dev_id, struct rte_crypto_op **op,
+ struct rte_crypto_op **result_op)
+{
+ /* 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");
+ return -1;
+ }
+
+ 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");
+ return -1;
+ }
+ return 0;
+}
+
static int
queue_ops_rsa_sign_verify(void *sess)
{
@@ -809,6 +842,8 @@ testsuite_setup(void)
test_vector.size = 0;
load_test_vectors();
+ srand(time(NULL));
+
/* Device, op pool and session configuration for asymmetric crypto. 8< */
ts_params->op_mpool = rte_crypto_op_pool_create(
"CRYPTO_ASYM_OP_POOL",
@@ -2196,6 +2231,219 @@ test_ecpm_all_curve(void)
return overall_status;
}
+static void *
+dh_alice_bob_set_session(uint8_t dev_id,
+ struct rte_crypto_op *op,
+ const struct test_dh_group *group)
+{
+ struct rte_crypto_asym_xform xform = { };
+ void *sess = NULL;
+ int ret = 0;
+
+ xform.xform_type = RTE_CRYPTO_ASYM_XFORM_DH;
+ xform.dh.g.data = group->g.data;
+ xform.dh.g.length = group->g.bytesize;
+ xform.dh.p.data = group->p.data;
+ xform.dh.p.length = group->p.bytesize;
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform,
+ testsuite_params.session_mpool, &sess);
+ if (ret)
+ return NULL;
+
+ rte_crypto_op_attach_asym_session(op, sess);
+ return sess;
+}
+
+static void
+dh_alice_bob_gen_x(const struct test_dh_group *group,
+ uint8_t *private_data)
+{
+ test_crypto_rand(group->priv_ff_size, private_data);
+ if (private_data[0] > group->p.data[0])
+ private_data[0] = group->p.data[0] - 1;
+}
+
+static int
+dh_alice_bob_gen_y(struct rte_crypto_op *op,
+ const char *name,
+ const uint8_t dev_id,
+ uint8_t *y,
+ uint8_t *x,
+ const int ff_size)
+{
+ struct rte_crypto_op *result_op;
+ int ret = 0;
+
+ op->asym->dh.ke_type = RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE;
+ op->asym->dh.pub_key.data = y;
+ op->asym->dh.priv_key.data = x;
+ op->asym->dh.priv_key.length = ff_size;
+
+ ret = process_crypto_request(dev_id, &op, &result_op);
+ TEST_ASSERT_SUCCESS(ret, "Failed to compute public key for %s", name);
+
+ return 0;
+}
+
+static int
+dh_alice_bob_shared_compute(uint8_t dev_id,
+ const char *name,
+ struct rte_crypto_op *op,
+ uint8_t *secret,
+ uint8_t *peer,
+ uint32_t peer_size)
+{
+ struct rte_crypto_op *result_op;
+ int ret = 0;
+
+ op->asym->dh.ke_type = RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE;
+ op->asym->dh.pub_key.data = peer;
+ op->asym->dh.pub_key.length = peer_size;
+ op->asym->dh.shared_secret.data = secret;
+
+ ret = process_crypto_request(dev_id, &op, &result_op);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to compute shared secret for %s",
+ name);
+
+ return 0;
+}
+
+/* Diffie-Hellman test to verify the processed data */
+static int
+dh_alice_bob_verify(struct rte_crypto_op *alice_op,
+ struct rte_crypto_op *bob_op)
+{
+ int ret = 0;
+
+ /* Verify processed data */
+ ret = (alice_op->asym->dh.shared_secret.length ==
+ bob_op->asym->dh.shared_secret.length);
+ if (!ret) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Alice's and Bob's shared secret length do not match.");
+ return TEST_FAILED;
+ }
+ ret = memcmp(alice_op->asym->dh.shared_secret.data,
+ alice_op->asym->dh.shared_secret.data,
+ bob_op->asym->dh.shared_secret.length);
+ if (ret) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Alice's and Bob's shared secret do not match.");
+ return TEST_FAILED;
+ }
+ return TEST_SUCCESS;
+}
+
+static int
+test_dh_alice_and_bob(const void *test_data)
+{
+ uint8_t alice_x[TEST_DH_MOD_LEN] = { };
+ uint8_t alice_y[TEST_DH_MOD_LEN] = { };
+ uint8_t alice_secret[TEST_DH_MOD_LEN] = { };
+ uint8_t bob_x[TEST_DH_MOD_LEN] = { };
+ uint8_t bob_y[TEST_DH_MOD_LEN] = { };
+ uint8_t bob_secret[TEST_DH_MOD_LEN] = { };
+
+ const struct test_dh_group *group = test_data;
+ struct rte_crypto_op *alice_op = NULL;
+ struct rte_crypto_op *bob_op = NULL;
+ void *alice_session = NULL;
+ void *bob_session = NULL;
+
+ int ret = TEST_SUCCESS;
+ uint32_t alice_y_size = 0;
+ uint32_t bob_y_size = 0;
+ uint8_t dev_id = testsuite_params.valid_devs[0];
+
+ alice_op = rte_crypto_op_alloc(testsuite_params.op_mpool,
+ RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
+ if (alice_op == NULL) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Cannot allocate alice_op");
+ ret = TEST_FAILED;
+ goto error_exit;
+ }
+ bob_op = rte_crypto_op_alloc(testsuite_params.op_mpool,
+ RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
+ if (bob_op == NULL) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Cannot allocate bob_op");
+ ret = TEST_FAILED;
+ goto error_exit;
+ }
+
+ alice_session = dh_alice_bob_set_session(dev_id, alice_op,
+ group);
+ if (alice_session == NULL) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Cannot allocate alice_session");
+ ret = TEST_FAILED;
+ goto error_exit;
+ }
+ bob_session = dh_alice_bob_set_session(dev_id, bob_op,
+ group);
+ if (bob_session == NULL) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Cannot allocate bob_session");
+ ret = TEST_FAILED;
+ goto error_exit;
+ }
+
+ dh_alice_bob_gen_x(group, alice_x);
+ ret = dh_alice_bob_gen_y(alice_op, "Alice", dev_id,
+ alice_y, alice_x, group->priv_ff_size);
+ if (ret) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Diffie-Hellman error\n");
+ goto error_exit;
+ }
+ alice_y_size = alice_op->asym->dh.pub_key.length;
+ dh_alice_bob_gen_x(group, bob_x);
+ ret = dh_alice_bob_gen_y(bob_op, "Bob", dev_id,
+ bob_y, bob_x, group->priv_ff_size);
+ if (ret) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Diffie-Hellman error\n");
+ goto error_exit;
+ }
+ bob_y_size = bob_op->asym->dh.pub_key.length;
+
+ ret = dh_alice_bob_shared_compute(dev_id, "Alice", alice_op,
+ alice_secret, bob_y, bob_y_size);
+ if (ret) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Diffie-Hellman error, error computing Alice's shared secret");
+ goto error_exit;
+ }
+
+ ret = dh_alice_bob_shared_compute(dev_id, "Bob", bob_op, bob_secret,
+ alice_y, alice_y_size);
+ if (ret) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Diffie-Hellman error, error computing Bob's shared secret");
+ goto error_exit;
+ }
+
+ ret = dh_alice_bob_verify(alice_op, bob_op);
+ if (ret) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
+ "Diffie-Hellman error");
+ goto error_exit;
+ }
+
+error_exit:
+ if (alice_session)
+ rte_cryptodev_asym_session_free(dev_id, alice_session);
+ if (bob_session)
+ rte_cryptodev_asym_session_free(dev_id, bob_session);
+ if (alice_op)
+ rte_crypto_op_free(alice_op);
+ if (bob_op != NULL)
+ rte_crypto_op_free(bob_op);
+ return ret;
+}
+
static struct unit_test_suite cryptodev_openssl_asym_testsuite = {
.suite_name = "Crypto Device OPENSSL ASYM Unit Test Suite",
.setup = testsuite_setup,
@@ -2215,6 +2463,22 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite = {
TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_inv),
TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp),
TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
+ TEST_CASE_NAMED_WITH_DATA(
+ "Diffie-Hellman Alice and Bob group 14 ikev2 test",
+ ut_setup_asym, ut_teardown_asym,
+ test_dh_alice_and_bob, &test_dh_ikev2group_14),
+ TEST_CASE_NAMED_WITH_DATA(
+ "Diffie-Hellman Alice and Bob group 15 ikev2 test",
+ ut_setup_asym, ut_teardown_asym,
+ test_dh_alice_and_bob, &test_dh_ikev2group_15),
+ TEST_CASE_NAMED_WITH_DATA(
+ "Diffie-Hellman Alice and Bob group 16 ikev2 test",
+ ut_setup_asym, ut_teardown_asym,
+ test_dh_alice_and_bob, &test_dh_ikev2group_16),
+ TEST_CASE_NAMED_WITH_DATA(
+ "Diffie-Hellman Alice and Bob group 24 ikev2 test",
+ ut_setup_asym, ut_teardown_asym,
+ test_dh_alice_and_bob, &test_dh_ikev2group_24),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
diff --git a/app/test/test_cryptodev_dh_test_vectors.h b/app/test/test_cryptodev_dh_test_vectors.h
index fe7510dcd3..6af677c614 100644
--- a/app/test/test_cryptodev_dh_test_vectors.h
+++ b/app/test/test_cryptodev_dh_test_vectors.h
@@ -10,6 +10,18 @@
#define TEST_DATA_SIZE 4096
#define TEST_DH_MOD_LEN 1024
+struct test_dh_group {
+ int id;
+ struct {
+ uint8_t *data;
+ uint32_t bytesize;
+ } g;
+ struct {
+ uint8_t *data;
+ uint32_t bytesize;
+ } p;
+ uint32_t priv_ff_size;
+};
struct dh_test_param {
rte_crypto_param priv_key;
@@ -77,4 +89,310 @@ struct rte_crypto_asym_xform dh_xform = {
}
};
+static uint8_t test_dh_gen_2[] = {
+ 0x2,
+};
+
+static uint8_t test_dh_ikev2group14_p[] = {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xC9, 0x0F, 0xDA, 0xA2, 0x21, 0x68, 0xC2, 0x34,
+ 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1,
+ 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74,
+ 0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22,
+ 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD,
+ 0xEF, 0x95, 0x19, 0xB3, 0xC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, 0xFE, 0x14,
+ 0xC8, 0x48, 0x4B, 0x1E, 0x05, 0x25, 0x88, 0xB9,
+ 0xB7, 0xD2, 0xBB, 0xD2, 0xDF, 0x01, 0x61, 0x99,
+ 0xEC, 0xD0, 0x6E, 0x15, 0x57, 0xCD, 0x09, 0x15,
+ 0xB3, 0x35, 0x3B, 0xBB, 0x64, 0xE0, 0xEC, 0x37,
+ 0x7F, 0xD0, 0x28, 0x37, 0x0D, 0xF9, 0x2B, 0x52,
+ 0xC7, 0x89, 0x14, 0x28, 0xCD, 0xC6, 0x7E, 0xB6,
+ 0x18, 0x4B, 0x52, 0x3D, 0x1D, 0xB2, 0x46, 0xC3,
+ 0x2F, 0x63, 0x07, 0x84, 0x90, 0xF0, 0x0E, 0xF8,
+ 0xD6, 0x47, 0xD1, 0x48, 0xD4, 0x79, 0x54, 0x51,
+ 0x5E, 0x23, 0x27, 0xCF, 0xEF, 0x98, 0xC5, 0x82,
+ 0x66, 0x4B, 0x4C, 0x0F, 0x6C, 0xC4, 0x16, 0x59,
+};
+
+static const struct test_dh_group test_dh_ikev2group_14 = {
+ .id = 0,
+ /*
+ * Officially 14, ikev2
+ */
+ .g = {
+ .data = test_dh_gen_2,
+ .bytesize = sizeof(test_dh_gen_2),
+ },
+ .p = {
+ .data = test_dh_ikev2group14_p,
+ .bytesize = sizeof(test_dh_ikev2group14_p),
+ },
+ .priv_ff_size = 256,
+};
+
+static const struct test_dh_group test_dh_ikev2group_15 = {
+ .id = 0,
+ /*
+ * Officially 15, ikev2
+ */
+ .g = {
+ .data = test_dh_gen_2,
+ .bytesize = sizeof(test_dh_gen_2),
+ },
+ .p = {
+ .data = test_dh_ikev2group15_p,
+ .bytesize = sizeof(test_dh_ikev2group15_p),
+ },
+ .priv_ff_size = 384,
+};
+
+static const struct test_dh_group test_dh_ikev2group_16 = {
+ .id = 0,
+ /*
+ * Officially 16, ikev2
+ */
+ .g = {
+ .data = test_dh_gen_2,
+ .bytesize = sizeof(test_dh_gen_2),
+ },
+ .p = {
+ .data = test_dh_ikev2group16_p,
+ .bytesize = sizeof(test_dh_ikev2group16_p),
+ },
+ .priv_ff_size = 512,
+};
+
+static const struct test_dh_group test_dh_ikev2group_24 = {
+ .id = 0,
+ /*
+ * Officially 24, ikev2
+ */
+ .g = {
+ .data = test_dh_ikev2group24_g,
+ .bytesize = sizeof(test_dh_ikev2group24_g),
+ },
+ .p = {
+ .data = test_dh_ikev2group24_p,
+ .bytesize = sizeof(test_dh_ikev2group24_p),
+ },
+ .priv_ff_size = 32,
+};
+
+static const struct test_dh_group test_ecdh_secp256r1 = {
+ .id = RTE_CRYPTO_EC_GROUP_SECP256R1,
+ .priv_ff_size = 32,
+};
+static const struct test_dh_group test_ecdh_secp384r1 = {
+ .id = RTE_CRYPTO_EC_GROUP_SECP384R1,
+ .priv_ff_size = 48,
+};
+static const struct test_dh_group test_ecdh_secp521r1 = {
+ .id = RTE_CRYPTO_EC_GROUP_SECP521R1,
+ .priv_ff_size = 64,
+};
+
+
#endif /* TEST_CRYPTODEV_DH_TEST_VECTORS_H__ */
--
2.17.1
next prev parent reply other threads:[~2023-03-14 18:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 0:12 [dpdk-dev v1 1/2] " Kai Ji
2023-03-14 0:12 ` [dpdk-dev v1 2/2] app/test: add ecdh " Kai Ji
2023-03-14 10:54 ` [EXT] [dpdk-dev v1 1/2] app/test: add diffie-hellman " Akhil Goyal
2023-03-14 18:34 ` [dpdk-dev v2 0/3] app/test: add asymmetric " Kai Ji
2023-03-14 18:34 ` Kai Ji [this message]
2023-06-23 10:29 ` [EXT] [dpdk-dev v2 1/3] app/test: add diffie-hellman " Gowrishankar Muthukrishnan
2023-03-14 18:34 ` [dpdk-dev v2 2/3] app/test: add ecdh " Kai Ji
2023-03-14 18:34 ` [dpdk-dev v2 3/3] app/test: add ecdsa kat sessionless tests Kai Ji
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230314183457.13918-2-kai.ji@intel.com \
--to=kai.ji@intel.com \
--cc=arkadiuszx.kusztal@intel.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).