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

Function MD5_HMAC_create_op

dpdk/app/test/test_cryptodev.c:12994–13029  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12992}
12993
12994static int MD5_HMAC_create_op(struct crypto_unittest_params *ut_params,
12995 const struct HMAC_MD5_vector *test_case,
12996 uint8_t **plaintext)
12997{
12998 uint16_t plaintext_pad_len;
12999
13000 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
13001
13002 plaintext_pad_len = RTE_ALIGN_CEIL(test_case->plaintext.len,
13003 16);
13004
13005 *plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
13006 plaintext_pad_len);
13007 memcpy(*plaintext, test_case->plaintext.data,
13008 test_case->plaintext.len);
13009
13010 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
13011 ut_params->ibuf, MD5_DIGEST_LEN);
13012 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
13013 "no room to append digest");
13014 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
13015 ut_params->ibuf, plaintext_pad_len);
13016
13017 if (ut_params->auth_xform.auth.op == RTE_CRYPTO_AUTH_OP_VERIFY) {
13018 rte_memcpy(sym_op->auth.digest.data, test_case->auth_tag.data,
13019 test_case->auth_tag.len);
13020 }
13021
13022 sym_op->auth.data.offset = 0;
13023 sym_op->auth.data.length = test_case->plaintext.len;
13024
13025 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
13026 ut_params->op->sym->m_src = ut_params->ibuf;
13027
13028 return 0;
13029}
13030
13031static int
13032test_MD5_HMAC_generate(const struct HMAC_MD5_vector *test_case)

Callers 2

test_MD5_HMAC_generateFunction · 0.85
test_MD5_HMAC_verifyFunction · 0.85

Calls 4

rte_pktmbuf_appendFunction · 0.85
memcpyFunction · 0.50
rte_memcpyFunction · 0.50

Tested by

no test coverage detected