| 4711 | } |
| 4712 | |
| 4713 | static int test_snow3g_decryption(const struct snow3g_test_data *tdata) |
| 4714 | { |
| 4715 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 4716 | struct crypto_unittest_params *ut_params = &unittest_params; |
| 4717 | |
| 4718 | int retval; |
| 4719 | |
| 4720 | uint8_t *plaintext, *ciphertext; |
| 4721 | unsigned ciphertext_pad_len; |
| 4722 | unsigned ciphertext_len; |
| 4723 | struct rte_cryptodev_info dev_info; |
| 4724 | |
| 4725 | rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); |
| 4726 | uint64_t feat_flags = dev_info.feature_flags; |
| 4727 | |
| 4728 | if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) && |
| 4729 | (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) { |
| 4730 | printf("Device doesn't support RAW data-path APIs.\n"); |
| 4731 | return TEST_SKIPPED; |
| 4732 | } |
| 4733 | |
| 4734 | if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO) |
| 4735 | return TEST_SKIPPED; |
| 4736 | |
| 4737 | /* Verify the capabilities */ |
| 4738 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 4739 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; |
| 4740 | cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2; |
| 4741 | if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], |
| 4742 | &cap_idx) == NULL) |
| 4743 | return TEST_SKIPPED; |
| 4744 | |
| 4745 | /* Create SNOW 3G session */ |
| 4746 | retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0], |
| 4747 | RTE_CRYPTO_CIPHER_OP_DECRYPT, |
| 4748 | RTE_CRYPTO_CIPHER_SNOW3G_UEA2, |
| 4749 | tdata->key.data, tdata->key.len, |
| 4750 | tdata->cipher_iv.len); |
| 4751 | if (retval < 0) |
| 4752 | return retval; |
| 4753 | |
| 4754 | ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); |
| 4755 | |
| 4756 | /* Clear mbuf payload */ |
| 4757 | memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, |
| 4758 | rte_pktmbuf_tailroom(ut_params->ibuf)); |
| 4759 | |
| 4760 | ciphertext_len = ceil_byte_length(tdata->ciphertext.len); |
| 4761 | /* Append data which is padded to a multiple of */ |
| 4762 | /* the algorithms block size */ |
| 4763 | ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 16); |
| 4764 | ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, |
| 4765 | ciphertext_pad_len); |
| 4766 | memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len); |
| 4767 | |
| 4768 | debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len); |
| 4769 | |
| 4770 | /* Create SNOW 3G operation */ |
no test coverage detected