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

Function test_AES_GMAC_authentication

dpdk/app/test/test_cryptodev.c:14030–14139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14028}
14029
14030static int
14031test_AES_GMAC_authentication(const struct gmac_test_data *tdata)
14032{
14033 struct crypto_testsuite_params *ts_params = &testsuite_params;
14034 struct crypto_unittest_params *ut_params = &unittest_params;
14035 struct rte_cryptodev_info dev_info;
14036
14037 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
14038 uint64_t feat_flags = dev_info.feature_flags;
14039
14040 if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) &&
14041 (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) {
14042 printf("Device doesn't support RAW data-path APIs.\n");
14043 return TEST_SKIPPED;
14044 }
14045
14046 int retval;
14047
14048 uint8_t *auth_tag, *plaintext;
14049 uint16_t plaintext_pad_len;
14050
14051 TEST_ASSERT_NOT_EQUAL(tdata->gmac_tag.len, 0,
14052 "No GMAC length in the source data");
14053
14054 /* Verify the capabilities */
14055 struct rte_cryptodev_sym_capability_idx cap_idx;
14056 cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
14057 cap_idx.algo.auth = RTE_CRYPTO_AUTH_AES_GMAC;
14058 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
14059 &cap_idx) == NULL)
14060 return TEST_SKIPPED;
14061
14062 retval = create_gmac_session(ts_params->valid_devs[0],
14063 tdata, RTE_CRYPTO_AUTH_OP_GENERATE);
14064
14065 if (retval == TEST_SKIPPED)
14066 return TEST_SKIPPED;
14067 if (retval < 0)
14068 return retval;
14069
14070 if (tdata->plaintext.len > MBUF_SIZE)
14071 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool);
14072 else
14073 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
14074 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
14075 "Failed to allocate input buffer in mempool");
14076
14077 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
14078 rte_pktmbuf_tailroom(ut_params->ibuf));
14079
14080 plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
14081 /*
14082 * Runtime generate the large plain text instead of use hard code
14083 * plain text vector. It is done to avoid create huge source file
14084 * with the test vector.
14085 */
14086 if (tdata->plaintext.len == GMAC_LARGE_PLAINTEXT_LENGTH)
14087 generate_gmac_large_plaintext(tdata->plaintext.data);

Calls 15

rte_cryptodev_info_getFunction · 0.85
create_gmac_sessionFunction · 0.85
rte_pktmbuf_allocFunction · 0.85
memsetFunction · 0.85
rte_pktmbuf_tailroomFunction · 0.85
rte_pktmbuf_appendFunction · 0.85
debug_hexdumpFunction · 0.85
create_gmac_operationFunction · 0.85

Tested by

no test coverage detected