| 3377 | } |
| 3378 | |
| 3379 | static int |
| 3380 | test_kasumi_authentication(const struct kasumi_hash_test_data *tdata) |
| 3381 | { |
| 3382 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 3383 | struct crypto_unittest_params *ut_params = &unittest_params; |
| 3384 | |
| 3385 | int retval; |
| 3386 | unsigned plaintext_pad_len; |
| 3387 | unsigned plaintext_len; |
| 3388 | uint8_t *plaintext; |
| 3389 | struct rte_cryptodev_info dev_info; |
| 3390 | |
| 3391 | rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); |
| 3392 | uint64_t feat_flags = dev_info.feature_flags; |
| 3393 | |
| 3394 | if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) && |
| 3395 | (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) { |
| 3396 | printf("Device doesn't support RAW data-path APIs.\n"); |
| 3397 | return TEST_SKIPPED; |
| 3398 | } |
| 3399 | |
| 3400 | if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO) |
| 3401 | return TEST_SKIPPED; |
| 3402 | |
| 3403 | /* Verify the capabilities */ |
| 3404 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 3405 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 3406 | cap_idx.algo.auth = RTE_CRYPTO_AUTH_KASUMI_F9; |
| 3407 | if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], |
| 3408 | &cap_idx) == NULL) |
| 3409 | return TEST_SKIPPED; |
| 3410 | |
| 3411 | /* Create KASUMI session */ |
| 3412 | retval = create_wireless_algo_hash_session(ts_params->valid_devs[0], |
| 3413 | tdata->key.data, tdata->key.len, |
| 3414 | 0, tdata->digest.len, |
| 3415 | RTE_CRYPTO_AUTH_OP_GENERATE, |
| 3416 | RTE_CRYPTO_AUTH_KASUMI_F9); |
| 3417 | if (retval < 0) |
| 3418 | return retval; |
| 3419 | |
| 3420 | /* alloc mbuf and set payload */ |
| 3421 | ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); |
| 3422 | |
| 3423 | memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, |
| 3424 | rte_pktmbuf_tailroom(ut_params->ibuf)); |
| 3425 | |
| 3426 | plaintext_len = ceil_byte_length(tdata->plaintext.len); |
| 3427 | /* Append data which is padded to a multiple of */ |
| 3428 | /* the algorithms block size */ |
| 3429 | plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8); |
| 3430 | plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, |
| 3431 | plaintext_pad_len); |
| 3432 | memcpy(plaintext, tdata->plaintext.data, plaintext_len); |
| 3433 | |
| 3434 | /* Create KASUMI operation */ |
| 3435 | retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len, |
| 3436 | NULL, 0, |
no test coverage detected