MCPcopy Create free account
hub / github.com/F-Stack/f-stack / create_cipher_auth_operation

Function create_cipher_auth_operation

dpdk/app/test/test_cryptodev.c:14832–14883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14830}
14831
14832static int
14833create_cipher_auth_operation(struct crypto_testsuite_params *ts_params,
14834 struct crypto_unittest_params *ut_params,
14835 const struct test_crypto_vector *reference,
14836 unsigned int auth_generate)
14837{
14838 /* Generate Crypto op data structure */
14839 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
14840 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
14841 TEST_ASSERT_NOT_NULL(ut_params->op,
14842 "Failed to allocate pktmbuf offload");
14843
14844 /* Set crypto operation data parameters */
14845 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
14846
14847 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
14848
14849 /* set crypto operation source mbuf */
14850 sym_op->m_src = ut_params->ibuf;
14851
14852 /* digest */
14853 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
14854 ut_params->ibuf, reference->digest.len);
14855
14856 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
14857 "no room to append auth tag");
14858
14859 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
14860 ut_params->ibuf, reference->ciphertext.len);
14861
14862 if (auth_generate)
14863 memset(sym_op->auth.digest.data, 0, reference->digest.len);
14864 else
14865 memcpy(sym_op->auth.digest.data,
14866 reference->digest.data,
14867 reference->digest.len);
14868
14869 debug_hexdump(stdout, "digest:",
14870 sym_op->auth.digest.data,
14871 reference->digest.len);
14872
14873 rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
14874 reference->iv.data, reference->iv.len);
14875
14876 sym_op->cipher.data.length = reference->cipher_len;
14877 sym_op->cipher.data.offset = reference->cipher_offset;
14878
14879 sym_op->auth.data.length = reference->plaintext.len;
14880 sym_op->auth.data.offset = reference->auth_offset;
14881
14882 return 0;
14883}
14884
14885static int
14886create_auth_verify_operation(struct crypto_testsuite_params *ts_params,

Calls 7

rte_crypto_op_allocFunction · 0.85
rte_pktmbuf_appendFunction · 0.85
memsetFunction · 0.85
debug_hexdumpFunction · 0.85
memcpyFunction · 0.50
rte_memcpyFunction · 0.50

Tested by

no test coverage detected