-create_snow3g_cipher_session(uint8_t dev_id,
- enum rte_crypto_cipher_operation op,
- const uint8_t *key, const uint8_t key_len)
-{
- uint8_t cipher_key[key_len];
-
- struct crypto_unittest_params *ut_params = &unittest_params;
-
- memcpy(cipher_key, key, key_len);
-
- /* Setup Cipher Parameters */
- ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- ut_params->cipher_xform.next = NULL;
-
- ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
- ut_params->cipher_xform.cipher.op = op;
- ut_params->cipher_xform.cipher.key.data = cipher_key;
- ut_params->cipher_xform.cipher.key.length = key_len;
-
- TEST_HEXDUMP(stdout, "key:", key, key_len);
-
- /* Create Crypto session */
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->
- cipher_xform);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- return 0;
-}
-
-static int
-create_snow3g_cipher_operation(const uint8_t *iv, const unsigned iv_len,
- const unsigned cipher_len,
- const unsigned cipher_offset)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned iv_pad_len = 0;
-
- /* Generate Crypto op data structure */
- ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- TEST_ASSERT_NOT_NULL(ut_params->op,
- "Failed to allocate pktmbuf offload");
-
- /* Set crypto operation data parameters */
- rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
-
- struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
-
- /* set crypto operation source mbuf */
- sym_op->m_src = ut_params->ibuf;
-
- /* iv */
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf
- , iv_pad_len);
-
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
-
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = iv_pad_len;
-
- rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
- sym_op->cipher.data.length = cipher_len;
- sym_op->cipher.data.offset = cipher_offset;
- return 0;
-}
-
-static int
-create_snow3g_cipher_operation_oop(const uint8_t *iv, const uint8_t iv_len,
- const unsigned cipher_len,
- const unsigned cipher_offset)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned iv_pad_len = 0;
-
- /* Generate Crypto op data structure */
- ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- TEST_ASSERT_NOT_NULL(ut_params->op,
- "Failed to allocate pktmbuf offload");
-
- /* Set crypto operation data parameters */
- rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
-
- struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
-
- /* set crypto operation source mbuf */
- sym_op->m_src = ut_params->ibuf;
- sym_op->m_dst = ut_params->obuf;
-
- /* iv */
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf
- , iv_pad_len);
-
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
-
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = iv_pad_len;
-
- rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
- sym_op->cipher.data.length = cipher_len;
- sym_op->cipher.data.offset = cipher_offset;
- return 0;
-}
-
-static int
-create_snow3g_cipher_auth_session(uint8_t dev_id,