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

Function test_kasumi_encryption

dpdk/app/test/test_cryptodev.c:3696–3788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3694}
3695
3696static int
3697test_kasumi_encryption(const struct kasumi_test_data *tdata)
3698{
3699 struct crypto_testsuite_params *ts_params = &testsuite_params;
3700 struct crypto_unittest_params *ut_params = &unittest_params;
3701
3702 int retval;
3703 uint8_t *plaintext, *ciphertext;
3704 unsigned plaintext_pad_len;
3705 unsigned plaintext_len;
3706 struct rte_cryptodev_info dev_info;
3707
3708 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
3709 uint64_t feat_flags = dev_info.feature_flags;
3710
3711 if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) &&
3712 (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) {
3713 printf("Device doesn't support RAW data-path APIs.\n");
3714 return TEST_SKIPPED;
3715 }
3716
3717 if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
3718 return TEST_SKIPPED;
3719
3720 /* Verify the capabilities */
3721 struct rte_cryptodev_sym_capability_idx cap_idx;
3722 cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
3723 cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
3724 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
3725 &cap_idx) == NULL)
3726 return TEST_SKIPPED;
3727
3728 /* Create KASUMI session */
3729 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3730 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
3731 RTE_CRYPTO_CIPHER_KASUMI_F8,
3732 tdata->key.data, tdata->key.len,
3733 tdata->cipher_iv.len);
3734 if (retval < 0)
3735 return retval;
3736
3737 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3738
3739 /* Clear mbuf payload */
3740 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3741 rte_pktmbuf_tailroom(ut_params->ibuf));
3742
3743 plaintext_len = ceil_byte_length(tdata->plaintext.len);
3744 /* Append data which is padded to a multiple */
3745 /* of the algorithms block size */
3746 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
3747 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
3748 plaintext_pad_len);
3749 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
3750
3751 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
3752
3753 /* Create KASUMI operation */

Calls 14

rte_cryptodev_info_getFunction · 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
process_crypto_requestFunction · 0.70

Tested by

no test coverage detected