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

Function test_authenticated_encrypt_with_esn

dpdk/app/test/test_cryptodev.c:15181–15312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15179}
15180
15181static int
15182test_authenticated_encrypt_with_esn(
15183 struct crypto_testsuite_params *ts_params,
15184 struct crypto_unittest_params *ut_params,
15185 const struct test_crypto_vector *reference)
15186{
15187 int retval;
15188
15189 uint8_t *authciphertext, *plaintext, *auth_tag;
15190 uint16_t plaintext_pad_len;
15191 uint8_t cipher_key[reference->cipher_key.len + 1];
15192 uint8_t auth_key[reference->auth_key.len + 1];
15193 struct rte_cryptodev_info dev_info;
15194
15195 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
15196 uint64_t feat_flags = dev_info.feature_flags;
15197
15198 if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) &&
15199 (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) {
15200 printf("Device doesn't support RAW data-path APIs.\n");
15201 return TEST_SKIPPED;
15202 }
15203
15204 /* Verify the capabilities */
15205 struct rte_cryptodev_sym_capability_idx cap_idx;
15206 cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
15207 cap_idx.algo.auth = reference->auth_algo;
15208 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
15209 &cap_idx) == NULL)
15210 return TEST_SKIPPED;
15211 cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
15212 cap_idx.algo.cipher = reference->crypto_algo;
15213 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
15214 &cap_idx) == NULL)
15215 return TEST_SKIPPED;
15216
15217 /* Create session */
15218 memcpy(cipher_key, reference->cipher_key.data,
15219 reference->cipher_key.len);
15220 memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
15221
15222 /* Setup Cipher Parameters */
15223 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
15224 ut_params->cipher_xform.cipher.algo = reference->crypto_algo;
15225 ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
15226 ut_params->cipher_xform.cipher.key.data = cipher_key;
15227 ut_params->cipher_xform.cipher.key.length = reference->cipher_key.len;
15228 ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
15229 ut_params->cipher_xform.cipher.iv.length = reference->iv.len;
15230
15231 ut_params->cipher_xform.next = &ut_params->auth_xform;
15232
15233 /* Setup Authentication Parameters */
15234 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
15235 ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
15236 ut_params->auth_xform.auth.algo = reference->auth_algo;
15237 ut_params->auth_xform.auth.key.length = reference->auth_key.len;
15238 ut_params->auth_xform.auth.key.data = auth_key;

Calls 14

rte_cryptodev_info_getFunction · 0.85
rte_pktmbuf_allocFunction · 0.85
memsetFunction · 0.85
rte_pktmbuf_tailroomFunction · 0.85
rte_pktmbuf_appendFunction · 0.85
process_sym_raw_dp_opFunction · 0.85
debug_hexdumpFunction · 0.85
process_crypto_requestFunction · 0.70

Tested by

no test coverage detected