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

Function test_multi_session

dpdk/app/test/test_cryptodev.c:13191–13286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13189}
13190
13191static int
13192test_multi_session(void)
13193{
13194 struct crypto_testsuite_params *ts_params = &testsuite_params;
13195 struct crypto_unittest_params *ut_params = &unittest_params;
13196 struct rte_cryptodev_info dev_info;
13197 int i, nb_sess, ret = TEST_SUCCESS;
13198 void **sessions;
13199
13200 /* Verify the capabilities */
13201 struct rte_cryptodev_sym_capability_idx cap_idx;
13202 cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
13203 cap_idx.algo.auth = RTE_CRYPTO_AUTH_SHA512_HMAC;
13204 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
13205 &cap_idx) == NULL)
13206 return TEST_SKIPPED;
13207 cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
13208 cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_AES_CBC;
13209 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
13210 &cap_idx) == NULL)
13211 return TEST_SKIPPED;
13212
13213 test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(ut_params,
13214 aes_cbc_key, hmac_sha512_key);
13215
13216
13217 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
13218
13219 sessions = rte_malloc(NULL,
13220 sizeof(void *) *
13221 (MAX_NB_SESSIONS + 1), 0);
13222
13223 /* Create multiple crypto sessions*/
13224 for (i = 0; i < MAX_NB_SESSIONS; i++) {
13225 sessions[i] = rte_cryptodev_sym_session_create(
13226 ts_params->valid_devs[0], &ut_params->auth_xform,
13227 ts_params->session_mpool);
13228 if (sessions[i] == NULL && rte_errno == ENOTSUP) {
13229 nb_sess = i;
13230 ret = TEST_SKIPPED;
13231 break;
13232 }
13233
13234 TEST_ASSERT_NOT_NULL(sessions[i],
13235 "Session creation failed at session number %u",
13236 i);
13237
13238 /* Attempt to send a request on each session */
13239 ret = test_AES_CBC_HMAC_SHA512_decrypt_perform(
13240 sessions[i],
13241 ut_params,
13242 ts_params,
13243 catch_22_quote_2_512_bytes_AES_CBC_ciphertext,
13244 catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest,
13245 aes_cbc_iv);
13246
13247 /* free crypto operation structure */
13248 rte_crypto_op_free(ut_params->op);

Callers

nothing calls this directly

Tested by

no test coverage detected