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

Function create_gmac_operation

dpdk/app/test/test_cryptodev.c:13901–13949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13899}
13900
13901static int
13902create_gmac_operation(enum rte_crypto_auth_operation op,
13903 const struct gmac_test_data *tdata)
13904{
13905 struct crypto_testsuite_params *ts_params = &testsuite_params;
13906 struct crypto_unittest_params *ut_params = &unittest_params;
13907 struct rte_crypto_sym_op *sym_op;
13908
13909 uint32_t plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
13910
13911 /* Generate Crypto op data structure */
13912 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
13913 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
13914 TEST_ASSERT_NOT_NULL(ut_params->op,
13915 "Failed to allocate symmetric crypto operation struct");
13916
13917 sym_op = ut_params->op->sym;
13918
13919 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
13920 ut_params->ibuf, tdata->gmac_tag.len);
13921 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
13922 "no room to append digest");
13923
13924 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
13925 ut_params->ibuf, plaintext_pad_len);
13926
13927 if (op == RTE_CRYPTO_AUTH_OP_VERIFY) {
13928 rte_memcpy(sym_op->auth.digest.data, tdata->gmac_tag.data,
13929 tdata->gmac_tag.len);
13930 debug_hexdump(stdout, "digest:",
13931 sym_op->auth.digest.data,
13932 tdata->gmac_tag.len);
13933 }
13934
13935 uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
13936 uint8_t *, IV_OFFSET);
13937
13938 rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len);
13939
13940 debug_hexdump(stdout, "iv:", iv_ptr, tdata->iv.len);
13941
13942 sym_op->cipher.data.length = 0;
13943 sym_op->cipher.data.offset = 0;
13944
13945 sym_op->auth.data.offset = 0;
13946 sym_op->auth.data.length = tdata->plaintext.len;
13947
13948 return 0;
13949}
13950
13951static int
13952create_gmac_operation_sgl(enum rte_crypto_auth_operation op,

Calls 4

rte_crypto_op_allocFunction · 0.85
rte_pktmbuf_appendFunction · 0.85
debug_hexdumpFunction · 0.85
rte_memcpyFunction · 0.50

Tested by

no test coverage detected