| 13029 | } |
| 13030 | |
| 13031 | static int |
| 13032 | test_MD5_HMAC_generate(const struct HMAC_MD5_vector *test_case) |
| 13033 | { |
| 13034 | uint16_t plaintext_pad_len; |
| 13035 | uint8_t *plaintext, *auth_tag; |
| 13036 | int ret; |
| 13037 | |
| 13038 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 13039 | struct crypto_unittest_params *ut_params = &unittest_params; |
| 13040 | struct rte_cryptodev_info dev_info; |
| 13041 | |
| 13042 | rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); |
| 13043 | uint64_t feat_flags = dev_info.feature_flags; |
| 13044 | |
| 13045 | if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) && |
| 13046 | (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) { |
| 13047 | printf("Device doesn't support RAW data-path APIs.\n"); |
| 13048 | return TEST_SKIPPED; |
| 13049 | } |
| 13050 | |
| 13051 | /* Verify the capabilities */ |
| 13052 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 13053 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 13054 | cap_idx.algo.auth = RTE_CRYPTO_AUTH_MD5_HMAC; |
| 13055 | if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], |
| 13056 | &cap_idx) == NULL) |
| 13057 | return TEST_SKIPPED; |
| 13058 | |
| 13059 | if (MD5_HMAC_create_session(ts_params, ut_params, |
| 13060 | RTE_CRYPTO_AUTH_OP_GENERATE, test_case)) |
| 13061 | return TEST_FAILED; |
| 13062 | |
| 13063 | /* Generate Crypto op data structure */ |
| 13064 | ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, |
| 13065 | RTE_CRYPTO_OP_TYPE_SYMMETRIC); |
| 13066 | TEST_ASSERT_NOT_NULL(ut_params->op, |
| 13067 | "Failed to allocate symmetric crypto operation struct"); |
| 13068 | |
| 13069 | plaintext_pad_len = RTE_ALIGN_CEIL(test_case->plaintext.len, |
| 13070 | 16); |
| 13071 | |
| 13072 | if (MD5_HMAC_create_op(ut_params, test_case, &plaintext)) |
| 13073 | return TEST_FAILED; |
| 13074 | |
| 13075 | if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO) |
| 13076 | process_cpu_crypt_auth_op(ts_params->valid_devs[0], |
| 13077 | ut_params->op); |
| 13078 | else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) { |
| 13079 | ret = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 0, 0); |
| 13080 | if (ret != TEST_SUCCESS) |
| 13081 | return ret; |
| 13082 | } else |
| 13083 | TEST_ASSERT_NOT_NULL( |
| 13084 | process_crypto_request(ts_params->valid_devs[0], |
| 13085 | ut_params->op), |
| 13086 | "failed to process sym crypto op"); |
| 13087 | |
| 13088 | TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, |
no test coverage detected