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

Function test_zuc_cipher_auth

dpdk/app/test/test_cryptodev.c:4905–5009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4903}
4904
4905static int
4906test_zuc_cipher_auth(const struct wireless_test_data *tdata)
4907{
4908 struct crypto_testsuite_params *ts_params = &testsuite_params;
4909 struct crypto_unittest_params *ut_params = &unittest_params;
4910
4911 int retval;
4912
4913 uint8_t *plaintext, *ciphertext;
4914 unsigned int plaintext_pad_len;
4915 unsigned int plaintext_len;
4916
4917 struct rte_cryptodev_info dev_info;
4918
4919 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
4920 uint64_t feat_flags = dev_info.feature_flags;
4921
4922 if (!(feat_flags & RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA) &&
4923 ((tdata->validAuthLenInBits.len % 8 != 0) ||
4924 (tdata->validDataLenInBits.len % 8 != 0))) {
4925 printf("Device doesn't support NON-Byte Aligned Data.\n");
4926 return TEST_SKIPPED;
4927 }
4928
4929 if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) &&
4930 (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) {
4931 printf("Device doesn't support RAW data-path APIs.\n");
4932 return TEST_SKIPPED;
4933 }
4934
4935 if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
4936 return TEST_SKIPPED;
4937
4938 /* Check if device supports ZUC EEA3 */
4939 if (check_cipher_capability(ts_params, RTE_CRYPTO_CIPHER_ZUC_EEA3,
4940 tdata->key.len, tdata->cipher_iv.len) < 0)
4941 return TEST_SKIPPED;
4942
4943 /* Check if device supports ZUC EIA3 */
4944 if (check_auth_capability(ts_params, RTE_CRYPTO_AUTH_ZUC_EIA3,
4945 tdata->key.len, tdata->auth_iv.len,
4946 tdata->digest.len) < 0)
4947 return TEST_SKIPPED;
4948
4949 /* Create ZUC session */
4950 retval = create_zuc_cipher_auth_encrypt_generate_session(
4951 ts_params->valid_devs[0],
4952 tdata);
4953 if (retval != 0)
4954 return retval;
4955 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4956
4957 /* clear mbuf payload */
4958 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4959 rte_pktmbuf_tailroom(ut_params->ibuf));
4960
4961 plaintext_len = ceil_byte_length(tdata->plaintext.len);
4962 /* Append data which is padded to a multiple of */

Calls 15

rte_cryptodev_info_getFunction · 0.85
check_cipher_capabilityFunction · 0.85
check_auth_capabilityFunction · 0.85
rte_pktmbuf_allocFunction · 0.85
memsetFunction · 0.85
rte_pktmbuf_tailroomFunction · 0.85
ceil_byte_lengthFunction · 0.85
rte_pktmbuf_appendFunction · 0.85
debug_hexdumpFunction · 0.85
process_sym_raw_dp_opFunction · 0.85

Tested by

no test coverage detected