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

Function test_zuc_cipher_sgl

dpdk/app/test/test_cryptodev.c:6245–6383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6243}
6244
6245static int
6246test_zuc_cipher_sgl(const struct wireless_test_data *tdata,
6247 enum rte_crypto_cipher_operation direction)
6248{
6249 struct crypto_testsuite_params *ts_params = &testsuite_params;
6250 struct crypto_unittest_params *ut_params = &unittest_params;
6251
6252 int retval;
6253
6254 unsigned int plaintext_pad_len, ciphertext_pad_len;
6255 unsigned int plaintext_len = 0;
6256 unsigned int ciphertext_len = 0;
6257 const uint8_t *ciphertext, *plaintext;
6258 uint8_t buffer[2048];
6259 struct rte_cryptodev_info dev_info;
6260
6261 /* Check if device supports ZUC EEA3 */
6262 if (check_cipher_capability(ts_params, RTE_CRYPTO_CIPHER_ZUC_EEA3,
6263 tdata->key.len, tdata->cipher_iv.len) < 0)
6264 return TEST_SKIPPED;
6265
6266 if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
6267 return TEST_SKIPPED;
6268
6269 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
6270
6271 uint64_t feat_flags = dev_info.feature_flags;
6272
6273 if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) {
6274 printf("Device doesn't support in-place scatter-gather. "
6275 "Test Skipped.\n");
6276 return TEST_SKIPPED;
6277 }
6278
6279 if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) &&
6280 (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) {
6281 printf("Device doesn't support RAW data-path APIs.\n");
6282 return TEST_SKIPPED;
6283 }
6284
6285 if (direction == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
6286 plaintext_len = ceil_byte_length(tdata->plaintext.len);
6287
6288 /* Append data which is padded to a multiple */
6289 /* of the algorithms block size */
6290 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
6291
6292 ut_params->ibuf = create_segmented_mbuf(ts_params->mbuf_pool,
6293 plaintext_pad_len, 10, 0);
6294
6295 pktmbuf_write(ut_params->ibuf, 0, plaintext_len,
6296 tdata->plaintext.data);
6297 } else {
6298 ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
6299
6300 /* Append data which is padded to a multiple */
6301 /* of the algorithms block size */
6302 ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 8);

Calls 12

check_cipher_capabilityFunction · 0.85
rte_cryptodev_info_getFunction · 0.85
ceil_byte_lengthFunction · 0.85
create_segmented_mbufFunction · 0.85
pktmbuf_writeFunction · 0.85
process_sym_raw_dp_opFunction · 0.85
rte_pktmbuf_readFunction · 0.85
debug_hexdumpFunction · 0.85
process_crypto_requestFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected