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

Function test_kasumi_decryption

dpdk/app/test/test_cryptodev.c:4158–4250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4156}
4157
4158static int
4159test_kasumi_decryption(const struct kasumi_test_data *tdata)
4160{
4161 struct crypto_testsuite_params *ts_params = &testsuite_params;
4162 struct crypto_unittest_params *ut_params = &unittest_params;
4163
4164 int retval;
4165 uint8_t *ciphertext, *plaintext;
4166 unsigned ciphertext_pad_len;
4167 unsigned ciphertext_len;
4168 struct rte_cryptodev_info dev_info;
4169
4170 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
4171 uint64_t feat_flags = dev_info.feature_flags;
4172
4173 if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) &&
4174 (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) {
4175 printf("Device doesn't support RAW data-path APIs.\n");
4176 return TEST_SKIPPED;
4177 }
4178
4179 if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
4180 return TEST_SKIPPED;
4181
4182 /* Verify the capabilities */
4183 struct rte_cryptodev_sym_capability_idx cap_idx;
4184 cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
4185 cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
4186 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
4187 &cap_idx) == NULL)
4188 return TEST_SKIPPED;
4189
4190 /* Create KASUMI session */
4191 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
4192 RTE_CRYPTO_CIPHER_OP_DECRYPT,
4193 RTE_CRYPTO_CIPHER_KASUMI_F8,
4194 tdata->key.data, tdata->key.len,
4195 tdata->cipher_iv.len);
4196 if (retval < 0)
4197 return retval;
4198
4199 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4200
4201 /* Clear mbuf payload */
4202 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4203 rte_pktmbuf_tailroom(ut_params->ibuf));
4204
4205 ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
4206 /* Append data which is padded to a multiple */
4207 /* of the algorithms block size */
4208 ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 8);
4209 ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4210 ciphertext_pad_len);
4211 memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
4212
4213 debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
4214
4215 /* 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