From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C5CE141E88; Tue, 14 Mar 2023 01:12:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5AB7F410DE; Tue, 14 Mar 2023 01:12:10 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id DA53440F16; Tue, 14 Mar 2023 01:12:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678752729; x=1710288729; h=from:to:cc:subject:date:message-id; bh=LdvbDhYBV5ocYsuiNXmLgIIAll2EZcIeOfQvXFaE0WU=; b=jcqzMT7TMWzyiqUCfcN9zTrKdwPSk8DfgAqw2BYrGETODboslfbKh9SL B/2v8WRC12eYO8VKExNCKU+/zUSSHIf0pQakfnWxZkEFBXaEcsT70kOKR IZo/jNjJw+05eEyuNO4c3W7gczeqCpRzdtpzXsAbmGN2B9BvX3L4udd5B YiaDfbM0CfXq3XEXBkPGyDIdyBSRAYVbwM2m4XaALiWdd0/SpfEwUILuQ ehTujIMOhG86AugFwKVq+rp2LTOyU2V5kIgXZRECgGqLa3Ll3KHbCWdQb 87XBNfow6YFpHwsWikH7IVE7haPGTqac0gQyNZ9L9FsWMJ70pqz8Sxh8T w==; X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="338838705" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="338838705" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 17:12:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="822155512" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="822155512" Received: from silpixa00400465.ir.intel.com ([10.55.128.39]) by fmsmga001.fm.intel.com with ESMTP; 13 Mar 2023 17:12:05 -0700 From: Kai Ji To: dev@dpdk.org Cc: gakhil@marvell.com, stable@dpdk.org, Arkadiusz Kusztal , Kai Ji Subject: [dpdk-dev v1 1/2] app/test: add diffie-hellman test cases Date: Tue, 14 Mar 2023 08:12:01 +0800 Message-Id: <20230314001202.38306-1-kai.ji@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Arkadiusz Kusztal 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 Signed-off-by: Kai Ji --- app/test/test_cryptodev_asym.c | 262 ++++++++++++++++++ app/test/test_cryptodev_dh_test_vectors.h | 318 ++++++++++++++++++++++ 2 files changed, 580 insertions(+) diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 5b16dcab56..91550946e2 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) { @@ -2196,6 +2229,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 +2461,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, 0xCD, 0x3A, 0x43, 0x1B, + 0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37, + 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, + 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, + 0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B, + 0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED, + 0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5, + 0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6, + 0x49, 0x28, 0x66, 0x51, 0xEC, 0xE4, 0x5B, 0x3D, + 0xC2, 0x00, 0x7C, 0xB8, 0xA1, 0x63, 0xBF, 0x05, + 0x98, 0xDA, 0x48, 0x36, 0x1C, 0x55, 0xD3, 0x9A, + 0x69, 0x16, 0x3F, 0xA8, 0xFD, 0x24, 0xCF, 0x5F, + 0x83, 0x65, 0x5D, 0x23, 0xDC, 0xA3, 0xAD, 0x96, + 0x1C, 0x62, 0xF3, 0x56, 0x20, 0x85, 0x52, 0xBB, + 0x9E, 0xD5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6D, + 0x67, 0x0C, 0x35, 0x4E, 0x4A, 0xBC, 0x98, 0x04, + 0xF1, 0x74, 0x6C, 0x08, 0xCA, 0x18, 0x21, 0x7C, + 0x32, 0x90, 0x5E, 0x46, 0x2E, 0x36, 0xCE, 0x3B, + 0xE3, 0x9E, 0x77, 0x2C, 0x18, 0x0E, 0x86, 0x03, + 0x9B, 0x27, 0x83, 0xA2, 0xEC, 0x07, 0xA2, 0x8F, + 0xB5, 0xC5, 0x5D, 0xF0, 0x6F, 0x4C, 0x52, 0xC9, + 0xDE, 0x2B, 0xCB, 0xF6, 0x95, 0x58, 0x17, 0x18, + 0x39, 0x95, 0x49, 0x7C, 0xEA, 0x95, 0x6A, 0xE5, + 0x15, 0xD2, 0x26, 0x18, 0x98, 0xFA, 0x05, 0x10, + 0x15, 0x72, 0x8E, 0x5A, 0x8A, 0xAC, 0xAA, 0x68, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +}; + +static uint8_t test_dh_ikev2group15_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, 0xCD, 0x3A, 0x43, 0x1B, + 0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37, + 0x4F, 0xE1, 0x35, 0x6D, 0x6D,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x27, 0x6E, 0x11, 0x71, 0x5F, + 0x69, 0x38, 0x77, 0xFA, 0xD7, 0xEF, 0x09, 0xCA, + 0xDB, 0x09, 0x4A, 0xE9, 0x1E, 0x1A, 0x15, 0x97, +}; + + +static uint8_t test_dh_ikev2group24_g[] = { + 0x3F, 0xB3, 0x2C, 0x9B, 0x73, 0x13, 0x4D, 0x0B, + 0x2E, 0x77, 0x50, 0x66, 0x60, 0xED, 0xBD, 0x48, + 0x4C, 0xA7, 0xB1, 0x8F, 0x21, 0xEF, 0x20, 0x54, + 0x07, 0xF4, 0x79, 0x3A, 0x1A, 0x0B, 0xA1, 0x25, + 0x10, 0xDB, 0xC1, 0x50, 0x77, 0xBE, 0x46, 0x3F, + 0xFF, 0x4F, 0xED, 0x4A, 0xAC, 0x0B, 0xB5, 0x55, + 0xBE, 0x3A, 0x6C, 0x1B, 0x0C, 0x6B, 0x47, 0xB1, + 0xBC, 0x37, 0x73, 0xBF, 0x7E, 0x8C, 0x6F, 0x62, + 0x90, 0x12, 0x28, 0xF8, 0xC2, 0x8C, 0xBB, 0x18, + 0xA5, 0x5A, 0xE3, 0x13, 0x41, 0x00, 0x0A, 0x65, + 0x01, 0x96, 0xF9, 0x31, 0xC7, 0x7A, 0x57, 0xF2, + 0xDD, 0xF4, 0x63, 0xE5, 0xE9, 0xEC, 0x14, 0x4B, + 0x77, 0x7D, 0xE6, 0x2A, 0xAA, 0xB8, 0xA8, 0x62, + 0x8A, 0xC3, 0x76, 0xD2, 0x82, 0xD6, 0xED, 0x38, + 0x64, 0xE6, 0x79, 0x82, 0x42, 0x8E, 0xBC, 0x83, + 0x1D, 0x14, 0x34, 0x8F, 0x6F, 0x2F, 0x91, 0x93, + 0xB5, 0x04, 0x5A, 0xF2, 0x76, 0x71, 0x64, 0xE1, + 0xDF, 0xC9, 0x67, 0xC1, 0xFB, 0x3F, 0x2E, 0x55, + 0xA4, 0xBD, 0x1B, 0xFF, 0xE8, 0x3B, 0x9C, 0x80, + 0xD0, 0x52, 0xB9, 0x85, 0xD1, 0x82, 0xEA, 0x0A, + 0xDB, 0x2A, 0x3B, 0x73, 0x13, 0xD3, 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