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

Function create_wireless_cipher_auth_session

dpdk/app/test/test_cryptodev.c:2724–2780  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2722}
2723
2724static int
2725create_wireless_cipher_auth_session(uint8_t dev_id,
2726 enum rte_crypto_cipher_operation cipher_op,
2727 enum rte_crypto_auth_operation auth_op,
2728 enum rte_crypto_auth_algorithm auth_algo,
2729 enum rte_crypto_cipher_algorithm cipher_algo,
2730 const struct wireless_test_data *tdata)
2731{
2732 const uint8_t key_len = tdata->key.len;
2733 uint8_t cipher_auth_key[key_len];
2734
2735 struct crypto_testsuite_params *ts_params = &testsuite_params;
2736 struct crypto_unittest_params *ut_params = &unittest_params;
2737 const uint8_t *key = tdata->key.data;
2738 const uint8_t auth_len = tdata->digest.len;
2739 uint8_t cipher_iv_len = tdata->cipher_iv.len;
2740 uint8_t auth_iv_len = tdata->auth_iv.len;
2741
2742 memcpy(cipher_auth_key, key, key_len);
2743
2744 /* Setup Authentication Parameters */
2745 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2746 ut_params->auth_xform.next = NULL;
2747
2748 ut_params->auth_xform.auth.op = auth_op;
2749 ut_params->auth_xform.auth.algo = auth_algo;
2750 ut_params->auth_xform.auth.key.length = key_len;
2751 /* Hash key = cipher key */
2752 ut_params->auth_xform.auth.key.data = cipher_auth_key;
2753 ut_params->auth_xform.auth.digest_length = auth_len;
2754 /* Auth IV will be after cipher IV */
2755 ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
2756 ut_params->auth_xform.auth.iv.length = auth_iv_len;
2757
2758 /* Setup Cipher Parameters */
2759 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2760 ut_params->cipher_xform.next = &ut_params->auth_xform;
2761
2762 ut_params->cipher_xform.cipher.algo = cipher_algo;
2763 ut_params->cipher_xform.cipher.op = cipher_op;
2764 ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
2765 ut_params->cipher_xform.cipher.key.length = key_len;
2766 ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
2767 ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
2768
2769
2770 debug_hexdump(stdout, "key:", key, key_len);
2771
2772 /* Create Crypto session*/
2773 ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
2774 &ut_params->cipher_xform, ts_params->session_mpool);
2775 if (ut_params->sess == NULL && rte_errno == ENOTSUP)
2776 return TEST_SKIPPED;
2777
2778 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
2779 return 0;
2780}
2781

Calls 3

debug_hexdumpFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected