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

Function test_authenticated_encryption_sessionless

dpdk/app/test/test_cryptodev.c:12495–12589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12493}
12494
12495static int
12496test_authenticated_encryption_sessionless(
12497 const struct aead_test_data *tdata)
12498{
12499 struct crypto_testsuite_params *ts_params = &testsuite_params;
12500 struct crypto_unittest_params *ut_params = &unittest_params;
12501
12502 int retval;
12503 uint8_t *ciphertext, *auth_tag;
12504 uint16_t plaintext_pad_len;
12505 uint8_t key[tdata->key.len + 1];
12506 struct rte_cryptodev_info dev_info;
12507
12508 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
12509 uint64_t feat_flags = dev_info.feature_flags;
12510
12511 if (!(feat_flags & RTE_CRYPTODEV_FF_SYM_SESSIONLESS)) {
12512 printf("Device doesn't support Sessionless ops.\n");
12513 return TEST_SKIPPED;
12514 }
12515
12516 /* not supported with CPU crypto */
12517 if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
12518 return TEST_SKIPPED;
12519
12520 /* Verify the capabilities */
12521 struct rte_cryptodev_sym_capability_idx cap_idx;
12522 cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
12523 cap_idx.algo.aead = tdata->algo;
12524 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
12525 &cap_idx) == NULL)
12526 return TEST_SKIPPED;
12527
12528 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
12529
12530 /* clear mbuf payload */
12531 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
12532 rte_pktmbuf_tailroom(ut_params->ibuf));
12533
12534 /* Create AEAD operation */
12535 retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata);
12536 if (retval < 0)
12537 return retval;
12538
12539 /* Create GCM xform */
12540 memcpy(key, tdata->key.data, tdata->key.len);
12541 retval = create_aead_xform(ut_params->op,
12542 tdata->algo,
12543 RTE_CRYPTO_AEAD_OP_ENCRYPT,
12544 key, tdata->key.len,
12545 tdata->aad.len, tdata->auth_tag.len,
12546 tdata->iv.len);
12547 if (retval < 0)
12548 return retval;
12549
12550 ut_params->op->sym->m_src = ut_params->ibuf;
12551
12552 TEST_ASSERT_EQUAL(ut_params->op->sess_type,

Calls 11

rte_cryptodev_info_getFunction · 0.85
rte_pktmbuf_allocFunction · 0.85
memsetFunction · 0.85
rte_pktmbuf_tailroomFunction · 0.85
create_aead_operationFunction · 0.85
create_aead_xformFunction · 0.85
debug_hexdumpFunction · 0.85
process_crypto_requestFunction · 0.70
printfFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected