| 3468 | } |
| 3469 | |
| 3470 | static int |
| 3471 | test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata) |
| 3472 | { |
| 3473 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 3474 | struct crypto_unittest_params *ut_params = &unittest_params; |
| 3475 | |
| 3476 | int retval; |
| 3477 | unsigned plaintext_pad_len; |
| 3478 | unsigned plaintext_len; |
| 3479 | uint8_t *plaintext; |
| 3480 | struct rte_cryptodev_info dev_info; |
| 3481 | |
| 3482 | rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); |
| 3483 | uint64_t feat_flags = dev_info.feature_flags; |
| 3484 | |
| 3485 | if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) && |
| 3486 | (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) { |
| 3487 | printf("Device doesn't support RAW data-path APIs.\n"); |
| 3488 | return TEST_SKIPPED; |
| 3489 | } |
| 3490 | |
| 3491 | if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO) |
| 3492 | return TEST_SKIPPED; |
| 3493 | |
| 3494 | /* Verify the capabilities */ |
| 3495 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 3496 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 3497 | cap_idx.algo.auth = RTE_CRYPTO_AUTH_KASUMI_F9; |
| 3498 | if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], |
| 3499 | &cap_idx) == NULL) |
| 3500 | return TEST_SKIPPED; |
| 3501 | |
| 3502 | /* Create KASUMI session */ |
| 3503 | retval = create_wireless_algo_hash_session(ts_params->valid_devs[0], |
| 3504 | tdata->key.data, tdata->key.len, |
| 3505 | 0, tdata->digest.len, |
| 3506 | RTE_CRYPTO_AUTH_OP_VERIFY, |
| 3507 | RTE_CRYPTO_AUTH_KASUMI_F9); |
| 3508 | if (retval < 0) |
| 3509 | return retval; |
| 3510 | /* alloc mbuf and set payload */ |
| 3511 | ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); |
| 3512 | |
| 3513 | memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, |
| 3514 | rte_pktmbuf_tailroom(ut_params->ibuf)); |
| 3515 | |
| 3516 | plaintext_len = ceil_byte_length(tdata->plaintext.len); |
| 3517 | /* Append data which is padded to a multiple */ |
| 3518 | /* of the algorithms block size */ |
| 3519 | plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8); |
| 3520 | plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, |
| 3521 | plaintext_pad_len); |
| 3522 | memcpy(plaintext, tdata->plaintext.data, plaintext_len); |
| 3523 | |
| 3524 | /* Create KASUMI operation */ |
| 3525 | retval = create_wireless_algo_hash_operation(tdata->digest.data, |
| 3526 | tdata->digest.len, |
| 3527 | NULL, 0, |
no test coverage detected