| 14163 | } |
| 14164 | |
| 14165 | static int |
| 14166 | test_AES_GMAC_authentication_verify(const struct gmac_test_data *tdata) |
| 14167 | { |
| 14168 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 14169 | struct crypto_unittest_params *ut_params = &unittest_params; |
| 14170 | int retval; |
| 14171 | uint32_t plaintext_pad_len; |
| 14172 | uint8_t *plaintext; |
| 14173 | struct rte_cryptodev_info dev_info; |
| 14174 | |
| 14175 | rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); |
| 14176 | uint64_t feat_flags = dev_info.feature_flags; |
| 14177 | |
| 14178 | if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) && |
| 14179 | (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) { |
| 14180 | printf("Device doesn't support RAW data-path APIs.\n"); |
| 14181 | return TEST_SKIPPED; |
| 14182 | } |
| 14183 | |
| 14184 | TEST_ASSERT_NOT_EQUAL(tdata->gmac_tag.len, 0, |
| 14185 | "No GMAC length in the source data"); |
| 14186 | |
| 14187 | /* Verify the capabilities */ |
| 14188 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 14189 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 14190 | cap_idx.algo.auth = RTE_CRYPTO_AUTH_AES_GMAC; |
| 14191 | if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], |
| 14192 | &cap_idx) == NULL) |
| 14193 | return TEST_SKIPPED; |
| 14194 | |
| 14195 | retval = create_gmac_session(ts_params->valid_devs[0], |
| 14196 | tdata, RTE_CRYPTO_AUTH_OP_VERIFY); |
| 14197 | |
| 14198 | if (retval == TEST_SKIPPED) |
| 14199 | return TEST_SKIPPED; |
| 14200 | if (retval < 0) |
| 14201 | return retval; |
| 14202 | |
| 14203 | if (tdata->plaintext.len > MBUF_SIZE) |
| 14204 | ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool); |
| 14205 | else |
| 14206 | ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); |
| 14207 | TEST_ASSERT_NOT_NULL(ut_params->ibuf, |
| 14208 | "Failed to allocate input buffer in mempool"); |
| 14209 | |
| 14210 | memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, |
| 14211 | rte_pktmbuf_tailroom(ut_params->ibuf)); |
| 14212 | |
| 14213 | plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16); |
| 14214 | |
| 14215 | /* |
| 14216 | * Runtime generate the large plain text instead of use hard code |
| 14217 | * plain text vector. It is done to avoid create huge source file |
| 14218 | * with the test vector. |
| 14219 | */ |
| 14220 | if (tdata->plaintext.len == GMAC_LARGE_PLAINTEXT_LENGTH) |
| 14221 | generate_gmac_large_plaintext(tdata->plaintext.data); |
| 14222 |
no test coverage detected