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

Function test_kasumi_decryption_oop

dpdk/app/test/test_cryptodev.c:4075–4156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4073
4074
4075static int
4076test_kasumi_decryption_oop(const struct kasumi_test_data *tdata)
4077{
4078 struct crypto_testsuite_params *ts_params = &testsuite_params;
4079 struct crypto_unittest_params *ut_params = &unittest_params;
4080
4081 int retval;
4082 uint8_t *ciphertext, *plaintext;
4083 unsigned ciphertext_pad_len;
4084 unsigned ciphertext_len;
4085
4086 /* Verify the capabilities */
4087 struct rte_cryptodev_sym_capability_idx cap_idx;
4088 cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
4089 cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
4090 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
4091 &cap_idx) == NULL)
4092 return TEST_SKIPPED;
4093
4094 if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
4095 return TEST_SKIPPED;
4096
4097 if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
4098 return TEST_SKIPPED;
4099
4100 /* Create KASUMI session */
4101 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
4102 RTE_CRYPTO_CIPHER_OP_DECRYPT,
4103 RTE_CRYPTO_CIPHER_KASUMI_F8,
4104 tdata->key.data, tdata->key.len,
4105 tdata->cipher_iv.len);
4106 if (retval < 0)
4107 return retval;
4108
4109 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4110 ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4111
4112 /* Clear mbuf payload */
4113 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4114 rte_pktmbuf_tailroom(ut_params->ibuf));
4115
4116 ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
4117 /* Append data which is padded to a multiple */
4118 /* of the algorithms block size */
4119 ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 8);
4120 ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4121 ciphertext_pad_len);
4122 rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len);
4123 memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
4124
4125 debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
4126
4127 /* Create KASUMI operation */
4128 retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
4129 tdata->cipher_iv.len,
4130 RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
4131 tdata->validCipherOffsetInBits.len);
4132 if (retval < 0)

Calls 11

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_crypto_requestFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected