Hi Fan,

> -----Original Message-----
> From: Zhang, Roy Fan <roy.fan.zh...@intel.com>
> Sent: Friday, June 17, 2022 2:35 PM
> To: Kusztal, ArkadiuszX <arkadiuszx.kusz...@intel.com>; dev@dpdk.org
> Cc: gak...@marvell.com
> Subject: RE: [PATCH] test/crypto: add key exchange dh tests
> 
> Hi Arek,
> 
> The patch cannot compile.
> Looks like there are some inconsistency between the merged asym crypto
> change and your test code.
> Can you rebase?

[Arek] - I will sent new one in next release window with ECDH added and vectors 
from rfc5114,
 This one will be superseded.
> 
> Regards,
> Fan
> 
> > -----Original Message-----
> > From: Kusztal, ArkadiuszX <arkadiuszx.kusz...@intel.com>
> > Sent: Thursday, April 7, 2022 9:07 AM
> > To: dev@dpdk.org
> > Cc: gak...@marvell.com; Zhang, Roy Fan <roy.fan.zh...@intel.com>;
> > Kusztal, ArkadiuszX <arkadiuszx.kusz...@intel.com>
> > Subject: [PATCH] test/crypto: add key exchange dh tests
> >
> > This patch adds Diffie-Hellman key exchange tests.
> > Alice's and Bob's private keys are generated in tests, public keys are
> > then generated followed by shared secret.
> > Alice's and Bob's shared secret are then compared to obtain result of
> > the test.
> >
> > This test should be easy to extend to use ECDH.
> >
> > Signed-off-by: Arek Kusztal <arkadiuszx.kusz...@intel.com>
> > ---
> >  app/test/test_cryptodev_asym.c            | 266 ++++++++++++++++++++++++++
> >  app/test/test_cryptodev_dh_test_vectors.h | 305
> > ++++++++++++++++++++++++++++++
> >  2 files changed, 571 insertions(+)
> >
> > diff --git a/app/test/test_cryptodev_asym.c
> > b/app/test/test_cryptodev_asym.c index 573af2a537..1665709469 100644
> > --- a/app/test/test_cryptodev_asym.c
> > +++ b/app/test/test_cryptodev_asym.c
> > @@ -5,6 +5,9 @@
> >
> >  #ifndef RTE_EXEC_ENV_WINDOWS
> >
> > +#include <time.h>
> > +#include <stdlib.h>
> > +
> >  #include <rte_bus_vdev.h>
> >  #include <rte_common.h>
> >  #include <rte_hexdump.h>
> > @@ -35,6 +38,29 @@
> >  #define ASYM_TEST_MSG_LEN 256
> >  #define TEST_VECTOR_SIZE 256
> >
> > +#define TEST_CRYPTO_ASYM_NULL_RETURN(p, str) \
> > +   do {    \
> > +           if (p == NULL) {                        \
> > +                   RTE_LOG(ERR, USER1, "line %u FAILED: %s", \
> > +                           __LINE__, str);         \
> > +                   status = (ret == -ENOTSUP) ? \
> > +                           TEST_SKIPPED : TEST_FAILED; \
> > +                   goto error_exit;        \
> > +           }       \
> > +   } while (0)
> > +
> > +#define TEST_CRYPTO_ASYM_NEG_RETURN(p, str) \
> > +   do {    \
> > +           if (p) {        \
> > +                   RTE_LOG(ERR, USER1,     \
> > +                           "line %u FAILED: %s",   \
> > +                           __LINE__, str); \
> > +                   status = (ret == -ENOTSUP) ? \
> > +                           TEST_SKIPPED : TEST_FAILED; \
> > +                   goto error_exit; \
> > +           } \
> > +   } while (0)
> > +
> >  static int gbl_driver_id;
> >  struct crypto_testsuite_params_asym {
> >     struct rte_mempool *op_mpool;
> > @@ -66,6 +92,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 +868,7 @@
> > testsuite_setup(void)
> >
> >     memset(ts_params, 0, sizeof(*ts_params));
> >
> > +   srand(time(NULL));
> >     test_vector.size = 0;
> >     load_test_vectors();
> >
> > @@ -2136,6 +2196,196 @@ test_ecpm_all_curve(void)
> >     return overall_status;
> >  }
> >
> > +static int
> > +test_dh_set_session(uint8_t dev_id, void **sess,
> > +           struct rte_crypto_op *op, struct rte_crypto_asym_xform
> > *xform,
> > +           const struct test_dh_group *group,
> > +           enum rte_crypto_asym_op_type type)
> > +{
> > +   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;
> > +   xform->dh.type = type;
> > +   ret = rte_cryptodev_asym_session_create(dev_id, xform,
> > +                   testsuite_params.session_mpool, sess);
> > +   if (ret)
> > +           return -1;
> > +   rte_crypto_op_attach_asym_session(op, *sess);
> > +
> > +   return 0;
> > +}
> > +
> > +static int
> > +test_dh_pub_compute(const char *str, uint8_t dev_id, struct
> > +rte_crypto_op
> > **op,
> > +           int priv_size, uint8_t *private,
> > +           int result_size, uint8_t *result)
> > +{
> > +   struct rte_crypto_op *result_op;
> > +   struct rte_crypto_asym_op *asym_op = (*op)->asym;
> > +
> > +   asym_op->dh.priv_key.data = private;
> > +   asym_op->dh.priv_key.length = priv_size;
> > +   asym_op->dh.pub_key.data = result;
> > +   asym_op->dh.pub_key.length = result_size;
> > +
> > +   if (process_crypto_request(dev_id, op, &result_op))
> > +           return -1;
> > +
> > +   result_size = asym_op->dh.pub_key.length;
> > +   debug_hexdump(stdout, str,
> > +                   asym_op->dh.pub_key.data,
> > +                   result_size);
> > +   return result_size;
> > +}
> > +
> > +static int
> > +test_dh_shared_compute(const char *str,
> > +           uint8_t dev_id, struct rte_crypto_op **op,
> > +           int priv_size, uint8_t *private, int pub_size, uint8_t *public,
> > +           int result_size, uint8_t *result)
> > +{
> > +   struct rte_crypto_op *result_op;
> > +   struct rte_crypto_asym_op *asym_op = (*op)->asym;
> > +
> > +   asym_op->dh.priv_key.data = private;
> > +   asym_op->dh.priv_key.length = priv_size;
> > +   asym_op->dh.pub_key.data = public;
> > +   asym_op->dh.pub_key.length = pub_size;
> > +   asym_op->dh.shared_secret.data = result;
> > +   asym_op->dh.shared_secret.length = result_size;
> > +
> > +   if (process_crypto_request(dev_id, op, &result_op))
> > +           return -1;
> > +
> > +   result_size = asym_op->dh.shared_secret.length;
> > +   debug_hexdump(stdout, str,
> > +                   asym_op->dh.shared_secret.data,
> > +                   result_size);
> > +   return result_size;
> > +}
> > +
> > +static int
> > +test_dh_alice_and_bob_loop(const struct test_dh_group *test_dh_group,
> > +                           uint32_t divisor)
> > +{
> > +   uint8_t alice_private[test_dh_group->priv_ff_size];
> > +   uint8_t bob_private[test_dh_group->priv_ff_size];
> > +   uint8_t pub_key_alice[TEST_DH_MOD_LEN] = { };
> > +   uint8_t pub_key_bob[TEST_DH_MOD_LEN] = { };
> > +   uint8_t shared_secret_alice[TEST_DH_MOD_LEN] = { };
> > +   uint8_t shared_secret_bob[TEST_DH_MOD_LEN] = { };
> > +   struct rte_crypto_asym_xform xform;
> > +   struct rte_crypto_asym_op *asym_op = NULL;
> > +   struct rte_crypto_op *op = NULL;
> > +   void *sess = NULL;
> > +   int alice_pub_len = 0, bob_pub_len = 0,
> > +           alice_shared_len = 0, bob_shared_len = 0;
> > +   int alice_private_size = 0, bob_private_size = 0;
> > +   int ret = 0, status = TEST_SUCCESS;
> > +   uint8_t dev_id = testsuite_params.valid_devs[0];
> > +
> > +   TEST_CRYPTO_ASYM_NEG_RETURN(test_dh_group->p.data[0] == 0,
> > +           "Incorrect DH group.");
> > +
> > +   alice_private_size = bob_private_size =
> > +           test_dh_group->priv_ff_size / divisor;
> > +   /* Generate private keys */
> > +   test_crypto_rand(alice_private_size, alice_private);
> > +   if (alice_private[0] > test_dh_group->p.data[0])
> > +           alice_private[0] = test_dh_group->p.data[0] - 1;
> > +
> > +   debug_hexdump(stdout, "Alice's private", alice_private,
> > +                           alice_private_size);
> > +   test_crypto_rand(bob_private_size, bob_private);
> > +   if (bob_private[0] > test_dh_group->p.data[0])
> > +           bob_private[0] = test_dh_group->p.data[0] - 1;
> > +
> > +   debug_hexdump(stdout, "Bob's private", bob_private,
> > +                           bob_private_size);
> > +
> > +   /* set up crypto op data structure */
> > +   op = rte_crypto_op_alloc(testsuite_params.op_mpool,
> > +           RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
> > +   TEST_CRYPTO_ASYM_NULL_RETURN(op,
> > +           "Failed to allocate asymmetric crypto operation struct");
> > +
> > +   op->sess_type = RTE_CRYPTO_OP_WITH_SESSION;
> > +   asym_op = op->asym;
> > +
> > +   /* Generate public keys of Alice and Bob */
> > +   ret = test_dh_set_session(dev_id, &sess, op, &xform,
> > +           test_dh_group,
> > RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE);
> > +   TEST_CRYPTO_ASYM_NEG_RETURN(ret, "Session creation failed.");
> > +
> > +   alice_pub_len = test_dh_pub_compute("Alice's public key", dev_id,
> > &op,
> > +           alice_private_size, alice_private,
> > +           sizeof(pub_key_alice), pub_key_alice);
> > +   bob_pub_len = test_dh_pub_compute("Bob's public key", dev_id, &op,
> > +           bob_private_size, bob_private,
> > +           sizeof(pub_key_bob), pub_key_bob);
> > +   rte_cryptodev_asym_session_free(dev_id, sess);
> > +
> > +   /* Generate shared secrets */
> > +   ret = test_dh_set_session(dev_id, &sess, op, &xform,
> > +           test_dh_group,
> > RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE);
> > +   TEST_CRYPTO_ASYM_NEG_RETURN(ret, "Session creation failed.");
> > +
> > +   alice_shared_len = test_dh_shared_compute("Alice's shared key",
> > dev_id,
> > +           &op, alice_private_size, alice_private,
> > +           bob_pub_len, pub_key_bob,
> > +           sizeof(shared_secret_alice), shared_secret_alice);
> > +
> > +   bob_shared_len = test_dh_shared_compute("Bob's shared key", dev_id,
> > +           &op, bob_private_size, bob_private,
> > +           alice_pub_len, pub_key_alice,
> > +           sizeof(shared_secret_bob), shared_secret_bob);
> > +
> > +   /* Check results */
> > +   ret = (alice_shared_len == bob_shared_len);
> > +   TEST_CRYPTO_ASYM_NEG_RETURN(!ret,
> > +           "Alice's and Bob's shared secret length do not match.");
> > +   ret = memcmp(shared_secret_alice, shared_secret_bob,
> > +           asym_op->dh.shared_secret.length);
> > +   TEST_CRYPTO_ASYM_NEG_RETURN(ret,
> > +           "Alice's and Bob's shared secret do not match.");
> > +
> > +error_exit:
> > +   if (sess != NULL)
> > +           rte_cryptodev_asym_session_free(dev_id, sess);
> > +   if (op != NULL)
> > +           rte_crypto_op_free(op);
> > +   return status;
> > +}
> > +
> > +static int
> > +test_dh_alice_and_bob(const void *test_data) {
> > +   const struct test_dh_group *test_dh_group = test_data;
> > +   uint32_t i = 0;
> > +   int ret = 1;
> > +
> > +   uint32_t divisor[] = { 64, 32, 16, 4, 2, 1 };
> > +
> > +   for (i = 0; i < RTE_DIM(divisor); i++) {
> > +           if (divisor[i] >= test_dh_group->priv_ff_size)
> > +                   continue;
> > +
> > +           ret = test_dh_alice_and_bob_loop(test_dh_group, divisor[i]);
> > +
> > +           if (ret) {
> > +                   RTE_LOG(ERR, USER1, "line %u FAILED: %s", __LINE__,
> > +                   "Diffie-Hellman error");
> > +                   return TEST_FAILED;
> > +           }
> > +   }
> > +   return ret;
> > +}
> > +
> > +
> >  static struct unit_test_suite cryptodev_openssl_asym_testsuite  = {
> >     .suite_name = "Crypto Device OPENSSL ASYM Unit Test Suite",
> >     .setup = testsuite_setup,
> > @@ -2155,6 +2405,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..8910919461 100644
> > --- a/app/test/test_cryptodev_dh_test_vectors.h
> > +++ b/app/test/test_cryptodev_dh_test_vectors.h
> > @@ -10,11 +10,316 @@
> >  #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;
> >  };
> >
> > +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, 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, 0xAA, 0xC4, 0x2D,
> > +   0xAD, 0x33, 0x17, 0x0D, 0x04, 0x50, 0x7A, 0x33,
> > +   0xA8, 0x55, 0x21, 0xAB, 0xDF, 0x1C, 0xBA, 0x64,
> > +   0xEC, 0xFB, 0x85, 0x04, 0x58, 0xDB, 0xEF, 0x0A,
> > +   0x8A, 0xEA, 0x71, 0x57, 0x5D, 0x06, 0x0C, 0x7D,
> > +   0xB3, 0x97, 0x0F, 0x85, 0xA6, 0xE1, 0xE4, 0xC7,
> > +   0xAB, 0xF5, 0xAE, 0x8C, 0xDB, 0x09, 0x33, 0xD7,
> > +   0x1E, 0x8C, 0x94, 0xE0, 0x4A, 0x25, 0x61, 0x9D,
> > +   0xCE, 0xE3, 0xD2, 0x26, 0x1A, 0xD2, 0xEE, 0x6B,
> > +   0xF1, 0x2F, 0xFA, 0x06, 0xD9, 0x8A, 0x08, 0x64,
> > +   0xD8, 0x76, 0x02, 0x73, 0x3E, 0xC8, 0x6A, 0x64,
> > +   0x52, 0x1F, 0x2B, 0x18, 0x17, 0x7B, 0x20, 0x0C,
> > +   0xBB, 0xE1, 0x17, 0x57, 0x7A, 0x61, 0x5D, 0x6C,
> > +   0x77, 0x09, 0x88, 0xC0, 0xBA, 0xD9, 0x46, 0xE2,
> > +   0x08, 0xE2, 0x4F, 0xA0, 0x74, 0xE5, 0xAB, 0x31,
> > +   0x43, 0xDB, 0x5B, 0xFC, 0xE0, 0xFD, 0x10, 0x8E,
> > +   0x4B, 0x82, 0xD1, 0x20, 0xA9, 0x3A, 0xD2, 0xCA,
> > +   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, };
> > +
> > +static uint8_t test_dh_ikev2group16_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, 0xAA, 0xC4, 0x2D,
> > +   0xAD, 0x33, 0x17, 0x0D, 0x04, 0x50, 0x7A, 0x33,
> > +   0xA8, 0x55, 0x21, 0xAB, 0xDF, 0x1C, 0xBA, 0x64,
> > +   0xEC, 0xFB, 0x85, 0x04, 0x58, 0xDB, 0xEF, 0x0A,
> > +   0x8A, 0xEA, 0x71, 0x57, 0x5D, 0x06, 0x0C, 0x7D,
> > +   0xB3, 0x97, 0x0F, 0x85, 0xA6, 0xE1, 0xE4, 0xC7,
> > +   0xAB, 0xF5, 0xAE, 0x8C, 0xDB, 0x09, 0x33, 0xD7,
> > +   0x1E, 0x8C, 0x94, 0xE0, 0x4A, 0x25, 0x61, 0x9D,
> > +   0xCE, 0xE3, 0xD2, 0x26, 0x1A, 0xD2, 0xEE, 0x6B,
> > +   0xF1, 0x2F, 0xFA, 0x06, 0xD9, 0x8A, 0x08, 0x64,
> > +   0xD8, 0x76, 0x02, 0x73, 0x3E, 0xC8, 0x6A, 0x64,
> > +   0x52, 0x1F, 0x2B, 0x18, 0x17, 0x7B, 0x20, 0x0C,
> > +   0xBB, 0xE1, 0x17, 0x57, 0x7A, 0x61, 0x5D, 0x6C,
> > +   0x77, 0x09, 0x88, 0xC0, 0xBA, 0xD9, 0x46, 0xE2,
> > +   0x08, 0xE2, 0x4F, 0xA0, 0x74, 0xE5, 0xAB, 0x31,
> > +   0x43, 0xDB, 0x5B, 0xFC, 0xE0, 0xFD, 0x10, 0x8E,
> > +   0x4B, 0x82, 0xD1, 0x20, 0xA9, 0x21, 0x08, 0x01,
> > +   0x1A, 0x72, 0x3C, 0x12, 0xA7, 0x87, 0xE6, 0xD7,
> > +   0x88, 0x71, 0x9A, 0x10, 0xBD, 0xBA, 0x5B, 0x26,
> > +   0x99, 0xC3, 0x27, 0x18, 0x6A, 0xF4, 0xE2, 0x3C,
> > +   0x1A, 0x94, 0x68, 0x34, 0xB6, 0x15, 0x0B, 0xDA,
> > +   0x25, 0x83, 0xE9, 0xCA, 0x2A, 0xD4, 0x4C, 0xE8,
> > +   0xDB, 0xBB, 0xC2, 0xDB, 0x04, 0xDE, 0x8E, 0xF9,
> > +   0x2E, 0x8E, 0xFC, 0x14, 0x1F, 0xBE, 0xCA, 0xA6,
> > +   0x28, 0x7C, 0x59, 0x47, 0x4E, 0x6B, 0xC0, 0x5D,
> > +   0x99, 0xB2, 0x96, 0x4F, 0xA0, 0x90, 0xC3, 0xA2,
> > +   0x23, 0x3B, 0xA1, 0x86, 0x51, 0x5B, 0xE7, 0xED,
> > +   0x1F, 0x61, 0x29, 0x70, 0xCE, 0xE2, 0xD7, 0xAF,
> > +   0xB8, 0x1B, 0xDD, 0x76, 0x21, 0x70, 0x48, 0x1C,
> > +   0xD0, 0x06, 0x91, 0x27, 0xD5, 0xB0, 0x5A, 0xA9,
> > +   0x93, 0xB4, 0xEA, 0x98, 0x8D, 0x8F, 0xDD, 0xC1,
> > +   0x86, 0xFF, 0xB7, 0xDC, 0x90, 0xA6, 0xC0, 0x8F,
> > +   0x4D, 0xF4, 0x35, 0xC9, 0x34, 0x06, 0x31, 0x99,
> > +   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, };
> > +
> > +static uint8_t test_dh_ikev2group24_p[] = {
> > +   0x87, 0xA8, 0xE6, 0x1D, 0xB4, 0xB6, 0x66, 0x3C,
> > +   0xFF, 0xBB, 0xD1, 0x9C, 0x65, 0x19, 0x59, 0x99,
> > +   0x8C, 0xEE, 0xF6, 0x08, 0x66, 0x0D, 0xD0, 0xF2,
> > +   0x5D, 0x2C, 0xEE, 0xD4, 0x43, 0x5E, 0x3B, 0x00,
> > +   0xE0, 0x0D, 0xF8, 0xF1, 0xD6, 0x19, 0x57, 0xD4,
> > +   0xFA, 0xF7, 0xDF, 0x45, 0x61, 0xB2, 0xAA, 0x30,
> > +   0x16, 0xC3, 0xD9, 0x11, 0x34, 0x09, 0x6F, 0xAA,
> > +   0x3B, 0xF4, 0x29, 0x6D, 0x83, 0x0E, 0x9A, 0x7C,
> > +   0x20, 0x9E, 0x0C, 0x64, 0x97, 0x51, 0x7A, 0xBD,
> > +   0x5A, 0x8A, 0x9D, 0x30, 0x6B, 0xCF, 0x67, 0xED,
> > +   0x91, 0xF9, 0xE6, 0x72, 0x5B, 0x47, 0x58, 0xC0,
> > +   0x22, 0xE0, 0xB1, 0xEF, 0x42, 0x75, 0xBF, 0x7B,
> > +   0x6C, 0x5B, 0xFC, 0x11, 0xD4, 0x5F, 0x90, 0x88,
> > +   0xB9, 0x41, 0xF5, 0x4E, 0xB1, 0xE5, 0x9B, 0xB8,
> > +   0xBC, 0x39, 0xA0, 0xBF, 0x12, 0x30, 0x7F, 0x5C,
> > +   0x4F, 0xDB, 0x70, 0xC5, 0x81, 0xB2, 0x3F, 0x76,
> > +   0xB6, 0x3A, 0xCA, 0xE1, 0xCA, 0xA6, 0xB7, 0x90,
> > +   0x2D, 0x52, 0x52, 0x67, 0x35, 0x48, 0x8A, 0x0E,
> > +   0xF1, 0x3C, 0x6D, 0x9A, 0x51, 0xBF, 0xA4, 0xAB,
> > +   0x3A, 0xD8, 0x34, 0x77, 0x96, 0x52, 0x4D, 0x8E,
> > +   0xF6, 0xA1, 0x67, 0xB5, 0xA4, 0x18, 0x25, 0xD9,
> > +   0x67, 0xE1, 0x44, 0xE5, 0x14, 0x05, 0x64, 0x25,
> > +   0x1C, 0xCA, 0xCB, 0x83, 0xE6, 0xB4, 0x86, 0xF6,
> > +   0xB3, 0xCA, 0x3F, 0x79, 0x71, 0x50, 0x60, 0x26,
> > +   0xC0, 0xB8, 0x57, 0xF6, 0x89, 0x96, 0x28, 0x56,
> > +   0xDE, 0xD4, 0x01, 0x0A, 0xBD, 0x0B, 0xE6, 0x21,
> > +   0xC3, 0xA3, 0x96, 0x0A, 0x54, 0xE7, 0x10, 0xC3,
> > +   0x75, 0xF2, 0x63, 0x75, 0xD7, 0x01, 0x41, 0x03,
> > +   0xA4, 0xB5, 0x43, 0x30, 0xC1, 0x98, 0xAF, 0x12,
> > +   0x61, 0x16, 0xD2, 0x27, 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, };
> > +
> > +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,
> > +};
> > +
> > +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,
> > +};
> > +
> > +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,
> > +};
> > +
> > +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,
> > +};
> > +
> >  uint8_t dh_priv[] = {
> >     0x46, 0x3c, 0x7b, 0x43, 0xd1, 0xb8, 0xd4, 0x7a,
> >     0x56, 0x28, 0x85, 0x79, 0xcc, 0xd8, 0x90, 0x03,
> > --
> > 2.13.6

Reply via email to